[cfe-dev] interesting ccc issue

Sam Bishop sam at bishop.dhs.org
Wed Feb 6 08:11:16 PST 2008


On Tue, February 5, 2008 5:20 pm, Anders Carlsson wrote:
>   def run(args):
> -    cmd = ' '.join(args)
> +    cmd = ' '.join(args).replace("\"", "\\\"");
>       print >> sys.stderr, cmd
>       code = os.system(cmd)

Double quotes, unfortunately, are just the tip of the iceberg.  Consider
-DCMD_STRING='"echo $(ls)"' or -DNOP='do { } while (0)', for example.

This is my fault.  When I proposed the subprocess.call() -> os.system()
conversion, I didn't consider the -D option and that its arguments can be
nearly anything.

I think that we will be happiest long term if we go back to using the
subprocess module and requiring a 2.4+ version of Python.  We'll probably
end up wanting other 2.4+ features anyway.

The attached patch reverts the subprocess.call() -> os.system() conversion. 
A close review, of course, is welcome.  :)

Sincerely,
Sam Bishop
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ccc-use-subprocess-module.patch
Type: application/octet-stream
Size: 1037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080206/48fed5fc/attachment.obj>


More information about the cfe-dev mailing list