[rfc] win32 UNC path: problem with transport.clone('..')

Alexander Belchenko bialix at ukr.net
Fri Jan 26 18:40:07 GMT 2007


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

I try to push to another machine via UNC path and got traceback:
===================================================================
bzr arguments: [u'push', u'\\\\HOST\\C\\work\\python\\bzr.dev']
encoding stdout as sys.stdout encoding 'cp866'
got branch format Bazaar-NG Metadir branch format 5
creating directory file://HOST/C/work/python/bzr.dev/ => bzr.dev
created control directory in file://HOST/C/work/python/bzr.dev/
Traceback (most recent call last):
  File "bzrlib\commands.pyc", line 650, in run_bzr_catch_errors
  File "bzrlib\commands.pyc", line 612, in run_bzr
  File "bzrlib\commands.pyc", line 304, in run_argv_aliases
  File "bzrlib\builtins.pyc", line 651, in run
  File "bzrlib\bzrdir.pyc", line 147, in clone
  File "bzrlib\bzrdir.pyc", line 385, in find_repository
  File "bzrlib\bzrdir.pyc", line 555, in open_containing_from_transport
  File "bzrlib\transport\local.pyc", line 78, in clone
  File "bzrlib\transport\local.pyc", line 65, in __init__
  File "bzrlib\urlutils.pyc", line 189, in _win32_local_path_from_url
IndexError: string index out of range

return code 3
===================================================================

I track down the problem. When push try to find repository on remote
machine it uses transport.clone('..') until root directory reached.
And cloning of local transport narrow down to this code:

return LocalTransport(osutils.normpath('//HOST/..'))

The problem here:
osutils.normpath('//HOST/..') produce '//'.
but
osutils.normpath('C:/..') produce 'C:/'.

My question is: how to the right way to fix this problem?

Does 'file://' is valid URL? If yes then I need to fix _win32_local_path_from_url()
function to accept 'file://' instead of raising error.
Otherwise I need to fix osutils.normpath() to always keep host name in UNC path.

Suggestions?

- --
Alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFuksHzYr338mxwCURAm2MAJ9ViBbyCVCzGlXntm3A5JrhyPXvdACfTuY3
/J0hmpazrtNeDmD5F0tcRZc=
=5jGW
-----END PGP SIGNATURE-----




More information about the bazaar mailing list