Commit Graph
334 Commits
Author SHA1 Message Date
Pádraig Brady 57d6cc458b cp,mv,install: fix infinite loop with --backup=t and unreadable dirs
* gnulib: Update to get the fix.
* tests/cp/backup-unreadable.sh: Add a new test case.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
2026-11-15 12:30:40 +00:00
Pádraig Brady a80621e6aa chmod: fix silent skipping when /proc is unavailable
You can get ENOTSUP due to the system not supporting chmod(symlink),
but you can also get ENOTSUP on any file type if the system needs
/proc to emulate AT_SYMLINK_NOFOLLOW and /proc is not available.

Before this fix we had the problematic "Silent skip" in these cases:

Build glibc    Runtime Linux    With /proc           Without /proc
=============  ============  ===================  ====================
≤ 2.31         Any           gnulib emulation     Racy fallback
2.32–2.38      Any           glibc emulation      Silent skip
≥ 2.39         < 6.6         glibc emulation      Silent skip
≥ 2.39         ≥ 6.6         Native fchmodat2     Native fchmodat2

After this change (and the preceding gnulib change), we have:

Build glibc    Runtime Linux    With /proc           Without /proc
=============  ============  ===================  ====================
≤ 2.38         Any           gnulib emulation     Racy fallback
≥ 2.39         < 6.6         glibc emulation      Diagnose ENOTSUP
≥ 2.39         ≥ 6.6         Native fchmodat2     Native fchmodat2

The above tables assume /proc is available at ./configure time.
Other cases like musl < 1.2.4 are not considered,
but there should at least be no silent ignoring of issues
once reported by the underlying libc.

* src/chmod.c (process_file): Check we're operating on a symlink
if we get ENOTSUP, and only ignore the error in that case.
* tests/chmod/symlink-enotsup.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-PSCKLNL1.
2026-11-14 20:26:42 +00:00
Collin FunkandPádraig Brady 94b24850da timeout: handle child processes that use PTRACE_TRACEME
* m4/jm-macros.m4 (coreutils_MACROS): Check for ptrace.
* src/timeout.c [HAVE_PTRACE && (__linux__ || __ANDROID__)]: Include
sys/ptrace.h.
(resume_command): New function.
(main): Call it if the monitored command has been stopped.
* tests/timeout/ptrace-traceme.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the improvement.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-AKDIHN0Y.

Co-authored-by: Pádraig Brady <P@draigBrady.com>
2026-11-13 20:12:25 -08:00
Collin Funk 3f8a5b5470 df: don't open non-directory operands
* src/df.c (automount_stat_err): Use O_DIRECTORY when opening operands.
Fall back to stat if open fails with ENOTDIR.
* tests/df/open.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-Z5SPLRCM.
2026-11-13 18:27:05 -08:00
Joao Matos 394427e691 tests: csplit: add a test for the fix in the previous commit
* tests/csplit/guard-input.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-11-12 22:42:06 -08:00
Pádraig Brady f66f9b1146 cut,expand,fold,unexpand: fix handling of multi-byte with short reads
This change is performance neutral as tested with:
 $ yes $(yes eeeaae | head -n10K | paste -s -d,) | head -n10K > ll.in
 $ hyperfine src/cut{,.orig}' -f10 -w ll.in >/dev/null'

* gl/lib/mbbuf.h (mbbuf_fill): Repeat the mbbuf_topup(), i.e. the read()
if the previous run didn't read enough.  Note we add the explicit
common case short-circuit to avoid a 20% regression
for the test case above, with GCC 16.2 with -O3 -flto.
* tests/cut/mb-short-read.sh: A new test file.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-JSCMJCN2.
2026-11-10 12:52:08 +00:00
Sylvestre Ledru 99ba5d505a tests: ls: check U+2028 and U+2029 are escaped or hidden
* tests/ls/line-separator.sh: New test.
* tests/local.mk (all_tests): Reference it.
https://github.com/uutils/coreutils/pull/16040

Link: https://github.com/coreutils/coreutils/pull/457
2026-11-09 00:24:52 +00:00
Sylvestre Ledru f5ded57fbd tests: tail: check output appended to the input stops at its end
* tests/tail/append-to-input.sh: New test.
* tests/local.mk (all_tests): Reference it.
https://github.com/uutils/coreutils/pull/15066

