This is the mail archive of the
mailing list for the Cygwin project.
Re: Same code, same script, different results
Mikael Åsberg wrote:
> Anyway, it's working as expected now. But to tell the truth I don't know
> exactly what the problem was. I tinkered some with the script, did a make
> clean ; make (again), and, voila, it works. I'm glad that it works, but it's
> a bit annoying not understanding what the problem and the rememdy was.
You had DOS line endings (\r\n) on your bash script. To bash the \r is
just another character, not a line ending, and it was being included
with the other arguments. Thus argv was really "--non-recursive\r"
which caused the nonzero strcmp() result.
The difference between the two testcases results from the fact that
argument parsing is done by the runtime of the compiler/library. In
Windows there's really only one long command string for the process,
it's the job of the CRT to parse it into words for argv. The MSVCRT
treated the spurious \r as whitespace and did not include it in argv
whereas the Cygwin runtime made no such assumption.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html