[RFC] symlinks support on win32: what features really needed or bzr?

John Arbash Meinel john at arbash-meinel.com
Tue Oct 30 20:41:37 GMT 2007


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

Alexander Belchenko wrote:
> Currently I narrow down problem with symlinks emulation on win32
> to 3 important functions:
> os.symlink, os.readlink and os.lstat.
> 
> Does bzr really use follow-symlink approach or only readlink?
> There is some tests in test_osutils those expect os.path.realpath
> to follow symlinks. Are there any other features I need to emulate
> for bzr? Probably os.stat should follow symlink too?

I'm guessing we don't need to support os.path.realpath() for windows. Unless
you want to be able to refer to branches using a symlink. That, to my
knowledge, is all we use realpath for. (Which is only really relevant when
/path/to/branch is has a symlink in it.)

For supporting links inside the working tree, we probably only check whether it
*is* a symlink (osutils.file_kind_from_stat_mode), and then os.readlink to see
where it points (which we commit.) and then "os.symlink" to create or change a
symlink on disk.

> 
> Another question: how follow-symlink approach works in Linux
> if symlink point to another symlink? Or Linux effectively prevents this?
> 
> Alexander

Most code that follows symlinks has a loop of (pseudocode):

while is_link(path):
 path = readlink(path)

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

iD8DBQFHJ5cBJdeBCYSNAAMRArxjAKDYVxCDONg8/zdnKWkmuwDDo+89bQCaA2Ta
8XWBbE+M9DUyYdQWoHy8S4s=
=BCcF
-----END PGP SIGNATURE-----



More information about the bazaar mailing list