Link: https://github.com/coreutils/coreutils/pull/455
2026-11-09 00:19:10 +00:00
Collin Funk 5b86ff66eb cp,mv,install: exit with status 1 when creating a hole fails
* src/copy-file-data.c (sparse_copy): Return -1 when create_hole fails.
* tests/cp/fail-create-hole.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-C18OTMQ2.
2026-11-08 11:00:49 -08:00
Sylvestre Ledru 572be620f0 tests: chown, chgrp: check "cannot access" vs "cannot dereference"
* tests/chown/cannot-access.sh: New test.  Ensure chown and chgrp
report "cannot access" for a missing operand, a trailing slash on a
non-directory and a missing file in a directory, and "cannot
dereference" only for a dangling symlink.
* tests/local.mk (all_tests): Reference the new test.
https://github.com/uutils/coreutils/pull/15868

Link: https://github.com/coreutils/coreutils/pull/449
2026-11-08 14:39:31 +00:00
Sylvestre Ledru e0c24f5866 tests: chmod: ensure modes containing white space are rejected
* tests/chmod/mode-whitespace.sh: New test.  Check that chmod,
mkdir -m and install -m reject mode strings with leading or trailing
white space, or white space around a ',' separator.
* tests/local.mk (all_tests): Reference the new test.
https://github.com/uutils/coreutils/pull/16193

Link: https://github.com/coreutils/coreutils/pull/447
2026-11-08 14:06:17 +00:00
Collin Funk 8121423eda pr: fix an infinite loop with a page of leading tabs and small columns
* src/pr.c: Continue processing if the line is truncated instead of
returning early. Return after handling headers, line numbers, etc., but
before printing the truncated clump.
* tests/pr/inf-loop.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-TMZPQ2AH.
2026-11-07 11:48:00 -08:00
Sylvestre Ledru 5316d1ec95 tests: rm: ensure -i after -f reports a missing operand
Reported at https://github.com/uutils/coreutils/issues/15994

* tests/rm/f-then-i-no-operand.sh: New test.
* tests/local.mk: Reference the new test.

Link: https://github.com/coreutils/coreutils/pull/435
2026-11-07 12:35:10 +00:00
Sylvestre Ledru 68d3c16f99 tests: mkdir: ensure --context takes an optional argument
Reported at https://github.com/uutils/coreutils/issues/16002

* tests/mkdir/context-optional.sh: New test.
* tests/local.mk: Reference the new test.

Link: https://github.com/coreutils/coreutils/pull/424
2026-11-07 12:35:10 +00:00
Sylvestre Ledru d1f6125ecf tests: chmod: ensure --reference processes operands in order
Reported at https://github.com/uutils/coreutils/issues/15666

* tests/chmod/reference-order.sh: New test.
* tests/local.mk: Reference the new test.

Link: https://github.com/coreutils/coreutils/pull/410
2026-11-07 12:35:10 +00:00
Collin Funk 605a37ee1e shred: quote file names in --verbose output when renaming them
* src/shred.c (wipename): Quote the names of the source and destination
when printing verbose messages for rename. Remove comment about not
needing quoting after the first message, since we still do not control
the contents of any parent directories contained in the source or
destination.
* tests/shred/verbose-quote.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-3UJ1SMSY.
2026-11-06 17:06:42 -08:00
Pádraig Brady 3f01618856 tests: shred: check for chmod race
* tests/shred/chmod-race.sh: Add a new test, which is
the first in the test suite to use strace to STOP a process.
* tests/local.mk: Reference the new test.
2026-11-04 13:04:07 +00:00
Collin Funk 7b48dd18cd tests: shred: check the behavior when close fails
* tests/shred/failed-close.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
2026-11-03 20:19:47 -08:00
Collin Funk bfceb45637 shred: fix races with --force and --remove
* src/shred.c (wipefile): When --force or --remove are in use, and the
file is in a subdirectory, open a file descriptor to its parent and
perform operations on the basename relative to it.
(wipename): Add a file descriptor argument to the parent directory. Open
a readable file descriptor to the directory if we need to sync it. Use
the file descriptor with renameatu and unlinkat.
* tests/shred/unlink-race.sh: New file.
* tests/local.mk (all_tests): Add the new test case.
* NEWS: Mention the bug fixes.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-O4Q4UVP2.
2026-11-03 20:16:05 -08:00
Pádraig Brady e85bf8468f seq: ensure termination at floating point limits
* src/seq.c (dump_strings): Rearrange limit checks to
reduce rounding affects.  Also add sanity check on
on the iteration number limit.
* tests/seq/seq-no-progress.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-RI0OLUBX.
2026-11-02 23:42:42 +00:00
Collin Funk 3d2af4cac4 tests: mkfifo: add some basic test cases
* tests/mkfifo/basic.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-10-31 23:03:30 -07:00
Collin Funk 83545af2a8 tail: allocate a large enough inotify event buffer
* src/tail.c (tail_forever_inotify): Size the buffer based on NAME_MAX
instead of the operands. Reduce the scope of some variables.
* tests/tail/inotify-long-name.sh: New file.
* tests/local.mk (all_tests): Add the new test.
* NEWS: Mention the bug fix. Adjust the reference in a previously fixed
bug to mention it was introduced with inotify support.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-S9L24ERC.
2026-10-30 17:59:19 -07:00
Pádraig Brady 977b071eaf tests: add checks for recent strftime fixes
Add docs and tests for the recent gnulib strftime fixes.

