Re: Problems with GNU make in Windows 7 (64-bit)

Eli Zaretskii <[email protected]>
Newsgroups gmane.comp.gnu.make.windows
Message-ID <[email protected]>
> From: Rob Juergens <[email protected]>
> Date: Fri, 6 May 2011 10:02:14 -0700
> 
> > The problem only happens in Windows 7 64-bit.  I don't seem to get the problem when running 64-bit XP.
> 
> Do you have the same (x86) part in the directory name on 64-bit XP?
> 
> 
> Yes

Strange.

Anyway, can you try the patch below?  If it gives good results, I will
commit it to the repository.

And please keep the mailing list on the CC list.

--- job.c~2	2010-07-24 14:27:50.000000000 +0300
+++ job.c	2011-05-06 22:24:41.879500000 +0300
@@ -2792,12 +2792,12 @@
 
     unsigned int shell_len = strlen (shell);
     unsigned int line_len = strlen (line);
-    unsigned int sflags_len = strlen (shellflags);
+    unsigned int sflags_len = shellflags ? strlen (shellflags) : 0;
     char *command_ptr = NULL; /* used for batch_mode_shell mode */
     char *new_line;
 
 # ifdef __EMX__ /* is this necessary? */
-    if (!unixy_shell)
+    if (!unixy_shell && shellflags)
       shellflags[0] = '/'; /* "/c" */
 # endif
 
@@ -2859,19 +2859,24 @@
 
 	new_argv = xmalloc (4 * sizeof (char *));
 	new_argv[0] = xstrdup(shell);
-	new_argv[1] = xstrdup(shellflags);
+	new_argv[1] = xstrdup(shellflags ? shellflags : "");
 	new_argv[2] = line;
 	new_argv[3] = NULL;
 	return new_argv;
       }
 
-    new_line = alloca (shell_len + 1 + sflags_len + 1
+    new_line = alloca ((shell_len*2) + 1 + sflags_len + 1
                              + (line_len*2) + 1);
     ap = new_line;
-    memcpy (ap, shell, shell_len);
-    ap += shell_len;
+    for (p = shell; *p != '\0'; ++p)
+      {
+	if (strchr (sh_chars, *p) != 0)
+	  *(ap++) = '\\';
+	*(ap++) = *p;
+      }
     *(ap++) = ' ';
-    memcpy (ap, shellflags, sflags_len);
+    if (shellflags)
+      memcpy (ap, shellflags, sflags_len);
     ap += sflags_len;
     *(ap++) = ' ';
     command_ptr = ap;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.