mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-10-28 15:15:08 +03:00
"install -C" (--compare) has always called chown/chmod on the destination even after determining that copying was unnecessary, ever since --compare was added in commit v7.0-182-gdac5f12c6. need_copy() already verifies that the destination's mode, owner, and group match (and, with --preserve-context, that the SELinux context matches too) before skipping the copy, so re-applying them is redundant, and can needlessly fail on a destination that cannot be chown/chmod'd even though nothing would actually change, e.g. one marked immutable with chattr +i. * src/install.c (install_file_in_file): Skip metadata updates if we already skipped the data, as previous checks ensure that the metadata is already as required. * tests/install/install-C-immutable.sh: Add a test. (based on tests/rm/empty-immutable-skip.sh). * tests/local.mk: Reference the new test. * NEWS: Mention the improvement.