* tests/misc/strftime.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fixes.
Fixes https://bugs.gnu.org/82130
2026-10-30 17:58:15 +00:00
Collin Funk 7d74e197bb cp: quote directory names when --parents and --verbose are used
* src/cp.c (make_dir_parents_private): Quote the names of the directory
and the source.
* tests/cp/verbose-parents-quote.sh: New file
* tests/local.mk (all_tests): Add the new test.
* NEWS: Mention the bug.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-JJG3V3T9.
2026-10-25 14:32:32 -07:00
Collin Funk 074be5fae5 chown,chgrp: don't print uninitialized ownership info on dangling links
* src/chown-core.c (change_file_owner): Set the pointer to NULL if
fstatat fails.
* tests/chgrp/verbose-dangling-symlink.sh: New file.
* tests/chown/verbose-dangling-symlink.sh: New file.
* tests/local.mk (all_tests): Add the new tests.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-YYGC42VE.
2026-10-25 14:32:32 -07:00
Sylvestre Ledru af626a5749 tests: cp: check -rT does not copy through a symlinked destination
* tests/cp/r-T-symlink.sh: New test.  Ensure cp -rT refuses to copy
a directory over a symlink to a directory, while a trailing slash or
omitting -T copies into what the symlink resolves to.
* tests/local.mk (all_tests): Reference the new test.
https://github.com/uutils/coreutils/pull/14993

Link: https://github.com/coreutils/coreutils/pull/398
2026-10-25 13:43:13 +00:00
Collin Funk e78a41cf8f tests: date: test that -u overrides the time zone when setting the time
This adds a test for the bug fixed by commit 9192fd32e (date: bring back
-u complexity with putenv, 2026-10-22).

* tests/date/date-set.sh: New file.
* tests/local.mk (all_tests): Add the new test.
* NEWS: Mention the bug fix.
2026-10-24 12:22:36 -07:00
Collin Funk 2c2a1334fa factor: fix an infinite loop with some large numbers
* src/factor.c (mulredc2): Add the carry to p1, which is the high word
of a two-word integer created by summing two single-word integers and is
therefore unable to overflow, instead of using a low word r0, which may
wrap around by adding the carry.
* tests/factor/mulredc2-infloop.sh: New file.
* tests/local.mk (all_tests): Add the new test.
* NEWS: Mention the bug fix.

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-CFUR0JKW.
2026-10-23 19:30:36 -07:00
Pádraig Brady 12244b4f2b tail: fix handling of inotify event queue overflow
* src/tail.c (tail_forever_inotify): Fallback to polling upon overlow.
* tests/tail/inotify-overflow.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-UUNT73BK.
2026-10-23 17:02:33 +01:00
Pádraig Brady 60e7bf4121 stty: support save/restore of speeds not encoded in control flags
Note this changes the output format of -g.
POSIX states that the -g format only needs to be compatible
with the stty implementation that produced it.
However we improve compatibility on Linux by only outputting
the explicit speeds when they're not encoded in the control flags.

* NEWS: Mention the change in behavior.
* src/stty.c (display_recoverable): Output the speeds if needed.
(recover_mode): Read the speeds if present.
* tests/stty/stty-save-speed.sh: Add a new test.
* tests/local.mk: Reference the new test.

Link: https://github.com/coreutils/coreutils/issues/384
2026-10-21 12:46:48 +01:00
Collin Funk b5bc155d69 tests: misc: test that /proc/self/comm is properly set
This tests the fix introduced by commit ee9b9aff8 (all: set
/proc/self/comm to the program name in the single binary, 2026-10-17).

* tests/misc/proc-self-comm.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-10-16 21:12:35 -07:00
Iván Ezequiel Rodriguez 6ab90e2010 tail: improve scalability of follow-by-name directory events
Replace the O(N) scan of watched names on each directory inotify event
with a Hash_table keyed by (parent_wd, basename), addressing the
long-standing FIXME in tail_forever_inotify.

