can paramiko sftp stat return 'nlinks'?

John Arbash Meinel john at arbash-meinel.com
Tue Aug 8 00:51:19 BST 2006


I was thinking about working on 'break hardlinks on write'. Which would
let us support hard-linked knit repositories. Basically, before we
append to a knit we stat it to see if it has more than 1 hardlink, and
if it does, we copy the data, and then do an append. This could get
expensive over sftp, since it doesn't have a remote copy command. And I
don't think 'ftp' would support it (all we get from ftp.stat() is the
file size).

So I'm just wondering if it is possible for stat over sftp to return the
number of links or not.

I'm also curious how hg avoids the race condition, where someone else is
branching from you, and at the time you do the stat, they haven't
hardlinked you, but they do a second later.

Also, they probably are using fstat() since that is cheaper and you
probably have the file open as you are going to write to it.

The more I think about it, the less I see that it can be done safely.
Especially to try and support remote trees that have been hardlinked.

But I thought I would ask to see if it is possible.

(Repositories basically solve this for us in the general sense. But I
was thinking about using it with the benchmark stuff, and it made me
wonder if it was possible in general.)

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060807/02f2c0f5/attachment.pgp 


More information about the bazaar mailing list