[issue27730] Update shutil to work with max file path length on Windows

2016-08-12 Thread Eryk Sun
Eryk Sun added the comment: I overlooked some aspects of the problem: * A short relative path may end up exceeding MAX_PATH when normalized as a fully qualified path. * The working directory may be a UNC path or may already have the \\?\ prefix. It's not thread-safe to check this beforehand. *

[issue27730] Update shutil to work with max file path length on Windows

2016-08-11 Thread Steve Dower
Steve Dower added the comment: I thought I'd tested GetFullPathNameW and seen the limit kick in at 260, but if that's not actually the case (across all platforms we support) then yes, let's use that. When I reread the documentation yesterday it didn't guarantee the result would include the pr

[issue27730] Update shutil to work with max file path length on Windows

2016-08-10 Thread Eryk Sun
Eryk Sun added the comment: Standard users have SeChangeNotifyPrivilege, which allows traversing a directory that they can't access, so Python should only work with paths as strings instead of trying to open a directory handle. I think it's best to make Windows do as much of the normalization

[issue27730] Update shutil to work with max file path length on Windows

2016-08-10 Thread Steve Dower
Steve Dower added the comment: Issue #27731 will resolve this for the latest versions of Windows 10, but if we want to support this for earlier versions of Windows here's the algorithm I'd suggest: * if len(path) < 260 - we're good, don't do anything * get the last '\' or '/' character before

[issue27730] Update shutil to work with max file path length on Windows

2016-08-10 Thread Brett Cannon
New submission from Brett Cannon: It would be nice to have a place in the stdlib that can work with long file names on Windows no matter what. shutils seems like a possibly reasonable place. -- components: Windows messages: 272384 nosy: brett.cannon, paul.moore, steve.dower, tim.golden,