guile-devel
[Top][All Lists]
Advanced

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

Re: c-api.test fails on MS-Windows due to non-portable quoting


From: Mark H Weaver
Subject: Re: c-api.test fails on MS-Windows due to non-portable quoting
Date: Wed, 10 Aug 2016 02:24:56 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Andy Wingo <address@hidden>
>> Cc: address@hidden
>> Date: Sat, 23 Jul 2016 23:11:08 +0200
>> 
>> > It fails like this:
>> >
>> >      Running c-api.test
>> >      'CUR' is not recognized as an internal or external command,
>> >      operable program or batch file.
>> >      egrep: Unmatched ( or \('CUR' is not recognized as an internal or 
>> > external command, operable program or batch file.
>> >
>> > This is because it quotes shell commands /bin/sh '..' style:
>> 
>> Of course, because that's how `system' is specified.
>
> On Posix hosts, yes.  But the ANSI C standard only says that the
> argument will be passed to the host environment's command processor.
>
>> > --- test-suite/tests/c-api.test~0     2016-01-02 13:32:40.000000000 +0200
>> > +++ test-suite/tests/c-api.test       2016-07-23 14:12:57.257375000 +0300
>> > @@ -22,7 +22,7 @@
>> >  (define srcdir (cdr (assq 'srcdir %guile-build-info)))
>> >  
>> >  (define (egrep string filename)
>> > -  (zero? (system (string-append "egrep '" string "' " filename
>> > +  (zero? (system (string-append "egrep \"" string "\" " filename
>> >                                  " >" %null-device))))
>> >  
>> >  (define (seek-offset-test dirname)
>> >
>> > OK to push such a change?
>> 
>> I think instead to get this to work on MinGW we should switch to use
>> system* instead of praying that we get quoting right ;) Something like:
>> 
>>   (zero? (system* "egrep" "-q" string filename))
>
> For this to work, the Windows implementation of system* will need to
> be augmented to quote characters special for the shell, because
> (unlike execvp on Posix hosts) the arguments of spawnvp are eventually
> concatenated into a single string that gets passed to the system API
> which invokes programs.  If this is the way you are willing to solve
> this, I will submit a patch to that effect.

I think this is the approach we should take here.  In general, we prefer
to use 'system*' over 'system' because it avoids having to worry about
quoting issues on POSIX systems.  We should enable this to work properly
on MinGW, and avoid a situation where users might be discouraged from
using 'system*' for the sake of MinGW compatibility.

What do you think?

      Mark



reply via email to

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