[BZR Tree!] Updated shelf
Aaron Bentley
aaron.bentley at utoronto.ca
Fri Jun 17 14:02:26 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel wrote:
> print >>sys.stderr, "Reapplying shelved patches"
> - pipe = os.popen('patch -d %s -s -p1' % root, 'w')
> + pipe = os.popen('patch -d "%s" -s -p1' % root, 'w')
This is better, but it's still not quite right, because root may contain
quote marks or characters that may be interpreted by the shell.
To prevent the shell from evaluating the input, use a sequence instead
of a string.
pipe = os.popen(('patch', '-d', root, '-s', '-p1'), 'w')
This doesn't work for os.system. The simplest thing I've found is to
prepend a backslash to every character, e.g.
os.system(" ".join(["".join(['\\'+g for g in f]) for f in args]))
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCssni0F+nu1YWqI0RAt4GAJ9V1FbGRlAVWBPncgyvMclIMG+ANwCfSFZG
QNdDACoGKPfddPykhlGBXAU=
=annS
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list