]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 56655] Allow pattern expansion to contain spaces
authorPaul Smith <psmith@gnu.org>
Thu, 26 Dec 2019 23:39:56 +0000 (18:39 -0500)
committerPaul Smith <psmith@gnu.org>
Thu, 26 Dec 2019 23:39:56 +0000 (18:39 -0500)
* src/dep.h: Add a new flag PARSEFS_ONEWORD
* src/read.c (parse_file_seq): If PARSEFS_ONEWORD is given, treat the
entire incoming string as a single pattern.
* src/implicit.c (pattern_search): Pass PARSEFS_ONEWORD when parsing
patterns for wildcards.
* tests/scripts/features/patternrules: Add a new test.

src/dep.h
src/implicit.c
src/read.c
tests/scripts/features/patternrules

index d44a507aceee5643970e7128dcc3a64748a3e986..87872600c00dd0244c664fe4c8ab85b17d025996 100644 (file)
--- a/src/dep.h
+++ b/src/dep.h
@@ -74,6 +74,7 @@ struct goaldep
 #define PARSEFS_NOGLOB  0x0004
 #define PARSEFS_EXISTS  0x0008
 #define PARSEFS_NOCACHE 0x0010
+#define PARSEFS_ONEWORD 0x0020
 
 #define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
             (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
index f7b8c15256fc743deaff15a224b1b0890746af39..96f453c8940d35f5a99b7c6b86d5f86e24646cac 100644 (file)
@@ -559,7 +559,7 @@ pattern_search (struct file *file, int archive,
 
                   /* Parse the expanded string.  It might have wildcards.  */
                   p = depname;
-                  dl = PARSE_SIMPLE_SEQ (&p, struct dep);
+                  dl = PARSE_FILE_SEQ (&p, struct dep, MAP_NUL, NULL, PARSEFS_ONEWORD);
                   for (d = dl; d != NULL; d = d->next)
                     {
                       ++deps_found;
index 5df9c2a3bc11999f9fc8bf942126877d685673b8..eec1c3389d5e2c79e9e9bed2ffbf353c34088ea1 100644 (file)
@@ -3138,7 +3138,10 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
   char *p;
   glob_t gl;
   char *tp;
-  int findmap = stopmap|MAP_VMSCOMMA|MAP_BLANK|MAP_NUL;
+  int findmap = stopmap|MAP_VMSCOMMA|MAP_NUL;
+
+  if (NONE_SET (flags, PARSEFS_ONEWORD))
+    findmap |= MAP_BLANK;
 
   /* Always stop on NUL.  */
   stopmap |= MAP_NUL;
index c2a8c98533149a1185b395e3d004f9648e11f5ae..09197f510d87c31818bb9e75c5ac76b76723d3f2 100644 (file)
@@ -236,6 +236,14 @@ all: a.elf a.dbg
 
 unlink('a.c');
 
+# SV 56655: Test patterns matching files containing whitespace
+touch('some file.yy');
+run_make_test(q!
+%.xx : %.yy ; @echo matched
+!, 'some\ file.xx', "matched\n");
+
+unlink('some file.xx', 'some file.yy');
+
 # This tells the test driver that the perl test script executed properly.
 1;