cvs commit:fptools/libraries/base/SystemCmd.hsfptools/ghc/compiler/mainSysTools.lhs

Simon Marlow simonmar at microsoft.com
Mon Mar 15 14:37:39 EST 2004


> > sof         2004/03/12 11:43:07 PST
> > 
> >   Modified files:        (Branch: ghc-6-2-branch)
> >     libraries/base/System Cmd.hs 
> >     ghc/compiler/main    SysTools.lhs 
> >   Log:
> >   Fix 2 bugs:
> >   - SysTools.runSomething: peeling off args from 'cmd' is 
> not going to
> >     work if the real cmd isn't quoted. I forget whether it ever was,
> >     but at least it isn't currently, so be dull and pass 'cmd' along
> >     untouched.
> >   - SysTools.rawSystem, System.Cmd.rawSystem: 
> CreateProcess() expects
> >     the command name to be unquoted; disable its quoting 
> (as 6.2 did.)
> >   
> >   Hoick to HEAD.
> 
> *confused*
> 
> The CreateProcess() documentation says this:
> 
>   ... the first white-space - delimited token of the command line
>   specifies the module name. If you are using a long file name that
>   contains a space, use quoted strings to indicate where the file
>   name ends and the arguments begin 
> 
> How can it be right not to quote the command name?  How can
> CreateProcess() tell where the command ends and the arguments 
> begin, if the command has spaces in it?
> 
> I'm getting my Win32 build of 6.2.1 up and running so I can test this.

Indeed, after this change rawSystem on Win32 has bugs.  Strangely
CreateProcess() does magically cope with spaces in the command name even
if it isn't quoted, but gets confused (obviously) if there's an
executable with the same basename as one of the directory components in
the path.

So, what goes wrong if the command name is quoted?  Seems to work fine
here.

Cheers,	
	Simon 


More information about the Cvs-libraries mailing list