[RFC] symlinks support on win32: what features really needed or bzr?
Alexander Belchenko
bialix at ukr.net
Tue Oct 30 21:08:51 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel пишет:
> 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.
osutils.file_kind uses os.lstat. But grepping through overall bzrlib I found
some usage of os.stat. I don't dig very deep, so I'm not sure is it safe to
replace them with os.lstat.
But basically (IIUC) I need lstat/symlink/readlink only. Good.
>
>> 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)
Thanks.
>
> John
> =:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHJ51jzYr338mxwCURAksDAJwKwG7/jV2DGcUr/1rqnaioV54bqACfe8o1
7BotcYZnrpOAfFwvwXlyyfM=
=Gm/F
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list