Web lists-archives.com

Re: Fails to launch batch script in some directories

On 2018-04-20 07:11, Corinna Vinschen wrote:
> On Apr 20 14:33, David Macek wrote:
>> Whoa, an interesting bug. I'm forwarding this to the Cygwin mailing list 
>> for reference. I might take a deeper look over the weekend if no-one beats
>> me to it.
>> It seems like running batch files (.bat, .cmd) inside a directory with an 
>> at sign and a space (such as '@ x' or 'x @') fails.
>> /w/temp/@ x$ ./hello.bat
>> 'W:\temp\@' is not recognized as an internal or external command, operable
>> program or batch file.
> Funny. That's very likely a bug in the @file handling in function 
> insert_file() in dcrt0.cc. This is basically stone-age old code to pamper
> starting Cygwin tools with too long commandl ines from cmd.
> I'm looking forward with what you're coming up with.

See my other post in this thread where strace shows @ handling is not involved,
as the script directory and name are normalized and converted to a win32 path
correctly, but child_info_spawn::worker does not appear to quote args with
spaces (or apostrophes) when building the command line, despite the comment near
the top of the function.
It is not clear where this quoting is expected to be done: it looks like
child_info_spawn::worker may do this itself when a script is invoked as
"cmd|command /c script" with argc == 3, but may be expecting a called function
to do this for other cases, as for a cmd script with no args and argc == 1.

Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple