[PATCH 2 of 2 STABLE] store: add auto detection for hardlink count blindness (issue1866)

Matt Mackall mpm at selenic.com
Sun Oct 31 13:40:18 CDT 2010


On Sun, 2010-10-31 at 08:32 +0100, Adrian Buehlmann wrote:
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
> # Date 1288506284 -3600
> # Branch stable
> # Node ID 6ab76f943954901b6473eb95c00ba673da2f2dd6
> # Parent  cd9700552b22bf12b375fc48a582fd96da721145
> store: add auto detection for hardlink count blindness (issue1866)
> 
> The Linux CIFS kernel driver (even in 2.6.36) suffers from a hardlink
> count blindness bug (lstat() returning 1 in st_nlink when it is expected
> to return >1), which causes repository corruption if Mercurial running
> on Linux pushes or commits to a hardlinked repository stored on a windows
> share, if that share is mounted using the CIFS driver.

Not sure if we're going to get this into 1.7. I had about an hour to
play with it on Friday night and ran into the following issues:

- op.linktest is weird - when do we ever not want to break hardlinks
correctly?

- filename security is iffy

- the filesystem testing functions in util are named check*

- Test function is too heavy-weight - do the simplest fastest test
possible. Probably something like:

 f, fn = getasecurefilehandleandname(path)
 fn2 = fn + "l"
 link(fn, fn2)
 stat

Even this is pretty expensive.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list