[issue15880] os.path.split() and long UNC names

2012-09-07 Thread Kalle Rutanen

New submission from Kalle Rutanen:

On Windows, long-UNC paths are needed to inspect and modify paths with more 
than 260 characters. The os.path.split() function behaves incorrectly in the 
presence of a long-UNC prefix //?/ or \\?\. Consider iterating d = 
os.path.split(d)[0] with d = '//?/e:/python-test/dir'. Then the values of d are 
as follows:

'//?/e:/python-test/dir'
'//?/e:/python-test'
'//?/e:'
'//?'
'//'

The two last splits are the incorrect ones, where the splitting should end at 
'//?/e:'.

One consequence of this is that os.makedirs(d) crashes, because it attempts to 
run os.mkdir('//') at the bottom of its recursion. The same thing happens when 
replacing all / with \\ in the above.

--
components: Library (Lib)
messages: 169990
nosy: kaba2
priority: normal
severity: normal
status: open
title: os.path.split() and long UNC names
type: crash
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue15880>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15880] os.path.split() and long UNC names

2012-09-07 Thread Kalle Rutanen

Kalle Rutanen added the comment:

By inspecting the code for os.path.split() in ntpath.py, one sees that the 
problem is actually in os.path.splitdrive(), which does not handle long-UNC 
paths.

--

___
Python tracker 
<http://bugs.python.org/issue15880>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15880] os.path.split() and long UNC names

2012-09-07 Thread Kalle Rutanen

Kalle Rutanen added the comment:

It seems to me that this problem can be fixed by replacing splitdrive with 
splitunc at line 170 in ntpath.py.

--

___
Python tracker 
<http://bugs.python.org/issue15880>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com