[PATCH] Prefer lstat over stat, don't chmod symlinks

Martin Pool mbp at sourcefrog.net
Tue Jun 12 00:40:24 BST 2007


On 6/12/07, Elliot Murphy <elliot at canonical.com> wrote:
> Hi!
>
> I ran into a problem today with 'bzr diff --using meld' on a branch
> containing dangling symlinks (I'm using the difftools plugin). Down in
> bzrlib.osutils.make_readonly, os.stat() was complaining about 'No such
> file or directory' when hitting a dangling symlink.
>
> This patch tries to use lstat instead of stat, reverting to stat on
> platforms that don't have lstat (windows). It also checks to see whether
> a file is a symlink and does not os.chmod() symlinks.

Thanks Elliot.

To make sure that this works, we should add a test in test_osutils
that make_readonly works correctly when the target is a symlink.  (In
fact it looks like at the moment there are no direct tests for those
functions at all?)

-- 
Martin



More information about the bazaar mailing list