]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 56449] (Windows) Use slow path if '%' appears in the command
authorChristian Eggers <ceggers@arri.de>
Thu, 6 Jun 2019 10:42:38 +0000 (12:42 +0200)
committerPaul Smith <psmith@gnu.org>
Sun, 14 Jul 2019 13:28:31 +0000 (09:28 -0400)
* src/job.c (sh_chars_dos): Add '%' as a special character
* src/job.c (construct_command_argv_internal): Check for '%' in quotes

For the windows version of make, a recipe line cannot be executed
diretly by make (without a shell) if a '%' character is present. This
character starts a cmd.exe escape sequence.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Copyright-paperwork-exempt: yes

src/job.c

index 54dd284fbb18d45b000349dd930ffd8c713a1e84..1df329ee2dc303d67d0177705e8181d15c5916e5 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -2660,7 +2660,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
      can handle quoted file names just fine, removing the quote lifts
      the limit from a very frequent use case, because using quoted
      file names is commonplace on MS-Windows.  */
-  static const char *sh_chars_dos = "|&<>";
+  static const char *sh_chars_dos = "|&<>%";
   static const char *sh_cmds_dos[] =
     { "assoc", "break", "call", "cd", "chcp", "chdir", "cls", "color", "copy",
       "ctty", "date", "del", "dir", "echo", "echo.", "endlocal", "erase",
@@ -2861,9 +2861,9 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
           else if (instring == '"' && strchr ("\\$`", *p) != 0 && unixy_shell)
             goto slow;
 #ifdef WINDOWS32
-          /* Quoted wildcard characters must be passed quoted to the
+          /* Quoted wildcard and % characters must be passed quoted to the
              command, so give up the fast route.  */
-          else if (instring == '"' && strchr ("*?", *p) != 0 && !unixy_shell)
+          else if (instring == '"' && strchr ("*?%", *p) != 0 && !unixy_shell)
             goto slow;
           else if (instring == '"' && strncmp (p, "\\\"", 2) == 0)
             *ap++ = *++p;