Claus Reinke wrote:
but that does seem to be a bug in ghc-pkg-inplace.hs,
so perhaps that should be fixed first, and then we could use '*'
instead of '.' (even though it isn't full globbing, '*' is only
interpreted at string ends).
the problem is not specific to ghc-pkg-inplace, but is
shared by all ghc mingw programs using getArgs:
./main '*' -- this does not protect from globbing!
This is one of the ways in which the Windows command line is utterly and
completely broken by design. On Windows, cmd.exe expects the command
itself to do the globbing, not the shell. Also the command itself even
parses the command line; the C runtime on Windows has a command-line parser
with strange quoting semantics that we have to work around in
System.Cmd.rawSystem.
So different commands can (and do) have different quoting and globbing
semantics. Great huh?
Cygwin does things the Unix way: the shell does the globbing. Cygwin
commands try to detect whether they're running under cmd.exe and do their
own globbing if so. The Mingw runtime always does globbing unless you use
the trick from
http://www.cygwin.com/ml/cygwin/1999-11/msg00052.html
Maybe globbing is done after command-line parsing by the runtime, which
would account for why quoting doesn't defeat globbing. I don't know.
We could have a -no-globbing link-time option, but that would prevent
ghc-pkg register *.pkg
from cmd.exe (though not bash). The whole thing is so broken I don't think
there *is* a good solution.
Cheers,
Simon
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc