[PATCH] Fix win32 command processor quoting in system() calls

Patrick Mézard pmezard at gmail.com
Fri Dec 15 15:03:17 CST 2006


Benoit Boissinot wrote:
> On 12/15/06, Patrick Mezard <pmezard at gmail.com> wrote:
>> +    # String within quotes must be the name of an executable file
>> +    if not os.path.isfile(quoted):
>> +        return False
>> +    pathext = os.environ.get('PATHEXT', '').lower().split(';')
> 
> what is this part about ? (maybe you want to use find_in_path ?)

The last condition in cmd.exe manpage states:
"""
- the string between the two quote characters is the name of an 
executable file.
"""

I am not sure what they mean by that. I do not think there is anything 
like an executable bit in NTFS or even FAT, but %PATHEXT% filters 
"command" files:

<http://www.microsoft.com/technet/archive/winntas/deploy/shellscr.mspx?mfr=true>
"""
The PATHEXT environment variable defines the list of file extensions 
checked by Windows NT when searching for an executable file. Like the 
PATH variable, semi-colons separate individual items in the PATHEXT 
variable. The default value of PATHEXT is .COM;.EXE;.BAT;.CMD.
"""

Conditions I am trying to detect could be found there:
<http://groups.google.fr/group/openwatcom.users.c_cpp/browse_frm/thread/ce7ea06cb973f4b8/8470cff0b262b2f6?lnk=st&q=win32+system+quote&rnum=48&hl=fr#8470cff0b262b2f6>

--
Patrick Mézard


More information about the Mercurial-devel mailing list