Mail Archives: cygwin-developers/1998/10/16/05:59:19
On Fri, Oct 16, 1998 at 11:59:47AM +0300, Sergey Okhapkin wrote:
>dcrt0.cc (build_argv): only space and tab are command line separators,
>but not all characters returned by isspace().
>
>With this fix sed problems while configuring cdk are gone, but if
>CONFIG_SHELL is bash, ash still reports:
>
>$ nice /usr/src/cygnus/src/configure --host=i586-cygwin32 --prefix=/usr --exec-prefix=/usr/H-i386-cygwin32 -v
>/usr/src/cygnus/src/configure: 679: Syntax error: EOF in backquote substitution
>$
This is scary. DJ noticed this problem yesterday, and I made a change
to dcrt0.cc by making a macro called -- issep to handle it, just like
you did. The only difference is that I also accounted for \r and \n
since the command line may have come from the (sigh) @file stuff.
I also check for this in spawn_guts just to be safe.
I wonder if allowing \r and \n is what is causing the problems with sed,
though. Although, catching this in spawn might help.
Do you want to give this patch a try?
cgf
Index: dcrt0.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/dcrt0.cc,v
retrieving revision 1.115
diff -u -p -r1.115 dcrt0.cc
--- dcrt0.cc 1998/10/13 03:14:52 1.115
+++ dcrt0.cc 1998/10/16 12:47:19
@@ -387,7 +384,7 @@ build_argv (char *cmd, char **&argv, int
while (*cmd)
{
/* Ignore spaces */
- if (isspace (*cmd))
+ if (issep (*cmd))
{
cmd++;
continue;
@@ -406,7 +403,7 @@ build_argv (char *cmd, char **&argv, int
sawquote = cmd;
cmd = quoted (word, cmd, winshell);
}
- if (isspace (*cmd)) // End of argument if space
+ if (issep (*cmd)) // End of argument if space
break;
}
if (*cmd)
Index: spawn.cc
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/spawn.cc,v
retrieving revision 1.84
diff -u -p -r1.84 spawn.cc
--- spawn.cc 1998/10/15 16:02:28 1.84
+++ spawn.cc 1998/10/16 12:47:19
@@ -214,7 +214,7 @@ spawn_guts (HANDLE hToken, const char *
{
if (*str == '"')
clen++;
- if (*str == ' ' || *str == '\t' || *str == '"')
+ if (issep (*str) || *str == '"')
needquote = 1;
clen++;
}
@@ -245,7 +245,7 @@ spawn_guts (HANDLE hToken, const char *
needquote = 1;
for (str = argv[i]; *str; str++)
- if (*str == ' ' || *str == '\t' || *str == '"')
+ if (issep (*str) || *str == '"')
needquote = 1;
if (needquote)
Index: winsup.h
===================================================================
RCS file: /cvs/cvsfiles/devo/winsup/winsup.h,v
retrieving revision 1.120
diff -u -p -r1.120 winsup.h
--- winsup.h 1998/10/09 02:56:24 1.120
+++ winsup.h 1998/10/16 12:49:32
@@ -677,3 +677,6 @@ class save_errno
void reset () {saved = get_errno ();}
~save_errno () {set_errno (saved);}
};
+
+#undef issep
+#define issep(ch) (strchr (" \t\n\r", (ch)) != NULL)
- Raw text -