[issue4071] ntpath.abspath fails for long str paths

2008-10-09 Thread Jason Day

Changes by Jason Day [EMAIL PROTECTED]:


--
title: ntpath.abspath can fail on Win Server 2008 (64-bit) - ntpath.abspath 
fails for long str paths

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4071] ntpath.abspath can fail on Win Server 2008 (64-bit)

2008-10-08 Thread Jason Day

Jason Day [EMAIL PROTECTED] added the comment:

 I am not sure to understand. Do you mean the whole PATH environment
 variable? I doubt that it is passed to _getfullpathname.
 Or do you have very long paths for one directory? the TEMP environment
 variable, for example? I'd be curious to see its value.

I don't have it offhand, but it was the whole PATH environment variable, 
complete with semicolons. That's probably the *real* bug. Whatever was passing 
that into abspath didn't seem to mind getting back an empty string (although 
that may have been further processed in the function, I didn't follow past the 
call to _getfullpathname).

 And one decision problem... What should we do when too long str is
 passed to ntpath._getfullpathname? Report overflow error? Or convert to
 unicode and retry with GetFullPathNameW? Hmm

abspath should be able to be called with str or unicode of arbitrary lengths. 
Consumers of it shouldn't have to be concerned with the platform implementation 
when it can be smoothed over by the module. Whether this is done in abspath or 
_getfullpathname probably isn't too important, since end-users generally 
shouldn't be calling _getfullpathname, directly.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4071] ntpath.abspath fails for long str paths

2008-10-08 Thread Jason Day

Changes by Jason Day [EMAIL PROTECTED]:


--
title: ntpath.abspath can fail on Win Server 2008 (64-bit) - ntpath.abspath 
fails for long str paths

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4071] ntpath.abspath can fail on Win Server 2008 (64-bit)

2008-10-08 Thread Jason Day

Jason Day [EMAIL PROTECTED] added the comment:

 Indeed. Do you happen to have the complete traceback of the failing
 tempfile.mktemp() call? I don't see where it can use the PATH
 environment variable.

The problem was that somehow, on our systems, the TEMP environmental variable 
had been copied over with PATH. Most likely some batch file tried to store a 
copy of PATH, without realizing the significance of TEMP. [groan]

Anyway, I still think that it's a bug that abspath() can't be called with a 
perfectly good str path, because of limitations with the windows api. I edited 
the bug title to reflect the actual bug.

The str path length could be checked and upgraded to the Unicode version, if 
necessary (or try again with the unicode version, in the case of an exception). 
I think it's important to ensure that when abspath() is called with str, it 
returns str, even if it was upgraded to the unicode call.

--
title: ntpath.abspath fails for long str paths - ntpath.abspath can fail on 
Win Server 2008 (64-bit)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4071] ntpath.abspath can fail on Win Server 2008 (64-bit)

2008-10-07 Thread Jason Day

New submission from Jason Day [EMAIL PROTECTED]:

On my system (Windows Server 2008 SP1 - 64-bit, Python 2.5.2 - 32-bit),
simple actions like:
 help(help) # Or any function
or
 import tempfile
 f = tempfile.mktemp()
result in this (rather confusing) error:
TypeError: _getfullpathname() argument 1 must be (buffer overflow), not str

Apparently, _getfullpathname() chokes on certain paths if they are not
supplied as unicode. Locally, I was able to work around the issue by
changing the call to _getfullpathname in ntpath.abspath to:
path = str(_getfullpathname(unicode(path)))

--
components: Windows
messages: 74502
nosy: JDay
severity: normal
status: open
title: ntpath.abspath can fail on Win Server 2008 (64-bit)
type: crash
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4071] ntpath.abspath can fail on Win Server 2008 (64-bit)

2008-10-07 Thread Jason Day

Jason Day [EMAIL PROTECTED] added the comment:

Running help() or mktemp() causes _getfullpathname to be called with the whole 
system path (791 characters). If you pass that to _getfullpathname as str it 
throws the aforementioned TypeError. If it's passed as unicode, it returns an 
empty string.
The offending _getfullpathname call occurs on the first call to one of these 
methods. Future calls to either do not call it (unless, of course, the first 
failed).

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue4071
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com