darcs patch: Protect internal ' in quoted system comm... (and 1 more)
Matthew William Cox
matt at mattcox.ca
Fri Aug 5 21:05:14 CEST 2011
Hello, 2 patches to contribute to cabal. The first is a simple oversite I
noticed while implementing the second. Essentially, the call out to an external
command by system has every supplied string wrapped in ', but doesn't escape
this character. This is fixed in the first patch.
Thu Aug 4 20:06:11 EDT 2011 matt at mattcox.ca
* Protect internal ' in quoted system commands
The previous implementation did not escape ' in the input which causes them to
break the quotation.
The second is support that I require for a project which needs to use hooks to
invoke cmake and make to build a legacy C component. I followed the existing
code conventions which make a few questionable choices. For one, the
progInvokeEnv field is [(String, String)] rather than Maybe [(String, String)]
like is used by e.g., runInteractiveProcess. The interpretation in the existing
code is that this is a supplemental list of environment variables rather than a
complete environment. There is no way to remove existing variable with this
representation other than assigning them empty values.
This is a different interpretation to that used by rawSystemExitWithEnv, which
uses it as the entire environment. I had the runInvokation functions merge the
supplied environment on top of the system environment rather than modify the
behaviour of the rawSystemExitWithEnv function. The rawSystemExit functions
were given variants accepting working directories rather than adding a Maybe
FilePath argument and changing the type signature.
I hope that this can go in for 1.12. In particular, I'd like to suggest a bump
to 1.11.3 so that I can depend on the version to ensure the behaviour
introduced in this patch is available.
Fri Aug 5 12:19:48 EDT 2011 matt at mattcox.ca
* Finish implementing Distribution.Simple.Program.Run
The environment and working directory settings in the ProgramInvocation record
were not totally handled by the run invocation functions in the module. The
selection of a working directory was implemented for all functions, and input
set in the invocation is handled by getProgramInvocation output.
The environment in the record is taken to be a list of supplemental environment
settings to add or override the system environment variables, rather than as a
complete environment. This is the behaviour implemented by the functions in
New functions taking an environment and working directory were added to the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 20996 bytes
Desc: A darcs patch for your repository!
More information about the cabal-devel