Keep ownership consistent with wd_to_name: parent_by_name is created
only for Follow_name and returned to the caller, so fallback paths can
return without local hash cleanup.

Hash basenames with hash_string() and mix in parent_wd, matching the
existing gnulib helper rather than a hand-rolled string hash.

Matching cost for N directory events that each compare against N names
(illustrative host timings of the scan vs hash lookup alone):

  N=1000:  ~0.018s -> ~0.000s
  N=5000:  ~0.39s  -> ~0.000s
  N=10000: ~1.5s   -> ~0.000s

End-to-end recreate storms remain largely file-system bound on this
host; the hash removes the quadratic name-matching CPU from that path.

* src/tail.c (parent_name_hasher, parent_name_comparator): New.
(tail_forever_inotify): Build and use parent_by_name; return it to the
caller.
(main): Free parent_ht when non-NULL.
* tests/tail/inotify-parent-hash.sh: Require notification mode; cover
multiple names in one directory and the same basename in two
directories.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
2026-10-13 14:33:22 +01:00
Pádraig Brady 402bce6637 ls: fix missing ACL indicators or capability colors
On systems where the security context reports as unsupported,
and we encountered a file without ACLs, no further lookups
would be performed.  Introduced in commit v9.5-156-gb857d66b5.
This fix is along similar lines as commit v9.6-40-gcb2abbac7.

* src/ls.c (file_has_aclinfo_cache): Don't mark file system as
unsupported if there might be ACLs or capabilities present.
* tests/ls/acl-cache.sh: Add a new test.
* tests/local.mk: Reference the new test.
* tests/ls/acl.sh: Add a check.
* NEWS: Mention the bug fix.
2026-10-13 11:32:41 +01:00
Collin Funk 77e7674add tests: wc: add a test for the fix in the previous commit
* tests/wc/page-size.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-10-08 00:39:50 -07:00
Collin Funk a0cec995fa tests: sum,cp: disable Unicode when executing Perl
* tests/local.mk (TESTS_ENVIRONMENT): Set PERL_UNICODE to 0.
* tests/cksum/sum-sysv.sh: Call binmode on STDOUT.
* tests/cp/copy-FMR.sh: Likewise.
* tests/cp/sparse-extents-2.sh: Likewise.
Fixes https://bugs.gnu.org/81994
2026-10-05 19:56:44 -07:00
Collin Funk cf98d8e8ca tests: misc: test programs can execute invalid Unicode program names
* tests/misc/exec-bad-unicode.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-10-04 14:31:04 -07:00
Pádraig Brady 5ef76b9ac8 wc: fix handling of multi-byte chars spanning buffers
Commit v9.4-43-ga6064bb86 introduced this edge case
in handling multi-byte characters spanning the input buffer.

* src/wc.c (wc): Ensure we include the bytes previously read
but as yet unprocessed.
* tests/wc/mb-non-utf8.sh: Add a new test for miscounted GB118030 chars.
* tests/local.mk: Reference the new test.
* tests/wc/wc.pl: Add a new check for word count with a
UTF-8 space spanning a buffer boundary.
* NEWS: Mention the bug fix.
2026-10-03 15:47:15 +01:00
Pádraig Brady f76b1d7ca5 maint: move tests/misc/xattr.h to tests/cp/
* tests/misc/xattr.sh: Rename to ...
* tests/cp/xattr.sh: ... here.
* tests/local.mk: Update the reference.
2026-09-18 17:53:00 +01:00
Pádraig Brady b257228543 maint: move tests/misc/printenv.h to tests/env/
* tests/misc/printenv.sh: Rename to ...
* tests/env/printenv.sh: ... here.
* tests/local.mk: Update the reference.
2026-09-17 08:52:12 +01:00
Ismail Ramzi 25792e3763 ls: fix use-after-free reading LS_COLORS ln=target
parse_ls_color stores color_indicator[C_LINK].string as a pointer into
the color_buf buffer, then frees color_buf on the unparsable-value path.
The "ln=target" check after the parse loop still read that freed buffer,
e.g. with LS_COLORS='ln=target:x'.  Skip it on the failure path, where
color output is disabled anyway and the buffer is gone.
* src/ls.c (parse_ls_color): Return after freeing color_buf on failure,
so the color_indicator[C_LINK] check only runs when the buffer is live.
* tests/ls/color-symlink-target.sh: New test.
* tests/local.mk (all_tests): Add it.
* NEWS: Mention the fix.

