[issue6479] platform.py writes to hard coded platform dependant "dev/null"
Marc-Andre Lemburg
report at bugs.python.org
Tue Jul 14 00:52:40 CEST 2009
Marc-Andre Lemburg <mal at egenix.com> added the comment:
John Burnett wrote:
> John Burnett <python at johnburnett.com> added the comment:
>
> I'm not sure how you're seeing that those functions bypass external
> commands?
Both functions use this bypass mechanism:
if sys.platform in ('dos','win32','win16','os2'):
return default
> I'm running Vista64, and it certainly looks like calling
> platform.architecture calls _syscmd_file, which then immediately calls
> os.popen("file %s 2> /dev/null"). This causes windows to try and open a
> file called "file", which fails, and pipes the resulting error ("'file'
> is not recognized as an internal or external command, operable program
> or batch file.") to a file named "null" in my "c:\dev" directory.
Could you please tell me what sys.platform is set to on Vista 64 ?
If it's "win64", then I'll have to add that to the above test.
AFAIK, we chose to leave it set to "win32" even on 64-bit Windows
versions, so the above test should trigger on Vista 64 as well.
> This will happen on any system that doesn't /dev/null. _syscmd_uname
> does the same thing, but "protects" against it by testing for platform
> type. I'm not familiar enough with the supported platforms to know if
> it's covering all the bases, but a safer thing to do would be to just
> use os.devnull anyway.
I've added a similar patch in r74002, but those functions should
not really do anything on Windows at all.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6479>
_______________________________________
More information about the Python-bugs-list
mailing list