should these be fixed for python 2.4?

Alexander Schmolck a.schmolck at gmx.net
Sat Oct 2 05:56:07 EDT 2004


Jeff Shannon <jeff at ccvcorp.com> writes:

> Personally, I suspect that the number of people who're running external
> commands that are complex enough for these escaping issues to matter is rather
> small.

The chances that if you call some external command you will want to pass it
some filename (or something else that might contain more than [a-zA-Z0-9_-.])
that you didn't necessarily (or carefully enough) create yourself seem really
quite high to me (a quick grep through my own stuff showed a ratio of about
20:1 needs-escaping:doesnt-need-escaping) [where needs-escaping of course more
means "should really use os.spawnv" or whatever, but that doesn't resolve the
issue for popen calls]

> The vast majority of uses of os.system() (IMHO) are very simple cases
> with one or two simple arguments.  Relatively few of them involve filenames
> that contain spaces, or other things that might cause problems with the naive
> os.system('cmd %s %s' % (arg1, arg2)) sort of approach.

Do you mean they don't involve filenames (etc.) with space by necessity or by
chance (they are rare under unix)? By chance -- well certainly and there is
unix stuff out there already that breaks for 'funny' filenames, but I'd rather
python did not further contribute to that (especially since once python code
developed under unix then gets used under windows actual trouble strarts).
 
'as




More information about the Python-list mailing list