This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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[2] 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[2]
whereas the Cygwin runtime made no such assumption.

Brian

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]