Mailing List Archive

[issue4071] ntpath.abspath fails for long str paths
Changes by Jason Day <jason.day@bluetechllc.com>:


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

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4071] ntpath.abspath fails for long str paths [ In reply to ]
Changes by Jason Day <jason.day@bluetechllc.com>:


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

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4071] ntpath.abspath fails for long str paths [ In reply to ]
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> added the comment:

I think attached patch "fix_getfullpathname.patch" will fix unicode
issue at least. For ansi issue, I followed the manner of win32_chdir for
now.

After some investigation, GetFullPathNameA fails if output size is more
than MAX_PATH even if input size is less than MAX_PATH. I feel it's
difficult check this before invoking GetFullPathNameA.

This is test for unicode issue.

/////////////////////////////////////////////////////////

import unittest
import ntpath
import os

class TestCase(unittest.TestCase):
def test_getfullpathname(self):
for count in xrange(1, 1000):
name = u"x" * count
path = ntpath._getfullpathname(name)
self.assertEqual(os.path.basename(path), name)

if __name__ == '__main__':
unittest.main()

----------
keywords: +patch
versions: +Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11755/fix_getfullpathname.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4071] ntpath.abspath fails for long str paths [ In reply to ]
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> added the comment:

>I feel it's difficult to check this before invoking GetFullPathNameA.

And error number via GetLastError() is vogus, sometimes 0, sometimes others.

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4071] ntpath.abspath fails for long str paths [ In reply to ]
Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> added the comment:

Or, if PyArg_ParseTuple overflowed or GetFullPathNameA failed, (not
check GetLastError() because it's vogus) try GetFullPathNameW like
attached file "quick_hack_for_getfullpathname.patch".

This inverses flow

if (unicode_file_names()) {
/* unicode */
}
/* ascii */

# Maybe it would be nice if convert_to_unicode() functionality is built
in PyArg_ParseTuple. (inverse of "et")

Be care, this is quick hack, so maybe buggy. I confirmed test_os and
test_ntpath passed though.

/////////////////////////////////////////////////////

import unittest
import ntpath
import os

class TestCase(unittest.TestCase):
def test_getfullpathname(self):
for c in ('x', u'x'):
for count in xrange(1, 1000):
name = c * count
path = ntpath._getfullpathname(name)
self.assertEqual(os.path.basename(path), name)

if __name__ == '__main__':
unittest.main()

Added file: http://bugs.python.org/file11757/quick_hack_for_getfullpathname.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4071] ntpath.abspath fails for long str paths [ In reply to ]
Changes by Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>:


Added file: http://bugs.python.org/file11758/quick_hack_for_getfullpathname_v2.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue4071] ntpath.abspath fails for long str paths [ In reply to ]
Changes by Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>:


Removed file: http://bugs.python.org/file11757/quick_hack_for_getfullpathname.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue4071>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com