This reverts my commit b64f9bfe4f
dated 2026-04-02. I forgot that posixtime cares whether
-u has been specified, and gets that info via TZ.
It also uses xsetenv rather than the old putenv.
This fixes ANT-2026-LR8TONF4.
* configure.ac (LOCALTIME_CACHE): Bring this back.
* src/date.c (TZSET): Bring this back.
(main): Bring back setting TZ="UTC0" in the environment.
However, use xsetenv rather than putenv, as that’s simpler.
* src/basenc.c (base32hex_decode_ctx_wrapper): Ensure we don't
accept base32 only characters for base32hex.
* tests/basenc/basenc.pl: Ensure negative base32hex tests have the
appropriate number of characters to test character validation
rather than just input size validation.
* NEWS: Mention the bug fix.
Discovered by Anthropic's OSS Scanner, as bug ANT-2026-EP1XO2G4.
* 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.
stty currently fails like:
$ stty 9600
$ saved=$(stty -g)
$ stty 19200 "$saved" # Sets 9600 but reports failure
stty: 'standard input': unable to perform all requested operations
Whereas these work fine:
$ stty 19200 9600
$ stty "$saved" 19200
* NEWS: Mention the bug fix.
* src/speedgen (cbaud_to_speed): Determine the speed
from the control flag encoding.
* src/stty.c (recover_mode): If no separate speed specified,
update the speed from the specified control flags.
* tests/stty/stty-save-speed.sh: Add test cases.
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
* init.cfg (single_binary_build_): An abstraction to check
if the current build is a functional --enable-single-binary build.
(require_safe_builddir_): Also add an abstraction to check for
whitespace in $abs_top_builddir.
* tests/misc/proc-self-comm.sh: Just warn about a non functional
dispatch binary.
* tests/install/basic-1.sh: Use the abstraction which is more accurate
when a stub src/coreutils binary is present.
Also fix up an incorrect skip_ edge case.
* tests/misc/responsive.sh: Use require_safe_builddir_.
* tests/misc/stdbuf.sh: Likewise.
* tests/misc/exec-bad-unicode.sh: Clarify a comment.
* 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
* doc/coreutils.texi (pr invocation): Avoid the confusing
-COLUMN reference preferring the more standard --columns instead.
Fixes https://bugs.gnu.org/82075
* 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.
When built with --enable-single-binary=symlinks, the process name
(comm) previously contained the path component. Use prog_name instead of
argv[0] to set the correct process name without the path.
Before:
$ src/sleep 10000 &
[1] 601333
$ cat /proc/601333/comm
src/sleep
After:
$ src/sleep 10000 &
[1] 618100
$ cat /proc/618100/comm
sleep
* src/coreutils.c (launch_program): Use the program name instead of
argv[0] when calling prctl (PR_SET_NAME, ...).
Link: https://github.com/coreutils/coreutils/pull/382
oputs_() scans the option text of translated usage strings and passes
each char directly to isspace(). Translated help text routinely holds
bytes >= 0x80, which are negative where char is signed, so isspace() is
called with a value outside its defined domain (unsigned char or EOF),
which is undefined behavior. Route the arguments through to_uchar() as
done for ctype calls elsewhere in src/.
* src/system.h (oputs_): Pass isspace() arguments through to_uchar().
Copyright-paperwork-exempt: Yes
Link: https://github.com/coreutils/coreutils/pull/381
* 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.
* tests/misc/exec-bad-unicode.sh: Avoid stdbuf running non instrumented
binaries, because the LD_PRELOADED libstdbuf.so may then get link errors
due to it not linking with the sanitizer runtime, and neither does
a non instrumented binary. So instead of running $SHELL, avoid the
issue by running our echo binary directly, which should provide
the sanitizer lib. Using our built binary in the shebang also
implicitly checks for problematic whitespace in the path.
Note this pulls in the performance improvement in minigmp,
which was sync'd from the upstream gmplib project, and
completes the performance improvement discussed in v9.12-69-gf23566441
* gnulib: Update to latest.
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.
* src/csplit.c (struct buffer_record): Annotate the input data
area with COUNTED_BY (bytes_alloc).
* src/ptx.c (WORD_TABLE): Annotate the word array with
COUNTED_BY (alloc), moving the count field ahead of the pointer
so the attribute can reference an already-declared field.
Link: https://github.com/coreutils/coreutils/pull/377
Strictly we don't need libacl support to detect ACLs
as that's achieved with xattr lookup. But doing this
will optimize ls and simplify its output, when coreutils
is not built with ACL support.
* src/ls.c (file_aclinfo_cache): Also optimize selinux ENOTSUP caching
when we don't care about ACLs.
configure accepted (and needed) both --without-libsmack
and --disable-libsmack specified, to fully disable support.
* gl/modules/smack: Require gl_FUNC_ACL_ARG so we
use a consistent and single --without-libsmack option.
This also better aligns with --without-selinux.
* NEWS: Mention the Build-related change.
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.
* tests/misc/tty-quoting.sh: Since commit v9.12-10-g782a1e5bc,
env(1) calls isatty() and thus induces another ioctl()
which causes the test to skip. The env(1) is redundant anyway
as strace will avoid shell builtins, so just remove the redundant
env calls.
* src/ls.c (gobble_file): Directory args don't have their
ACL or security context displayed, so avoid to the lookup.
E.g. this results in the same number of xattr calls with
`ls -l .` and `ls -l`.
* tests/ls/getxattr-speedup.sh: Add listxattr calls into the list
to trace/fail so that the test also works on non-SELinux builds.
Also adjust the test to compare call counts with varying number
of files, rather than checking a particular call count limit,
as that is a bit coupled with the implementation.
Link: https://github.com/coreutils/coreutils/pull/368
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.
`pr -e=-1` gives a confusing error relating to just the "-1" portion,
when in fact "=" might have been inadvertently treated as a param.
Also one gets confusing errors in the case of mishandled
multi-byte characters, if the whole argument is not diagnosed.
* src/pr.c (getoptarg): Output the complete passed argument,
to avoid the confusion with "=" being used with a short option.
* tests/pr/options.sh: Adjust accordingly.
Link: https://github.com/coreutils/coreutils/issues/375
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.
Since v9.10 (Feb 2026) --help always outputs bold and hyperlinks
even when output was not a tty, as this was thought more useful
with pagers and grep etc. This change makes the more conservative
choice of only outputting markup to tty so that users who do not
have less setup to display color (-R), or users who enable color
by default in grep, get improved output (though without URLs etc.)
* src/system.h (oputs_): Call isatty() when not
forcing markup with $IN_HELP2MAN. Also reverse the
double negatives to a more natural form.
* man/local.mk: Remove redundant assignment of $TERM.
* doc/coreutils.texi (common options): Mention that --help markup
requires output to be a tty, and that $IN_HELP2MAN overrides that.
* NEWS: Mention the change in behavior.
* NEWS: Mention the crash when invoking various programs --help option
when configured with --disable-bold-man-page-references and
--disable-manual-url.
This crash only occurs when configured with both
--disable-bold-man-page-references and --disable-manual-url.
* src/system.h (oprintf_): Add a va_start and va_end call surrounding
the call to vprintf.
Copyright-paperwork-exempt: Yes