Cannot branch on Windows due to file path length - can I do anything?

John Arbash Meinel john at arbash-meinel.com
Mon Mar 10 18:14:04 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

QbProg wrote:
| If i remind it good:
| In windows, file paths longer that MAX_PATH require a special trailing
| sequence to allow paths and filenames of 65536 characters.
| See MSDN for more informations...
|
| Good bye
| QbProg
| Hi,
|
| When trying to branch my project on Windows I get this error message:
|
| bzr: ERROR: [Error 206] Der Dateiname oder die Erweiterung ist zu
| lang:
|
u'D:/radical/problems-refactoring/.bzr/checkout/limbo/new-6/data/edits/ModuleImplementationTests/InterfaceConformanceTests/FixMissingClassInheritanceErrorByInheritingMoreSpecialized2/files_to_copy/modules/module_implementation/classes/private_sub_class'

|
|
| It is German but it says "The filename or the extension is too long:...."
|
| I assume this is due to limitations on Windows for file path lengths.
| Is there anything I can do about this other than renaming things to
| less descriptive names (I would rather not do this of course). I do
| not have this problem on Linux or Mac OS/X
|
| Windows sucks ;-(
|
| Cheers,
|
| Nick
|>
|>
|>

Actually, it is a special prefix. IIRC \\?\full\path\on\filesystem causes
Windows to bypass its normal parser and address longer files. However, Explorer
will fail to browse to those paths, etc.

I don't know how Nicholas managed to create such a long path by committing. I
suppose we are adding a few extra paths (.bzr/checkout/limbo/new-6).

One thing you could try, Nicholas, is to just use a shorter path. I used to do
my development in "C:\dev\" for other systems that were more abusive that Bazaar.

It would be possible to fix up Bazaar to use the \\?\ notation, but it would
probably be a bit invasive. We haven't tried to do it yet, because Explorer
itself doesn't support the longer paths. (So while *we* could support it, it
doesn't help that nothing else will, though it seems that on Vista Explorer does
finally support >256 char paths.)

As I understand it, there are some risks of using \\?\, something about
bypassing the standard sanity checking apis. I'm not sure if that means creating
'COM1', etc files which would do very weird things to all other problems that
don't realize it.


Also, I was playing around with it just now, and it seems python itself probably
doesn't support everything about the longer paths. Specifically, I can do:

os.mkdir(u'\\\\?\\' + really_long_path + '\\JustABitMore')

And os.listdir() also seems to work.

If you want to play around with this, it is possible that a couple small tweaks
would get it to work. We could probably update
bzrlib.workingtree.WorkingTree.abspath to return u'\\\\?\\' + path

and then you would also need to update something like
urlutils.local_path_from_url and probably local_path_to_url.
(Specifically, the _win32* variants.)

My quick hack caused problems because we started translating the "\\?\" to "//?/".

So it might be possible (we generally work in absolute paths anyway) but it
would take someone with some time to really track down all of those places and
make sure everything still works.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH1XpsJdeBCYSNAAMRAo+7AJ9TNbDbQXtDsBqeZEC6SDza4QqqpwCfbVGg
Qa2GWcp62en5YsrvNFaa4VE=
=uGcS
-----END PGP SIGNATURE-----



More information about the bazaar mailing list