On Tue, 22 Nov 2005, Chris Adams wrote:In order to prevent the problems mentioned AND satisfy SuS, I would think that the st_dev field would be the value which should be unique, which is not always the case currently. The st_inod is a file id on st_dev, and it would be less confusing if the inode on each st_dev were unique. Not to mention that some backup programs do look at that st_dev and could be mightily confused if the meaning is not determinant.
Once upon a time, Jan Harkes <jaharkes@xxxxxxxxxx> said:
The only thing that tends to break are userspace archiving tools like
tar, which assume that 2 objects with the same 32-bit st_ino value are
That assumption is probably made because that's what POSIX and Single
Unix Specification define: "The st_ino and st_dev fields taken together
uniquely identify the file within the system." Don't blame code that
follows standards for breaking.
The standards are insufficient however. For example dealing with named streams or extended attributes if exposed as "normal files" would naturally have the same st_ino (given they are the same inode as the normal file data) and st_dev fields.
I think that by now several actually double check that theinode
linkcount is larger than 1.
That is not a good check. I could have two separate files that have
multiple links; if st_ino is the same, how can tar make sense of it?
Now that is true. In addition to checking the link count is larger then 1, they should check the file size and if that matches compute the SHA-1 digest of the data (or the MD5 sum or whatever) and probably should also check the various stat fields for equality before bothering with the checksum of the file contents.
Or Linux just needs a backup api that programs like this can use to save/restore files. (Analogous to the MS Backup API but hopefully less horid...)