Using install -C to installworld (e.g. with "INSTALL+=-C" in src.conf(5)) avoids copying files that have not changed. Which is useful to save some space if you have filesystem snapshots.
But I noticed that it still copies some files that have not changed if they have hardlinks. That's because it doesn't want to cause unintended side-effects if it has to change the file's attributes. So it "snaps" the hardlinks by instaling a new copy of the file, thus leaving the existing file (and its remaining links) unaffected. But it is doing this in all cases, even if the attributes do not have to be changed.
This diff makes it check that beforehand. It only snaps the hardlink if it's going to try to change the file's attributes later on.
Also, this hardlink snapping logic was only being applied when stripping is to be done (-s flag).
echo test > f
install -C f t
ln t l
install -C -m 0 f t
- "l" now has mode 0
I believe that this is unintended. This diff makes it snap the hardlink in this case too.
Also, the logic dealing with installing "/dev/null" as a source file seems a bit off WRT file flags.
install -f uappnd /dev/null t
- "t" does not have uappnd flag
So this diff fixes this too.