[tahoe-lafs-trac-stream] [Tahoe-LAFS] #2235: Error from 'tahoe cp' on Windows, due to a long path (IOError: Errno2 - no such file or dir.)
Tahoe-LAFS
trac at tahoe-lafs.org
Tue May 20 16:41:18 UTC 2014
#2235: Error from 'tahoe cp' on Windows, due to a long path (IOError: Errno2 - no
such file or dir.)
--------------------------------+------------------------------------------
Reporter: CyberAxe | Owner: Zancas
Type: defect | Status: new
Priority: normal | Milestone: undecided
Component: code-frontend- | Version: 1.10.0
cli | Keywords: tahoe-cp error windows win32
Resolution: |
Launchpad Bug: |
--------------------------------+------------------------------------------
Comment (by daira):
Because prepending `\\?\` is not correct for a UNC path (
[http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#maxpath]
):
> The "\\?\" prefix can also be used with paths constructed according to
the universal naming convention (UNC). To specify such a path using UNC,
use the "\\?\UNC\" prefix. For example, "\\?\UNC\server\share", where
"server" is the name of the computer and "share" is the name of the shared
folder. These prefixes are not used as part of the path itself. They
indicate that the path should be passed to the system with minimal
modification, which means that you cannot use forward slashes to represent
path separators, or a period to represent the current directory, or double
dots to represent the parent directory. Because you cannot use the "\\?\"
prefix with a relative path, relative paths are always limited to a total
of MAX_PATH characters.
It is also not correct for a path that already starts with `\\?\` (or,
more obscurely, `\\.\`).
I could have written code like this to cover all cases:
{{{
if sys.platform == "win32":
if path.startswith(u"\\\\?\\") or path.startswith(u"\\\\.\\"):
pass
elif path.startswith(u"\\\\"):
path = u"\\\\?\\UNC\\" + path[2: ]
else:
path = u"\\\\?\\" + path
}}}
but I don't actually care about long UNC paths; I just wanted to avoid
doing something obviously incorrect for them.
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2235#comment:17>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list