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

Alexander Belchenko bialix at ukr.net
Fri Jan 26 19:56:59 GMT 2007


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

Alexander Belchenko пишет:
> 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.

Quick summary of conversation with John Meinel on IRC:

	<j-a-meinel>	My initial feeling is that "file://" is not valid, and "file:///" isn't really valid
on Windows.
	<j-a-meinel>	Since you can't do "ls file:///"
	<j-a-meinel>	It would be nice if you could get a listing of all mounted drives, etc
	<j-a-meinel>	But as long as that doesn't work "file:///" is kind of a void on Win32

	<j-a-meinel>	I'm just mentioning that "file:///" on win32 doesn't really have a way to mean
anything, so I would prefer that it was just invalid. So the minimal path is "file://HOST/drive/"
and "file:///C:/" (file:///DRIVELETTER:/)
	<bialix>	yes, I agree completely
	<bialix>	so I need to fix clone and normpath?
	<j-a-meinel>	Sounds about right

	<bialix>	does file://host/path is used on linux?
	<j-a-meinel>	Not at the moment
	<j-a-meinel>	There isn't a real protocol for that
	<j-a-meinel>	Everything on Linux is typically mounted somewhere
	<j-a-meinel>	I suppose with VFS support there are things like "smb://host/drive/etc"
	<j-a-meinel>	But those aren't things we support
	<bialix>	yeah, even shared windows drives mounted via samba
	<j-a-meinel>	(yet???)
	<j-a-meinel>	Right, but on Windows, it assumes "//host/foo" (or \\host\foo) is a SMB share.
	<j-a-meinel>	Linux doesn't have that option
	<j-a-meinel>	Since it supports SMB, NFS, SSHFS, etc, etc
	<j-a-meinel>	So Linux requires that you tell it what protocol you want it to talk.


So I start to think that LocalTransport.clone should care about UNC and manually prevent
to go up when file://host/path is reached, because even file://host does not have sense
on windows. But simple fix of course could always keep //host part of local path,
because it does not produce fatal error when find_repository walk up in directory tree.

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

iD8DBQFFul0LzYr338mxwCURAo1PAJsHTNozvDj4hzB7uznKPyMyTQxOdgCdFFqU
UUvGJF6vY5Npv08X9GRY0VY=
=yYWL
-----END PGP SIGNATURE-----




More information about the bazaar mailing list