Link: https://github.com/coreutils/coreutils/pull/352
2026-09-14 03:07:54 +01:00
Collin Funk 29933e8a5c tests: misc: test that various commands don't fork
* tests/misc/no-fork.sh: New file.
* tests/local.mk (all_tests): Add the new test.
* tests/misc/stdbuf.sh: Remove a test that is redundant with the new
test.
2026-08-28 22:10:34 -07:00
Sylvestre Ledru 47dfc77774 tests: mv: check cross-device move of dir with hard links and symlink
* tests/mv/part-hardlink-symlink.sh: New test, ensuring that moving a
directory to another file system preserves the contents and the hard
links of its regular files, as well as the symlinks pointing at them.
* tests/local.mk (all_tests): Add it.
https://github.com/uutils/coreutils/pull/14170

Link: https://github.com/coreutils/coreutils/pull/337
2026-08-27 17:00:39 +01:00
Collin Funk d458e11b2c tests: cp,mv,install: check for data loss with an empty backup suffix
* tests/misc/empty-backup-suffix.sh: New file.
* tests/local.mk (all_tests): Add the new test.
2026-08-15 18:52:54 -07:00
Pádraig Brady adb4d98799 env: support --env0-from to read NUL separated vars from file
* doc/coreutils.texi (env invocation): Document --env0-from.
* src/env.c (set_envvars_from_file): A new function to parse
.*=.*\0 format files and augment the environment with them.
* tests/env/env0-from.sh: Add a new test.
* tests/local.mk: Reference new test.
* NEWS: Mention the new feature.
* THANKS.in: Add Stefan Klinger, who proposed/discussed the change.

Link: https://github.com/coreutils/coreutils/issues/324
2026-08-14 18:00:15 +01:00
Arun Bhattacharya 162ddbe972 uname: add -A,--all-labeled to print labeled lines
* doc/coreutils.texi (uname invocation): Describe -A,--all-labeled.
* src/uname.c (main): Accept new option.
(print_element): Also output label if enabled.
* tests/misc/uname-labeled.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.

Link: https://github.com/coreutils/coreutils/issues/313
2026-08-12 15:42:48 +01:00
Sylvestre Ledru f6539191f1 ptx: fix infinite loop with a nullable --word-regexp
'ptx -W "a*"' would never terminate.  SKIP_SOMETHING advanced the cursor
by the length of the match, which is zero when the word regexp matches
the empty string, and no other value in the surrounding loop conditions
changes.  find_occurs_in_text already skips zero length matches, and a
zero length --context-regexp match is rejected outright; only this macro
lacked the forward progress guarantee.

* src/ptx.c (SKIP_SOMETHING): Advance by at least one byte on a zero
length match, as the other branches of the macro already do.
* tests/ptx/word-regex-loop.sh: New test.
* tests/local.mk (all_tests): Reference it.
* NEWS: Mention the fix.

Link: https://github.com/coreutils/coreutils/pull/328
2026-08-10 22:24:21 +01:00
Pádraig Brady cdfaf73b8f tests: add tests to ensure quoting to tty
* tests/misc/tty-quoting.sh: Add positive test for
basename, du, ls, readlink, and realpath quoting.
* tests/local.mk: Reference the new test.
2026-08-01 13:03:38 +01:00
Collin Funk c4bf1d49be tests: du: test --block-size and BLOCK_SIZE
* tests/du/block-size.sh: New file.
* tests/local.mk: Add the test case.
2026-07-28 23:17:13 -07:00
Pádraig Brady 30866b30e2 chcon,chgrp,chmod,chown,du,ls: ignore missing files while traversing
* src/fts-missing.h: Add helper routines to determine
if an FTS entry is skippable.  I.e., that is traversed
and not specified on the command line.
* src/chcon.c (process_file): Setup to ignore skippable files.
(change_file_context): Ignore missing files if appropriate.
* src/chmod.c (process_file): Setup to ignore skippable files.
Ignore missing files if appropriate.
(mode_changed): Ignore missing files if appropriate.
* src/chown-core.c (change_file_owner): Setup to ignore skippable files.
Ignore missing files if appropriate.
* src/du.c (process_file): Likewise.
* src/ls.c (print_dir): Ignore missing files if appropriate.
(get_link_name): Likewise.
(gobble_file): Likewise.  Also handle the dangling symlink case.
* src/system.h (ignorable_traversal_errno): Match ENOENT for missing
files.
* tests/chcon/traversal-missing.sh: A new test.
* tests/misc/traversal-missing.sh: Likewise.
* tests/local.mk: Reference the new tests.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/81444
2026-07-24 13:19:23 +01:00
Mateusz Nosek b4bc8f361b install: avoid redundant metadata updates with -C
"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.
2026-07-16 12:28:03 +01:00