make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #16362] Regression: make -n causes $(shell) failure on Windows


From: Eli Zaretskii
Subject: Re: [bug #16362] Regression: make -n causes $(shell) failure on Windows
Date: Sat, 27 May 2006 16:11:10 +0300

> Date: Fri, 21 Apr 2006 16:17:21 -0400
> Cc: J David Bryan <address@hidden>, address@hidden, address@hidden
> From: "Paul D. Smith" <address@hidden>
> 
> %% Eli Zaretskii <address@hidden> writes:
> 
>   ez> I see an easy, although not very elegant, band-aid: Temporarily turn
>   ez> off just_print_flag inside func_shell, since $(shell) is supposed to
>   ez> run the subsidiary process even under -n.  (Alternatively, we could
>   ez> use some other global variable, but that's even less clean.)
> 
>   ez> Paul, will that DTRT?  That is, is it okay to disregard
>   ez> just_print_flag inside func_shell, or could this cause trouble in some
>   ez> situations?
> 
> I can't think of any way this could cause problems.

Thanks.  Here's the suggested patch:

2006-05-27  Eli Zaretskii  <address@hidden>

        * function.c (func_shell) [WINDOWS32]: Reset just_print_flag
        around the call to construct_command_argv, so that a temporary
        batch file _is_ created when needed for $(shell).


--- function.c~0        2006-04-01 12:36:40.000000000 +0300
+++ function.c  2006-05-27 15:58:26.984375000 +0300
@@ -1589,12 +1589,25 @@ func_shell (char *o, char **argv, const 
   int pid;
 
 #ifndef __MSDOS__
+#ifdef WINDOWS32
+  /* Reset just_print_flag.  This is needed on Windows when batch files
+     are used to run the commands, because we normally refrain from
+     creating batch files under -n.  */
+  int j_p_f = just_print_flag;
+
+  just_print_flag = 0;
+#endif
   /* Construct the argument list.  */
   command_argv = construct_command_argv (argv[0],
                                         (char **) NULL, (struct file *) 0,
                                          &batch_filename);
   if (command_argv == 0)
-    return o;
+    {
+#ifdef WINDOWS32
+      just_print_flag = j_p_f;
+#endif
+      return o;
+    }
 #endif
 
   /* Using a target environment for `shell' loses in cases like:
@@ -1622,12 +1635,14 @@ func_shell (char *o, char **argv, const 
 #ifdef WINDOWS32
 
   windows32_openpipe (pipedes, &pid, command_argv, envp);
+  /* Restore the value of just_print_flag.  */
+  just_print_flag = j_p_f;
 
   if (pipedes[0] < 0) {
        /* open of the pipe failed, mark as failed execution */
     shell_function_completed = -1;
 
-       return o;
+    return o;
   } else
 
 #elif defined(__MSDOS__)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]