With -n and truncated lines, add_line_number() added NUMBER_WIDTH to
INPUT_POSITION without checking for overflow. A tab at the start of a
line followed by a line number width near INT_MAX would wrap
INPUT_POSITION negative, and with -e the next tab would then be
expanded by more than the tab width, writing past the end of CLUMP_BUFF.
E.g., printf '\t\t\n' | pr -t -e -W2147483647 -n:2147483643
wrote 12 bytes into an 8 byte buffer.
* src/pr.c (add_line_number): Use ckd_add when advancing INPUT_POSITION.
(init_parameters): Likewise when computing NUMBER_WIDTH,
which overflowed with -n:2147483647.
* tests/pr/options.sh: Add test cases.
* NEWS: Mention the bug fix.
Link: https://github.com/coreutils/coreutils/pull/458
* 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.
* src/ln.c (do_link): Use backup_file_rename which uses renameat2 on
platforms that support it.
* NEWS: Mention the bug fix. Remove mentions of 'ln' from the 'cp',
'mv', and 'install' changes in release 8.28 from Commit 0d74ac470 (copy:
make backup files more reliably, 2017-07-30).
* cfg.mk (old_NEWS_hash): Update using 'make update-NEWS-hash'.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-D7OXM969.
* src/copy.h (struct cp_options): Add the owner and group fields.
* src/cp.c (cp_option_init): Initialize them to -1.
* src/mv.c (cp_option_init): Likewise.
* src/install.c (cp_option_init): Likewise.
(change_attributes): Use lchmodat instead of chmodat. Only set the
attributes here if 'strip' is used.
(change_timestamps): Use AT_SYMLINK_NOFOLLOW when calling utimensat.
(main): If --strip is not in use, have copy set the mode and ownership
for us with the file descriptor it has open.
* src/copy.c (copy_reg): Don't use fclonefileat if we have to set the
mode, since it would require a subsequent open. If the owner and/or
group are given in the options, set the ownership.
(copy_internal): Omit permissions if set_mod in the options is set.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-HJARXJNW.
Discovered by Calif.io, as bug ANT-2026-J82F5KHS.
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.
Fix skipped processing of items after a symlink to '/'.
* src/chmod.c (process_file): Only skip with directory
visited in pre-order.
* tests/chmod/symlinks.sh: Add a test case (skipped if root).
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-HWDZFHEJ.
* 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>
* src/install.c: Include selinux-at.h.
(need_copy): Expect a directory file descriptor and relative name
argument, instead of a file name. Use them when getting the security
context of the destination.
(setdefaultfilecon): Expect a directory file descriptor and relative
name argument. Use it when setting the security context of the
destination.
(copy_file): Adjust call to need_copy.
(change_attributes): Adjust call to setdefaultfilecon.
* gnulib: Update for commit dd5b313c3f (selinux-at: Define functions
that don't perform context translation., 2026-11-10).
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-XB6SGSHL.
* src/split.c (bytes_split): Don't lseek when the offset is already at
the correct position from reading. Don't add 1 to TO_WRITE.
* tests/split/filter.sh: Add two test cases.
* NEWS: Mention the bug fixes.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-D5DVHK7A.
* 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.
csplit opened each output file with fopen "w", which truncates it,
before reading the part of the input that goes into it. When an
output file name (xx00, xx01, ...) refers to the input file, the part
of the input not yet read was lost: all of it for the first output
file, and for later ones whatever was not yet buffered, usually
silently, with exit status 0:
$ seq 300000 > xx01 && csplit xx01 2 && wc -c xx01
8188 xx01 # was 1988895 bytes
If a later pattern then failed, csplit removed the output files it
had created, the input among them.
Instead, as split does, open the output without O_TRUNC, compare it
with the input, and fail with "would overwrite input; aborting"
before anything is written. The input is left intact, and the
output files created so far are removed, unless -k is given.
* src/csplit.c: Don't include stdio--.h.
(in_stat_buf): New static variable.
(main): Set it after opening the input.
(create_output_file): Open the output without O_TRUNC, and fail if it
is the input file; truncate it otherwise.
* NEWS: Mention the bug fix.
`tail -n2 in >> in` already operated in a bounded manner,
so this makes tailing from the start with `tail -n+2 in >> in`
bounded also, operating only on the original file contents
and not increasing the size of 'in' forever.
Note this bounded operation does not apply with -f.
* src/tail.c (remaining_input): A new helper to return
the limit of the original file when output is the same file.
(tail_bytes): Use the new limit from remaining_input().
(tail_lines): Likewise.
* tests/tail/append-to-input.sh: Adjust accordingly.
Note this test was failing on Alpine due to its
different buffering behavior. We're now consistent
over all file sizes and buffering behaviour in this case.
* NEWS: Mention the improvement.
Test failure reported by Bruno Haible.
* src/pr.c: Move the pointer initialization later,
when we know the indexes will be valid. The UMR was
already known, as per the removed comment,
but not triggered until recent indexing changes.
Reported by Bruno Haible.
* tests/env/env.sh: Avoid calling "sh" with a modified argv[0],
as e.g. with busybox providing sh, it will fail with "applet not found".
Reported by Bruno Haible.
This was seen on Centos 7 at least with bash 4.2.46.
* tests/timeout/timeout.sh: Ensure the shell doesn't incorrectly
optimize itself away when there are traps in place.
Reported by Bruno Haible.
* tests/ls/line-separator.sh: Skip on systems that treat
U+2028 (LINE SEPARATOR), and U+2029 (PARAGRAPH SEPARATOR)
as printable. Also since we're requiring our printf now,
use that to decouple the test from the particular shell-escape
quoting form used.
Reported by Bruno Haible.
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.
This change is performance neutral as tested with:
$ yes | head -n10M > sl.in
$ yes $(yes éééááé | head -n9 | paste -s -d,) | head -n1M > mb.in
$ hyperfine src/cut{,.orig}' -c1 sl.in >/dev/null'
$ hyperfine src/cut{,.orig}' -f1 -w mb.in >/dev/null'
* src/cut.c (skip_buffered_line): A new refactored helper.
* src/cut.c (scan_mb_line_end): Use help, and also call mbbuf_avail()
to process remaining bytes before topup.
(cut_characters_mode): Likewise. Note the topup is done implicitly
in the following mbbuf_get_char().
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-VRMLC6DR.
* src/split.c (of_t): Add the done member.
(lines_rr): Set the done member for the file if the filter has an
ignorable error. Don't attempt subsequent writes if the done member for
the file is set.
* tests/split/filter.sh: Add a test case.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-NO8YC6GS.
* src/split.c (lines_chunk_split): Make sure CHUNK_NO does not exceed N.
* tests/split/l-chunk.sh: Add a test case without --elide-empty-files
and with it.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-ZDDBFXXM.
* src/sort.c (sortlines): Don't share compressed temporary files when
the same input is given multiple times.
* tests/sort/sort-compress-hang.sh: Add a test case that would
previously hang.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-MYSN7JAW.
* 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.
* 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
dash 0.5.13 to 0.5.13.5 at least has a variable expansion bug:
https://bugzilla.redhat.com/2568651
This was seen on Fedora 44 and there is no upstream dash
release with a fix yet.
* init.cfg (bad_unicode): Avoid the dash issue, by comparing
the variable expansion and skipping upon mismatch.
* tests/du/block-size.sh: Add explicit checks for expansion
on values with high bit set.
* tests/paste/multi-byte.sh: Likewise.
* gnulib: Update to get commit 8b4da9a18f (attribute: Provide access to
gcc's access attribute., 2026-11-05).
* src/system.h (ptr_align): Use ATTRIBUTE_ACCESS_NONE.
* 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.