public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin/main] Cygwin: cygcheck: fix dependency search
Date: Sat, 11 Feb 2023 11:58:26 +0000 (GMT)	[thread overview]
Message-ID: <20230211115826.156FC3858D32@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b030a77dff515a857cf60bfc53a2a5e5e239cbb2

commit b030a77dff515a857cf60bfc53a2a5e5e239cbb2
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Sat Feb 11 12:53:34 2023 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sat Feb 11 12:53:34 2023 +0100

    Cygwin: cygcheck: fix dependency search
    
    Spaces are filtered out by PathMatchSpecA so they can't
    be used as pattern anchors.  Overwrite all spaces with
    commas and fix the search expresion accordingly.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/utils/mingw/cygcheck.cc | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/winsup/utils/mingw/cygcheck.cc b/winsup/utils/mingw/cygcheck.cc
index 66af2ce0b6a2..b5bad4ec20e2 100644
--- a/winsup/utils/mingw/cygcheck.cc
+++ b/winsup/utils/mingw/cygcheck.cc
@@ -2430,15 +2430,22 @@ collect_pkg_info (FILE *fp, ini_package_info *pi, bool search)
 	      else
 		{
 		  /* For pattern matching we need a standarized format.
-		     Make sure all deps are prepended by a space and all deps
-		     are trailed by a comma.  Note the missing space, that's
-		     deliberate to keep it in the stored string. */
+		     Make sure all deps are prepended and trailed by a comma.
+		     Note the missing space after the colon, that's deliberate
+		     to keep it in the stored string.  Originally we kept the
+		     spaces in, but spaces are filtered out by PathMatchSpecA,
+		     so we now replace all space by comma here. */
 		  char *start = buf + strlen ("depends2:");
 		  size_t len = strlen (start);
 
 		  vinfo->depends2 = (char *) calloc (len + 2, 1);
 		  if (vinfo->depends2)
-		    *stpcpy (vinfo->depends2, start) = ',';
+		    {
+		      *stpcpy (vinfo->depends2, start) = ',';
+		      char *cp = vinfo->depends2;
+		      while ((cp = strchr (cp, ' ')))
+			*cp = ',';
+		    }
 		}
 	    }
 	  else if (!strncmp (buf, "build-depends: ",
@@ -2455,7 +2462,12 @@ collect_pkg_info (FILE *fp, ini_package_info *pi, bool search)
 
 		  vinfo->build_depends = (char *) calloc (len + 2, 1);
 		  if (vinfo->build_depends)
-		    *stpcpy (vinfo->build_depends, start) = ',';
+		    {
+		      *stpcpy (vinfo->build_depends, start) = ',';
+		      char *cp = vinfo->build_depends;
+		      while ((cp = strchr (cp, ' ')))
+			*cp++ = ',';
+		    }
 		}
 	    }
 	}
@@ -2810,7 +2822,7 @@ package_search (char **search, int selector)
       ep = ext_search;
       if (selector)
 	{
-	  ep = stpcpy (ep, "* ");
+	  ep = stpcpy (ep, "*,");
 	  ep = stpcpy (ep, *search);
 	  ep = stpcpy (ep, ",*");
 	}

                 reply	other threads:[~2023-02-11 11:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230211115826.156FC3858D32@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).