Page MenuHomeFreeBSD

Enhance install(1) -C's handling of hardlinked files
Needs ReviewPublic

Authored by sigsys_gmail.com on Sep 10 2018, 4:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 2:01 PM
Unknown Object (File)
Thu, Apr 18, 11:12 AM
Unknown Object (File)
Feb 6 2024, 4:53 AM
Unknown Object (File)
Feb 1 2024, 12:40 AM
Unknown Object (File)
Dec 20 2023, 1:42 AM
Unknown Object (File)
Dec 10 2023, 5:59 PM
Unknown Object (File)
Nov 15 2023, 1:36 AM
Unknown Object (File)
Nov 12 2023, 7:09 AM
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

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

  1. "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

  1. "t" does not have uappnd flag

So this diff fixes this too.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped