* src/printf.c (STRTOX): Add a call to quote when printing the ignored
characters.
* tests/printf/printf.sh: Adjust an existing test case. Add another
quoting test case.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-I9I24ON7.
* src/nl.c (check_section): Add a check for a zero section delimiter
length.
* tests/nl/nl.sh: Add a test case.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-PDYYNTYZ.
* src/od.c (format_address_std): Add an affirm call to check that the
address is positive or equal to zero, which would have caused a
descriptive assertion in this case instead of a SIGSEGV.
(offset_add): New function.
(dump): Use it to diagnose overflows.
(dump_strings): Likewise.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-EZXPB4TK.
* 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.
* 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.
* src/selinux.c (restorecon_private): Open the file with O_NOCTTY and
O_NONBLOCK.
* tests/misc/selinux.sh: Add a test case.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-L5GJ7M7X.
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.
* src/copy.c (copy_internal): Add a missing quoteaf call.
* tests/cp/link-no-deref.sh: Invoke getlimits_ and uses_strace_. Inject
an error using 'strace' to verify the name of the destination is quoted
in the error message.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-3M3N6L8K.
* doc/coreutils.texi (dircolors invocation): Use an absolute path when
checking whether a user's .dircolors file exists in $HOME and when
loading it. Don't define a variable.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-HB2T3LWR.
* 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.
* src/factor.c (strtouuint): Return LONGINT_OVERFLOW only if all of the
characters are digits; otherwise, return LONGINT_INVALID.
* tests/factor/factor.pl: Add two test cases.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-IZ8PFQ7Q.
* src/stty.c (struct speed_desc): New type, used to differentiate
between errors and (speed_t) -1.
(last_ibaud, last_obaud): Define variables as struct speed_desc instead
of speed_t.
(check_speed): Adjust uses of last_ibaud and last_obaud to their new
definitions.
(set_speed): Likewise. Use a struct speed_desc as the argument instead
of speed_t. Check for its validity using the valid member instead of
whether it is equal to (speed_t) -1.
(apply_settings): Use struct speed_desc instead of speed_t to store the
result of string_to_baud. Check for its validity using the valid member
instead of whether it is equal to (speed_t) -1.
(string_to_baud): Adjust the function to return a struct speed_desc
instead of speed_t.
* src/speedgen (value_to_baud): Likewise.
* NEWS: Mention the bug fix.
Link: https://github.com/coreutils/coreutils/issues/383
* tests/misc/proc-self-comm.sh: Quote variables that contain the current
working directory, which may contain spaces. Don't set symlink_cat to a
multi-argument command invocation. Set the path before executing it.
Reported by Bruno Haible.
This preserves any program name transformations, e.g., when
--program-prefix=g is used as a configuration option, unlike commit
ef874ed6c (all: set /proc/self/comm to the program name in the single
binary, 2026-10-17).
* src/coreutils.c (launch_program): Use the last component of argv[0]
when setting the comm value using prctl (PR_SET_NAME, ...).
* tests/misc/proc-self-comm.sh: When using
--enable-single-binary=shebangs, test that the comm value preserves any
program name transformations, e.g., --program-prefix=g.
* NEWS: Adjust the NEWS entry to refer to last component of argv[0]
instead of the program name.
Suggested by Pádraig Brady.
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.
* src/ptx.c (WORD_TABLE): Change the COUNTED_BY to use the length member
instead of alloc.
(digest_word_file): Increment the length before appending to the table
otherwise -fsanitize=bounds would kill the program.
* src/split.c (open_pipes): Define as a struct containing the previously
global variables. Use COUNTED_BY.
(open_pipes_alloc, n_open_pipes): Remove variables moved into the newly
added struct.
(create): Update uses of the previously existing globals to reference
the open_pipes struct.
(closeout): Likewise. Don't decrement the pipe bounds until after we
make our final access to the last pipe in the array, to satisfy the
requirements of the COUNTED_BY attribute.
* src/sort.c (temp_dirs): Define as a struct containing the previously
global variables. Use COUNTED_BY.
(temp_dir_count, temp_dir_alloc): Remove variables moved into the newly
added struct.
(create_temp_file, open_temp, main): Update uses of the previously
existing globals to reference the temp_dirs struct.
* src/df.c (table): Define as a struct containing the previously global
variables. Use COUNTED_BY.
(columns, ncolumns, ncolumns_alloc, nrows, nrows_alloc): Move into the
table struct.
(alloc_table_row, print_table, alloc_field, get_field_list, get_header)
(get_dev): Update uses of the previously existing globals to reference
the table struct.
* src/join.c (struct line): Change the COUNTED_BY to use the nfields
member instead of nfields_allocated.
(extract_field): Increment the count before writing to the last field,
otherwise -fsanitize=bounds would kill the program.
Since commit bff0e5412 (build: sort: explicitly tag libcrypto
dependency, 2026-09-06), which added a dependency on Gnulib's sd-dlopen
module, this check has been unnecessary. This can be seen by the
separate variables in Makefile.in, which have the same purpose.
$ grep -E '^LIB_?DL' Makefile.in
LIBDL = @LIBDL@
LIB_DL = @LIB_DL@
* src/local.mk (src_sort_LDADD): Use $(LIBDL) instead of $(LIB_DL).
* configure.ac: Likewise. Don't check for dlopen and libdl, which Gnulib
has already done for us.
Linux 2.1.57 introduced both prctl(2) and PR_SET_PDEATHSIG(2), so the
condition before this patch is correct there. However, other systems
have a prctl function but not PR_SET_PDEATHSIG, e.g., Irix and
SerenityOS.
* src/timeout.c (main): Check that PR_SET_PDEATHSIG is defined before
using it.
* NEWS: Mention the crash when invoking various programs --help option
when configured with --disable-bold-man-page-references and
--disable-manual-url.
Without this change, this test would fail during 'make distcheck', for
example.
* tests/misc/exec-bad-unicode.sh: Skip the test if $abs_top_builddir has
spaces or special characters.
* cfg.mk (_tb_misc): Also match tests/misc/exec-bad-unicode.sh.
Reported by Bruno Haible.
* tests/readlink/rl-1.sh: Add tests for the 'readlink' invocations that
would cause an infinite loop before commit b66f3e4e2 (realpath: fix an
infinite loop when resolving symbolic links, 2026-09-25). Also test the
behavior without an option, which would not cause the infinite loop.
* tests/misc/realpath.sh: Test the flags supported by 'realpath' that
would previously infinite loop before commit b66f3e4e2 (realpath: fix an
infinite loop when resolving symbolic links, 2026-09-25). Test an
invocation which would avoid the infinite loop by not touching the file.
* src/join.c (struct line): Use the COUNTED_BY attribute on the fields
member.
(struct seq): Use the COUNTED_BY attribute on the lines member.
(freeline): When setting a pointer using the COUNTED_BY attribute to
NULL, set its counter to zero.
Reported by Brian Foster in:
<https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/2161155>
* gnulib: Update to get commit b18879b9ed (canonicalize: Fix a missing
check for symlink loops., 2026-09-25)
* tests/misc/realpath.sh: Add a call to getlimits_. Add a test case.
* NEWS: Mention the bug fix.
The assert function doesn't always cause the program to exit, so it
can't be marked _Noreturn. Therefore, even affirm (false), when it
expands to assert (false), will warn about an implicit fallthrough.
* src/cut.c (main): Move the affirm (false) case to the end of the
switch statement.
* src/numfmt.c (simple_strtod_fatal): Likewise.
* src/tr.c (string2_extend): Remove the call to unreachable () default
and combine it with the affirm (false) case.
* tests/cp/capability.sh: Add a getlimits_ invocation. Allow 'cp' to
fail with ENOTSUP, which occurs when trying to copy the security.selinux
extended attribute.
On GNU/Hurd, this test would get stuck in an infinite loop like the
following:
+ kill -s INFO 16535
+ sleep .01
+ kill -s INFO 16535
+ sleep .01
+ kill -s INFO 16535
+ sleep .01
[...]
The signals being sent that frequently seem to prevent 'dd' from
performing writes, since it outputs the following during that time:
0+0 records in
0+0 records out
0 bytes copied, 7161.11 s, 0.0 kB/s
0+0 records in
0+0 records out
0 bytes copied, 7161.88 s, 0.0 kB/s
[...]
* tests/dd/stats.sh: Use a larger interval between signals on GNU/Hurd.
On GNU/Hurd, file descriptor limits set via 'ulimit -n' seem to be
ineffective when set below the default:
$ (ulimit -n; ulimit -n 512; ulimit -n; \
tee $(seq 1024) < /dev/null; echo $?)
1024
512
tee: 1022: Too many open files
tee: 1023: Too many open files
tee: 1024: Too many open files
1
* tests/sort/sort-merge-fdlimit.sh: Don't fail if using 'ulimit -n' to
decrease the file descriptor limit is ineffective.
* tests/df/skip-rootfs.sh: Test for /init which is listed as rootfs in
/proc/self/mountinfo, but tmpfs according to statfs.
Fixes https://bugs.gnu.org/65331
* src/printenv.c (main): Make sure quoting is disabled when we have
arguments and standard output is not a terminal.
* tests/misc/printenv.sh: Adjust single argument test cases. Add
multiple argument test cases.
* tests/misc/tty-quoting.sh: Add test cases to check if isatty is used.
* doc/coreutils.texi (printenvAlwaysQuoted): Remove macro.
(printenv invocation): Describe the adjusted quoting behavior.
(env invocation): Move the text from printenvAlwaysQuoted here since it
is no longer used for 'printenv'.
* 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.
* tests/printf/printf-cov.pl ($ESCAPE_CHARS, $ESCAPE_OUTPUT): New
variables derived from the existing 'escape-1' test.
(@Tests): Add some additional escaping tests and test %b.
The following error was seen on a Debian 6.0 virtual machine using perl
5.10.1:
Bareword found where operator expected at \
./tests/join/join.pl line 327, near "tr/_/-/r"
syntax error at ./tests/join/join.pl line 327, near "tr/_/-/r"
Execution of ./tests/join/join.pl aborted due to compilation errors.
FAIL tests/join/join.pl (exit status: 255)
* tests/join/join.pl: Don't use the /r modifier which was not introduced
until perl 5.13.7.
* tests/misc/pathchk.sh: Move the existing empty file name tests to a
loop to check some additional options. Check the message printed to
standard error.
* src/set-fields.c (set_fields): Prefer xreallocarray which will check
for unlikely overflows when multiplying the number of elements by the
size of the element.
* tests/cp/capability.sh: Check that --preserve=xattr fails when
extended attributes cannot be copied. Check that --preserve=all creates
the copy successfully even if extended attributes cannot be copied.
This adjusts the error messages to be a bit more descriptive. Here are
the previous errors:
$ LC_ALL=C src/stdbuf-prev -o1a true
stdbuf-prev: invalid mode '1a'
$ LC_ALL=C src/stdbuf-prev -oa true
stdbuf-prev: invalid mode 'a'
$ LC_ALL=C src/stdbuf-prev -o1Z true
stdbuf-prev: invalid mode '1Z': Value too large for defined data type
Here are the new errors:
$ LC_ALL=C src/stdbuf -o1a true
stdbuf: invalid suffix in -o argument '1a'
$ LC_ALL=C src/stdbuf -oa true
stdbuf: invalid -o argument 'a'
$ LC_ALL=C src/stdbuf -o1Z true
stdbuf: -o argument '1Z' too large
* src/stdbuf.c: Include xstrtol-error.h.
(parse_size): Return the error from xstrtoumax. Prefer ckd_add to check
for overflow.
(main): Prefer xstrtol_fatal to a custom error message.
* src/copy.c (copy_reg, copy_interal): Don't change the exit status if
copying extended attributes fails and we are 'mv'.
* src/copy.h (struct cp_options): Update some commentary.
* src/mv.c (cp_option_init): Enable require_preserve_xattr in the
cp_options struct.
* tests/cp/cp-mv-enotsup-xattr.sh: Check that the error is emitted when
'mv' is built with extended attribute support.
* doc/coreutils.texi (mv invocation): Mention that all errors are
emitted, but do not modify the exit status.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/13601
These macros evaluate their arguments more than once, so using them
while incrementing a pointer, for example, would introduce bugs.
* src/octhexdigits.h (isoct, fromoct, fromhex): Define as an inline
function instead of a macro.
Analyzer mistakenly reports that the CSWTCH lookup table can overflow
here since it cannot infer the value of C from the previously called
switch statement in main. See:
<https://gcc.gnu.org/bugzilla/PR126885>.
* src/stdbuf.c (optc_to_fileno): Add a default label with a call to
unreachable.
* tests/env/env.sh: Filter out __CF_USER_TEXT_ENCODING from the output.
Make the regex more strict.
* tests/misc/printenv.sh: Likewise.
Reported by Bruno Haible.
* doc/coreutils.texi (printenvAlwaysQuoted): New macro.
(printenv invocation): Use it.
(env invocation): Use it.
* src/printenv.h: New file.
* src/local.mk (noinst_HEADERS): Add it.
(src_env_SOURCES): Likewise. Group with src_printenv_SOURCES.
(src_printenv_SOURCES): New variable.
* src/printenv.c: Include argmatch.h and printenv.h.
(main): Quote printed variable names and values.
* src/env.c: Include argmatch.h and printenv.h.
(main): Quote printed variable names and values.
* tests/misc/printenv.sh: Add test cases.
* tests/env/env.sh: Likewise. Adjust invalid UTF-8 test cases.
* NEWS: Mention the change in behavior.
* doc/coreutils.texi (terminalQuoted): New macro.
(readlink invocation, basename invocation, dirname invocation): Use it.
* src/dirname.c (quote_output): New variable.
(main): Quote output when appropriate.
* src/system.h (quoteN_mem): New macro.
* tests/misc/dirname.pl: Add test cases based on the ones added for
basename in commit e897dfd02 (basename: quote problematic names on tty,
2026-07-30). Copy some logic from tests/misc/basename.pl to test the -z
option.
* tests/misc/tty-quoting.sh: Also test dirname.
* NEWS: Mention the improvement.
* tests/tail/inotify-rotate-resources.sh: Use require_inotify_supported_
instead of require_local_dir_ and the recently added check for
overlayfs.
Suggested by Pádraig Brady.
* NEWS: Mention the bug fix.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_test_minus_ao): Exclude
NEWS.
* src/test.c (term): Treat '-a' and '-o' as strings instead of expecting
them to be valid unary operators.
* tests/test/test.pl: Add some test cases.
* tests/test/test-diag.pl: Also test the diagnostics with '-a arg'.
Map 'false' to reuse logic from 'true', instead of creating separate
binaries for each utility.
$ size src/coreutils-prev
text data bss dec hex filename
1476092 7348 2191936 3675376 3814f0 src/coreutils-prev
$ size src/coreutils
text data bss dec hex filename
1474612 7348 2191968 3673928 380f48 src/coreutils
* src/local.mk (noinst_HEADERS): Add src/true.h.
(src_false_LDADD): Organize with the rest of the reused programs. Use
$(src_true_LDADD) instead of $(LDADD).
(src_true_SOURCES, src_false_SOURCES): New variables.
* build-aux/gen-single-binary.sh (override_single): Map 'false' to
'true'.
* src/false.c: Remove file.
* po/POTFILES.in: Remove src/false.c.
* cfg.mk (_src): Match src/true-false.c and src/true-true.c.
* src/coreutils-false.c: New file.
* src/true-false.c: Likewise.
* src/true-true.c: Likewise.
* src/true.h: Likewise.
* src/true.c: Include true.h.
(EXIT_STATUS): Always define the macro to use the value of the TRUE_MODE
variable.
(PROGRAM_NAME): Likewise.
* NEWS: Mention the improvement.
Map the '[' command to which selects appropriate behavior at runtime,
rather than separate binaries for each closely related utility.
$ size src/coreutils-prev
text data bss dec hex filename
1485188 7348 2191968 3684504 383898 src/coreutils-prev
$ size src/coreutils
text data bss dec hex filename
1476092 7348 2191936 3675376 3814f0 src/coreutils
* src/local.mk (noinst_HEADERS): Add src/test.h.
(src___SOURCES): Remove src/lbracket.c. Add src/test.c and
src/test-lbracket.c.
(src_test_SOURCES): New variable.
(src/coreutils.h): Adjust the function name to be
single_binary_main_lbracket instead of single_binary_main__.
* build-aux/gen-single-binary.sh: Likewise. Map '[' to 'test'.
(override_single): Adjust the file name to be coreutils-lbracket.c
instead of coreutils-_.c.
* src/lbracket.c: Remove file.
* cfg.mk (_src): Don't match src/lbracket.c in the regular
expression. Match src/test-lbracket.c and src/test-test.c.
* src/coreutils-lbracket.c: New file.
* src/test-lbracket.c: Likewise.
* src/test-test.c: Likewise.
* src/test.h: Likewise.
* src/test.c: Include test.h.
(LBRACKET): Remove macro.
(PROGRAM_NAME): Use the variable TEST_MODE to determine the program
name.
(main): Use the variable TEST_MODE instead of the LBRACKET macro to
implement behavior specific to '['.
* NEWS: Mention the improvement.