Fixes from Eli Zaretskii:
authorPaul Smith <psmith@gnu.org>
Wed, 10 Oct 2007 13:22:21 +0000 (13:22 +0000)
committerPaul Smith <psmith@gnu.org>
Wed, 10 Oct 2007 13:22:21 +0000 (13:22 +0000)
Fix to allow quoted directories in PATH.
Fix for Savannah bug #20549.

ChangeLog
function.c
job.c
job.h
w32/pathstuff.c

index c9d3eb165aa0ed25b0b9efeab16fbcfffd4bed8b..4fdf37465ab47c797f86fb77758068851f8f226b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * make.h: Add a prototype for w32_kill() (change suggested by
        Yongwei Wu <wuyongwei@gmail.com>).
 
+2007-09-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32/pathstuff.c (convert_Path_to_windows32): Handle quoted
+       directories in Path.
+
 2007-08-15  Paul Smith  <psmith@gnu.org>
 
        * doc/make.texi (GNU Free Documentation License): The fdl.texi
        then (order-only for example) but they will be this time.
        Fixes Savannah bug #'s 3330 and 15919.
 
+2007-07-21  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix Savannah bug #20549:
+       * function.c (func_shell): Call construct_command_argv with zero
+       value of FLAGS.
+       * job.c (construct_command_argv_internal): New argument FLAGS; all
+       callers changed.
+       [WINDOWS32]: If FLAGS has the COMMANDS_RECURSE bit set, ignore
+       just_print_flag.
+       * job.h (construct_command_argv_internal): Update prototype.
+
 2007-07-13  Paul Smith  <psmith@gnu.org>
 
        * file.c (expand_deps): Use variable_buffer as the start of the
index 4be234009a3b083e665b7e015b6d8df242d46e9e..09edbadf984667f9bb992b4ef183d85b95a964f7 100644 (file)
@@ -1601,7 +1601,8 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
 
 #ifndef __MSDOS__
   /* Construct the argument list.  */
-  command_argv = construct_command_argv (argv[0], NULL, NULL, &batch_filename);
+  command_argv = construct_command_argv (argv[0], NULL, NULL, 0,
+                                         &batch_filename);
   if (command_argv == 0)
     return o;
 #endif
@@ -1785,8 +1786,8 @@ func_shell (char *o, char **argv, const char *funcname)
   char* batch_filename = NULL;
 
   /* Construct the argument list.  */
-  command_argv = construct_command_argv (argv[0], (char **) NULL,
-                                         (struct file *) 0, &batch_filename);
+  command_argv = construct_command_argv (argv[0], NULL, NULL, 0,
+                                         &batch_filename);
   if (command_argv == 0)
     return o;
 
diff --git a/job.c b/job.c
index afae60e02f52d4cb73c509825d7531cae75ba624..c877dca346acbabbbd71b609aad3c3ddce5feb9f 100644 (file)
--- a/job.c
+++ b/job.c
@@ -1016,7 +1016,9 @@ start_job_command (struct child *child)
 #ifdef VMS
     argv = p;
 #else
-    argv = construct_command_argv (p, &end, child->file, &child->sh_batch_file);
+    argv = construct_command_argv (p, &end, child->file,
+                                  child->file->cmds->lines_flags[child->command_line - 1],
+                                  &child->sh_batch_file);
 #endif
     if (end == NULL)
       child->command_ptr = NULL;
@@ -2200,11 +2202,17 @@ void clean_tmp (void)
    If *RESTP is NULL, newlines will be ignored.
 
    SHELL is the shell to use, or nil to use the default shell.
-   IFS is the value of $IFS, or nil (meaning the default).  */
+   IFS is the value of $IFS, or nil (meaning the default).
+
+   FLAGS is the value of lines_flags for this command line.  It is
+   used in the WINDOWS32 port to check whether + or $(MAKE) were found
+   in this command line, in which case the effect of just_print_flag
+   is overridden.  */
 
 static char **
 construct_command_argv_internal (char *line, char **restp, char *shell,
-                                 char *ifs, char **batch_filename_ptr)
+                                 char *ifs, int flags,
+                                char **batch_filename_ptr)
 {
 #ifdef __MSDOS__
   /* MSDOS supports both the stock DOS shell and ports of Unixy shells.
@@ -2784,7 +2792,7 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
     /* Some shells do not work well when invoked as 'sh -c xxx' to run a
        command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems).  In these
        cases, run commands via a script file.  */
-    if (just_print_flag) {
+    if (just_print_flag && !(flags & COMMANDS_RECURSE)) {
       /* Need to allocate new_argv, although it's unused, because
         start_job_command will want to free it and its 0'th element.  */
       new_argv = xmalloc(2 * sizeof (char *));
@@ -2826,7 +2834,7 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
     } else
 #endif /* WINDOWS32 */
     if (unixy_shell)
-      new_argv = construct_command_argv_internal (new_line, 0, 0, 0, 0);
+      new_argv = construct_command_argv_internal (new_line, 0, 0, 0, flags, 0);
 #ifdef __EMX__
     else if (!unixy_shell)
       {
@@ -2937,7 +2945,7 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
 
 char **
 construct_command_argv (char *line, char **restp, struct file *file,
-                        char **batch_filename_ptr)
+                        int cmd_flags, char **batch_filename_ptr)
 {
   char *shell, *ifs;
   char **argv;
@@ -3049,7 +3057,8 @@ construct_command_argv (char *line, char **restp, struct file *file,
     warn_undefined_variables_flag = save;
   }
 
-  argv = construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr);
+  argv = construct_command_argv_internal (line, restp, shell, ifs,
+                                          cmd_flags, batch_filename_ptr);
 
   free (shell);
   free (ifs);
diff --git a/job.h b/job.h
index 8ed0969d08cb8dca51d4aae85688bf5a3020f9b8..ea6d7e8fa0b421d1f7c2310100e5453637785eae 100644 (file)
--- a/job.h
+++ b/job.h
@@ -70,7 +70,8 @@ void new_job (struct file *file);
 void reap_children (int block, int err);
 void start_waiting_jobs (void);
 
-char **construct_command_argv (char *line, char **restp, struct file *file, char** batch_file);
+char **construct_command_argv (char *line, char **restp, struct file *file,
+                               int cmd_flags, char** batch_file);
 #ifdef VMS
 int child_execute_job (char *argv, struct child *child);
 #elif defined(__EMX__)
index 06223497ffd748598fa3fd138b527e4a3a49d873..6f712d1f7994afb44dab3f7610412309c4690d8a 100644 (file)
@@ -70,11 +70,17 @@ convert_Path_to_windows32(char *Path, char to_delim)
             } else
                 /* all finished, force abort */
                 p += strlen(p);
+        } else if (*p == '"') { /* a quoted directory */
+            for (p++; *p && *p != '"'; p++) /* skip quoted part */
+                ;
+            etok = strpbrk(p, ":;");        /* find next delimiter */
+            *etok = to_delim;
+            p = ++etok;
         } else {
             /* found another one, no drive letter */
             *etok = to_delim;
             p = ++etok;
-       }
+        }
 
     return Path;
 }