os.execv
Jp Calderone
exarkun at intarweb.us
Tue Mar 4 22:19:25 EST 2003
More information about the Python-list mailing list
Tue Mar 4 22:19:25 EST 2003
- Previous message (by thread): os.execv
- Next message (by thread): os.execv
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Mar 05, 2003 at 04:06:09AM +0100, Ulrich Petri wrote: > > "Skip Montanaro" <skip at pobox.com> schrieb im Newsbeitrag > news:mailman.1046828168.14751.python-list at python.org... > > >>> import os > > >>> os.execv("/usr/bin/find", ("find", "/ -name test")) > > find: / -name test: No such file or directory > > > > Maybe > > > > os.execv("/usr/bin/find", "find", "/", "-name", "test") > > > > is what you're after. > > > > Skip > > Thanks that did it. > Kinda stupid behaviour (imho) > Nah... If it worked with ("find", "/ -name test"), the "find" program would see "/ -name test" as argv[1], and surely hate you. Of course, execv could split the arguments on whitespace for you, but then you wouldn't be able to include whitespace in any of the arguments! Unless execv respected some sort of quoting, so as to let you group characters, even whitespace. But then, you couldn't include literal quotes in your strings! Unless execv also provided some kind of escaping mechanism. Of course, then you'd have to sanitize any user input, to prevent it from escaping your quoting and inserting malicious input... So execv could be made about 4 times more complex, and half as useful, or it could work how it does, and just require the user to pass in each argument separately. I know which way I prefer. Jp -- up 1 day, 19:58, 5 users, load average: 1.27, 1.22, 0.66
- Previous message (by thread): os.execv
- Next message (by thread): os.execv
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list