]> git.ipfire.org Git - thirdparty/coreutils.git/log
thirdparty/coreutils.git
2 years agomaint: stop pacifying Parfait
Paul Eggert [Sat, 1 Jul 2023 18:31:40 +0000 (11:31 -0700)] 
maint: stop pacifying Parfait

* src/fmt.c (get_paragraph):
* src/stty.c (display_changed, display_all): Omit calls to
‘assume’ that are present only to pacify false positives by Parfait
<https://labs.oracle.com/pls/apex/f?p=94065:12:17236785746387:13>,
which went in-house in 2012 and never came back.

2 years agobuild: update gnulib submodule to latest
Paul Eggert [Sat, 1 Jul 2023 18:31:40 +0000 (11:31 -0700)] 
build: update gnulib submodule to latest

2 years agomaint: go back to using ‘error’
Paul Eggert [Sat, 1 Jul 2023 18:31:40 +0000 (11:31 -0700)] 
maint: go back to using ‘error’

Now that Gnulib’s ‘error’ module does proper static checking
for not returning, we need no longer use the ‘die’ macro.
This makes code easier to read for people that are used to ‘error’.
* cfg.mk (error_fns, exclude_file_name_regexp): Remove ‘die’.
(sc_die_EXIT_FAILURE): Remove.
* src/die.h: Remove.  All includes removed.  All calls to ‘die’
changed back to calls to ‘error’.
* src/install.c (get_ids): Use quoteaf (problem found with
make syntax-check).
* src/system.h: Include error.h, since some of our macros call ‘error’.
Stop including error.h elsewhere.

2 years agomaint: improve static and dynamic checking
Paul Eggert [Sat, 1 Jul 2023 18:31:40 +0000 (11:31 -0700)] 
maint: improve static and dynamic checking

This modernizes the source code somewhat, to take advantage
of advances in GCC over the years, and Gnulib’s ‘assure’ module.
Include assure.h in files that now need it.
Do not include assert.h directly; it’s no longer needed.
* bootstrap.conf (gnulib_modules): Add ‘assure’.
* gl/lib/randread.c (randread_error):
* src/chmod.c (describe_change):
* src/chown-core.c (describe_change):
* src/cp.c (decode_preserve_arg):
* src/head.c (diagnose_copy_fd_failure):
* src/ls.c (parse_ls_color):
* src/od.c (decode_one_format):
* src/split.c (main):
* src/test.c (binary_operator, posixtest):
Prefer affirm to abort, since it has better diagnostics in the
normal case and better performance with -DNDEBUG.
* gl/lib/xdectoint.c, src/die.h: Include stddef.h, for unreachable.
* gl/lib/xdectoint.c: Do not include verify.h; no longer needed.
* gl/lib/xdectoint.c (__xnumtoint):
* src/die.h (die):
Prefer C23 unreachable () to assume (false).
* gl/lib/xfts.c (xfts_open):
* src/basenc.c (base32hex_encode):
* src/copy.c (abandon_move, copy_internal, valid_options):
* src/cut.c (cut_fields):
* src/df.c (alloc_field, decode_output_arg, get_dev):
* src/du.c (process_file, main):
* src/echo.c (usage):
* src/factor.c (udiv_qrnnd, mod2, gcd2_odd, factor_insert_large)
(mulredc2, factor_using_pollard_rho, isqrt2, div_smallq)
(factor_using_squfof):
* src/iopoll.c (iopoll_internal, fwrite_wait):
* src/join.c (add_field):
* src/ls.c (dev_ino_pop, main, gobble_file, sort_files):
* src/mv.c (do_move):
* src/od.c (decode_format_string, read_block, dump, main):
* src/remove.c (rm):
* src/rm.c (main):
* src/sort.c (stream_open):
* src/split.c (next_file_name, lines_chunk_split):
* src/stdbuf.c (main):
* src/stty.c (set_speed):
* src/tac-pipe.c (line_ptr_decrement, line_ptr_increment):
* src/touch.c (touch):
* src/tr.c (find_bracketed_repeat, get_next)
(validate_case_classes, get_spec_stats, string2_extend, main):
* src/tsort.c (search_item, tsort):
* src/wc.c (main):
Prefer affirm to assert, as it allows for better static
checking when compiling with -DNDEBUG.
* src/chown-core.c (change_file_owner):
* src/df.c (get_field_list):
* src/expr.c (printv, null, tostring, toarith, eval2):
* src/ls.c (time_type_to_statx, calc_req_mask, get_funky_string)
(print_long_format):
* src/numfmt.c (simple_strtod_fatal):
* src/od.c (decode_one_format):
* src/stty.c (mode_type_flag):
* src/tail.c (xlseek):
* src/tr.c (is_char_class_member, get_next, get_spec_stats)
(string2_extend):
Prefer unreachable () to abort () or assert (false) when merely
pacifying the compiler, e.g., in a switch statement on an enum
where all cases are covered.
* src/copy.c (valid_options): Now returns void; the bool was useless.
Caller no longer needs to assert.
* src/csplit.c (find_line):
* src/expand-common.c (next_file):
* src/shred.c (incname):
* src/sort.c (main):
* src/tr.c (append_normal_char, append_range, append_char_class)
(append_repeated_char, append_equiv_class):
* src/tsort.c (search_item):
Omit assert, since the hardware will check for us.
* src/df.c (header_mode): Now the enum type it should have been.
* src/du.c (process_file):
* src/ls.c (assert_matching_dev_ino):
* src/tail.c (valid_file_spec):
* src/tr.c (validate_case_classes):
Mark defns with MAYBE_UNUSED if they’re not used when -DNDEBUG.
* src/factor.c (prime_p, prime2_p, mp_prime_p): Now ATTRIBUTE_PURE.
Prefer affirm to error+abort.  No need to translate this diagnostic.
* src/fmt.c (get_paragraph):
* src/stty.c (display_changed, display_all, sane_mode):
* src/who.c (idle_string):
Prefer assume to assert, since the goal is merely pacification
and assert doesn’t pacify anyway if -DNDEBUG is used.
* src/join.c (decode_field_spec):
Omit unreachable abort.
* src/ls.c (assert_matching_dev_ino, main):
* src/tr.c (get_next):
Prefer assure to assert, since the check is relatively expensive
and won’t help static analysis.
* src/ls.c (main):
Prefer static_assert to assert of a constant expression.
(format_inode): Redo to make it clear that buflen doesn’t matter,
and that buf must have a certain number of bytes.  All callers changed.
This pacifies -Wformat-overflow.
* src/od.c (decode_one_format):
Omit an assert that tested for obviously undefined behavior,
as the compiler could optimize it away anyway.
* src/od.c (decode_one_format, decode_format_string):
Prefer ATTRIBUTE_NONNULL to runtime checking.
* src/stat.c: Do not include <stddef.h> since system.h does that now.
* src/sync.c (sync_arg):
Prefer unreachable () to assert (true), which was a typo.
* src/system.h: Include stddef.h, for unreachable.
* src/tail.c (xlseek): Simplify by relying on ‘error’ to exit.

2 years agomaint: fix indenting in previous change
Paul Eggert [Sat, 1 Jul 2023 18:31:40 +0000 (11:31 -0700)] 
maint: fix indenting in previous change

* src/ptx.c: Adjust to fit into 80 columns.

2 years agomaint: prefer C23-style nullptr
Paul Eggert [Thu, 29 Jun 2023 22:27:21 +0000 (15:27 -0700)] 
maint: prefer C23-style nullptr

* bootstrap.conf (gnulib_modules): Add nullptr.
In code, prefer nullptr to NULL where either will do.

2 years agobuild: ensure that makeinfo ≥ 6.8 checks the @menu structure
Bruno Haible [Thu, 22 Jun 2023 21:59:11 +0000 (23:59 +0200)] 
build: ensure that makeinfo ≥ 6.8 checks the @menu structure

See <https://lists.gnu.org/r/bug-texinfo/2023-06/msg00015.html>.

* doc/local.mk (MAKEINFO): New variable.
* cfg.mk (_makefile_at_at_check_exceptions): Update.

2 years agob2sum: fix UAR with --check with malformed checksum lines
Pádraig Brady [Thu, 22 Jun 2023 20:33:58 +0000 (21:33 +0100)] 
b2sum: fix UAR with --check with malformed checksum lines

* src/digest.c (split_3): Reinstate the check for whitespace after the
digest portion of the line, so that we exit early before inspecting
the file name which would be outside the passed buffer in the case
where the input does not contain a newline.
* tests/cksum/b2sum.sh: Add a test case.
* NEWS: Mention the bug fix.
* THANKS.in: Add Frank Busse who has reported multiple bugs using KLEE.
Fixes https://bugs.gnu.org/64229

2 years agomaint: update GCC bug number in comment
Paul Eggert [Wed, 21 Jun 2023 07:08:21 +0000 (00:08 -0700)] 
maint: update GCC bug number in comment

2 years agodoc: mention fix for bug#64123
Paul Eggert [Tue, 20 Jun 2023 06:23:39 +0000 (23:23 -0700)] 
doc: mention fix for bug#64123

2 years agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 19 Jun 2023 21:17:32 +0000 (14:17 -0700)] 
build: update gnulib submodule to latest

2 years agotests: move tests to a directory per utility
Sylvestre Ledru [Sun, 11 Jun 2023 09:55:56 +0000 (11:55 +0200)] 
tests: move tests to a directory per utility

* cfg.mk: Adjust syntax check exclusion paths.
* tests/local.mk: Adjust for renamed tests.

2 years agodoc: mention cksum error fix with cpu feature checks changes
Pádraig Brady [Wed, 14 Jun 2023 23:53:54 +0000 (00:53 +0100)] 
doc: mention cksum error fix with cpu feature checks changes

* NEWS: Mention the error message to aid those searching
for solutions to the issue, and mention cksum also
as that was confirmed to fix the error with the adjusted
cpu feature detection, as discussed at https://bugs.debian.org/1037264
* src/cksum.c: Cleanup syntax-check failure from previous commit.

2 years agocksum,wc: clean up hw capability checking
Paul Eggert [Wed, 14 Jun 2023 21:52:37 +0000 (14:52 -0700)] 
cksum,wc: clean up hw capability checking

* src/cksum.c (cksum_pclmul) [!CRCTAB && !USE_PCLMUL_CRC32]:
Remove macro.
(cksum_fp): No longer file-scope.
(pclmul_supported): Define only if USE_PCLMUL_CRC32.
This omits the debug output "using generic hardware support"
for simplicity and consistency with wc’s output.
(crc_sum_stream) [!USE_PCLMUL_32]: No need for static function pointer.
* src/wc.c (wc_lines_p) [USE_AVX2_WC_LINECOUNT]: No longer file-scope.
(wc) [USE_AVX2_WC_LINECOUNT]: Check for avx2 support at most once,
which was surely the code’s original intent.
(wc) [!USE_AVX2_WC_LINECOUNT]: No need for static function pointer.

2 years agocksum,wc: don’t include <cpuid.h>
Paul Eggert [Wed, 14 Jun 2023 21:18:42 +0000 (14:18 -0700)] 
cksum,wc: don’t include <cpuid.h>

* src/cksum.c [!CRCTAB && USE_PCLMUL_CRC32]:
* src/wc.c [USE_AVX2_WC_LINECOUNT]:
Don’t include <cpuid.h>; no longer needed.

2 years agocksum: fix bug in check for cksum_pclmul
Paul Eggert [Wed, 14 Jun 2023 21:13:35 +0000 (14:13 -0700)] 
cksum: fix bug in check for cksum_pclmul

This fixes a typo in the previous patch.
Problem reported by Pádraig Brady <https://bugs.gnu.org/64058#11>.
* src/cksum.c (pclmul_supported): Also require AVX support
to use cksum_pclmul.

2 years agowc: port to kernels that disable XSAVE YMM
Paul Eggert [Wed, 14 Jun 2023 04:10:24 +0000 (21:10 -0700)] 
wc: port to kernels that disable XSAVE YMM

Problem reported by Dave Hansen <https://bugs.gnu.org/64058>.
Apply similar change to cksum and pclmul, too.
* NEWS: Mention wc fix.
* configure.ac (cpuid_exists, get_cpuid_count_exists):
Remove.  All uses removed, since we no longer use __get_cpuid or
__get_cpuid_count.
(pclmul_intrinsic_exists, avx2_intrinsic_exists): Set to no if
__builtin_cpu_supports calls cannot be compiled.
(HAVE_PCLMUL_INTRINSIC, HAVE_AVX2_INTRINSIC): Remove; unused.
Simplify surrounding code because of this.
* src/cksum.c (pclmul_supported):
* src/wc.c (avx2_supported):
Use __builtin_cpu_supports instead of doing it by hand.
Simplify surrounding code because of this.

2 years agodircolors: update list of backup file extensions
Ville Skyttä [Mon, 12 Jun 2023 20:27:37 +0000 (23:27 +0300)] 
dircolors: update list of backup file extensions

* src/dircolors.hin: Sort backup section by extension.
Treat .dpkg-new and .dpkg-tmp as backup files.
Treat .crdownload (Chromium based browsers' partial download)
as a backup file.

2 years agodd: fix parsing of numbers with more than two multipliers
Pádraig Brady [Sat, 10 Jun 2023 13:18:00 +0000 (14:18 +0100)] 
dd: fix parsing of numbers with more than two multipliers

* src/dd.c (parse_integer): Use recursion to support more than two
multipliers.  Also protect suffix[-1] access to ensure we don't
inspect before the passed string.
* tests/dd/bytes.sh: Add test cases.
* doc/coreutils.texi (dd invocation): Note the support for specifying
many multipliers in a number.
* NEWS: Mention the bug fix.
Fixes https://bugs.debian.org/1037275

2 years agobuild: update gnulib submodule to latest
Pádraig Brady [Fri, 9 Jun 2023 10:14:51 +0000 (11:14 +0100)] 
build: update gnulib submodule to latest

* gnulib: Update to latest.
* po/POTFILES.in: Remove recent sc_po_check workaround.
* tests/misc/date-debug.sh: Adjust as per spelling fix.

2 years agodoc: od --strings: clarify operation
Pádraig Brady [Thu, 8 Jun 2023 09:58:10 +0000 (10:58 +0100)] 
doc: od --strings: clarify operation

* doc/coreutils.texi (od invocation): Remove mention of ASCII,
as all printable characters in unibyte locales are output.
* src/od.c (usage): Clarify that only NUL terminated strings
are displayed, and that it's printable chars, not only graphic chars
that are output. I.e., spaces are output also if part of the string.
Reported at https://bugs.ddebian.org/1037217

2 years agomaint: ls.c: update stale comment for previous commit
Pádraig Brady [Wed, 7 Jun 2023 20:51:47 +0000 (21:51 +0100)] 
maint: ls.c: update stale comment for previous commit

* src/ls.c (gobble_file): Update comment to correspond with
the changes in the previous commit.

2 years agols: display command line symlinks that return ELOOP
Pádraig Brady [Wed, 7 Jun 2023 12:42:36 +0000 (13:42 +0100)] 
ls: display command line symlinks that return ELOOP

* src/ls.c (gobble_file): Ensure we lstat() a symlink
specified on the command line, if we receive ELOOP from stat().
* tests/ls/symlink-loop.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/63931

2 years agols: use more standard symlink traversal
Pádraig Brady [Wed, 7 Jun 2023 11:32:46 +0000 (12:32 +0100)] 
ls: use more standard symlink traversal

* src/ls.c (gobble_file): stat() symlinks directly,
rather than their targets.  This will be more consistent
with how symlinks are generally accessed.
(make_link_name): Remove no longer used function.
Addresses https://bugs.gnu.org/63931

2 years agodoc: reference COPYING from README
Pádraig Brady [Wed, 7 Jun 2023 14:11:13 +0000 (15:11 +0100)] 
doc: reference COPYING from README

* README: Reference COPYING as per the GNU coding standards,
and soon to be enforced with a syntax-check from gnulib.

2 years agomaint: avoid syntax-check failure
Pádraig Brady [Tue, 6 Jun 2023 10:33:20 +0000 (11:33 +0100)] 
maint: avoid syntax-check failure

* po/POTFILES.in: Add lib/propername.h due to new comments
that trigger sc_po_check.

2 years agodoc: NEWS: mention the more defensive copy_file_range avoidance
Pádraig Brady [Tue, 6 Jun 2023 10:12:28 +0000 (11:12 +0100)] 
doc: NEWS: mention the more defensive copy_file_range avoidance

* NEWS: Mention the improvement in reinstating runtime avoidance
of copy_file_range(), that came with the last gnulib update,
picking up gnulib commit fb034b35.

2 years agobuild: update gnulib submodule to latest
Paul Eggert [Tue, 6 Jun 2023 05:38:20 +0000 (22:38 -0700)] 
build: update gnulib submodule to latest

2 years agomaint: use consistent make variable interpolation syntax
Pádraig Brady [Thu, 1 Jun 2023 12:19:24 +0000 (13:19 +0100)] 
maint: use consistent make variable interpolation syntax

* cfg.mk: Prefer $() interpolation over ${}
lest the reader is confused as to whether shell interpolation,
i.e. $${} was intended.

2 years agosplit: --additional-suffix: disallow trailing '/'
Pádraig Brady [Sun, 28 May 2023 14:17:46 +0000 (15:17 +0100)] 
split: --additional-suffix: disallow trailing '/'

Note mktemp --suffix has the same inconsistency,
but mktemp -d does support creating dirs
so probably best to leave that as is.

* src/split.c (main): Check for trailing /.
* tests/split/additional-suffix.sh: Augment the test.
Reported in https://bugs.debian.org/1036827

2 years agomaint: adjust code to handle "error" syntax-check changes
Pádraig Brady [Wed, 31 May 2023 16:21:08 +0000 (17:21 +0100)] 
maint: adjust code to handle "error" syntax-check changes

* src/dd.c: Don't include no longer used error.h.
Use quoteaf() rather than quote() to quote appropriate for the shell
and to avoid the syntax-check failure,
* src/stty.c: Use quoteaf() rather than quotef()
to have more consistent quoting of the invalid arg.

2 years agomaint: augment syntax checks to cater for more "error" functions
Pádraig Brady [Wed, 31 May 2023 16:12:52 +0000 (17:12 +0100)] 
maint: augment syntax checks to cater for more "error" functions

src/cfg.mk (sc_error_quotes, sc_error_shell_quotes,
sc_error_shell_always_quotes): Include "die" and "diagnose"
in the class of error functions to check arguments for.

2 years agodd: fix ‘error’ name issue without macros
Paul Eggert [Tue, 30 May 2023 21:24:46 +0000 (14:24 -0700)] 
dd: fix ‘error’ name issue without macros

* src/dd.c (_GL_NO_INLINE_ERROR): Remove; no longer needed.
(diagnose): Rename from nl_error and omit first arg since it is
always zero.  All uses changed.
(error): Remove macro.

2 years agobuild: update gnulib submodule to latest
Pádraig Brady [Sun, 28 May 2023 13:54:01 +0000 (14:54 +0100)] 
build: update gnulib submodule to latest

* gnulib: Update to latest.
* src/dd.c: Avoid error macro redefinition.

2 years agobuild: modernize bootstrap prerequsite tools
Pádraig Brady [Fri, 19 May 2023 21:16:22 +0000 (22:16 +0100)] 
build: modernize bootstrap prerequsite tools

Following on from commit v9.0-15-gaa31b919c
which updated README-prereq...

* bootstrap.conf: Add an explicit requirement on m4.
Add an explicit requirement on texi2pdf which is often
packaged separately to makeinfo and induces a failure
far down the distribution phase if not present.
Replace the rsync dependency with wget,
which gnulib changed to in 2018.

2 years agobuild: update gnulib submodule to latest
Pádraig Brady [Fri, 19 May 2023 17:18:08 +0000 (18:18 +0100)] 
build: update gnulib submodule to latest

* gnulib: Update to latest.
* configure.ac: Remove gnulib reference, as that specific issue
is now explicitly avoided in gnulib itself.

2 years agobuild: pacify GCC 13 with -flto
Pádraig Brady [Fri, 19 May 2023 10:30:31 +0000 (11:30 +0100)] 
build: pacify GCC 13 with -flto

* src/cut.c (cut_file): Explicitly mark STREAM as nonnull to avoid
-Werror=null-dereference.
* src/nl.c (nl_file): Likewise.

2 years agobuild: revert -Wmaybe-uninitialized warnings avoidance
Pádraig Brady [Fri, 19 May 2023 06:57:36 +0000 (07:57 +0100)] 
build: revert -Wmaybe-uninitialized warnings avoidance

This reverts commit 800c86d5, as that was deemed too invasive.
We do keep the change to tee.c to allow using -O3 without warnings.
For other optimization options like -O0, -Og, -O1, -Os,
one can use WERROR_CFLAGS= to stop warnings inducing a build failure.

2 years agobuild: avoid false -Wmaybe-uninitialized warnings
Pádraig Brady [Thu, 18 May 2023 09:38:11 +0000 (10:38 +0100)] 
build: avoid false -Wmaybe-uninitialized warnings

Allow easily building a debug build for example with:
  make CFLAGS='-O0 -ggdb'

False -Wmaybe-uninitialized warnings hit in different
places depending on the compiler passes used.
These changes were tested with gcc 10.2.1, 12.2.1, and 13.1.1 like:
  for o in g s z fast 0 1 2 3; do
    make clean && make -j$(nproc) CFLAGS="-O$o" || break
  done

* src/digest.c: Disable -Wmaybe-uninitialized that gives
false positive here at -O0.
* src/ln.c: Avoid -Wmaybe-uninitialized that gives
false positive here at -O1.
* src/pr.c: Likewise.
* src/sort.c: Likewise.
* src/tee.c: Avoid -Wmaybe-uninitialized that gives
false positive here at -O3 on gcc 13.1.1 at least.
* src/cp.c: Avoid -Wmaybe-uninitialized that gives
false positive here at -Os on gcc 13.1.1 at least.
* src/copy.c: Avoid -Wmaybe-uninitialized that gives
false positive here at -Og on gcc 13.1.1 at least.
* src/head.c: Likewise.
* src/paste.c: Likewise.

2 years agobuild: gnulib: avoid false -Wstringop-overflow warning
Pádraig Brady [Thu, 18 May 2023 10:40:19 +0000 (11:40 +0100)] 
build: gnulib: avoid false -Wstringop-overflow warning

Tested on gcc 13.1.1 with: make CFLAGS='-O0 -ggdb'

* configure.ac: Disable -Wstringop-overflow for gnulib.
This warning is far too problematic in my experience:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88443
and triggers with gcc -O0 with versions 12,13 at least.

2 years agomaint: cleanups to NEWS
Pádraig Brady [Sat, 13 May 2023 09:33:14 +0000 (10:33 +0100)] 
maint: cleanups to NEWS

* NEWS: Use more consistent wording, ordering, and formatting
for recent entries.

2 years agosplit: advise the kernel of sequential access pattern
Pádraig Brady [Mon, 8 May 2023 20:22:48 +0000 (21:22 +0100)] 
split: advise the kernel of sequential access pattern

As split is often dealing with large files,
ensure we indicate to the kernel our sequential access pattern.
This was seen to operate 5% faster when reading from SSD,
as tested with:

dd bs=1M count=2K if=/dev/urandom of=big.in

for split in split.orig split; do
  # Ensure big file is not cached
  dd of=big.in oflag=nocache conv=notrunc,fdatasync count=0 status=none
  # Test read efficiency
  CWD=$PWD; (cd /dev/shm && time $CWD/src/$split -n2 $CWD/big.in)
done

real    0m9.039s
user    0m0.055s
sys     0m3.510s

real    0m8.568s
user    0m0.056s
sys     0m3.752s

* src/split.c (main): Use fdadvise to help the kernel
choose a more appropriate readahead buffer.
* NEWS: Mention the improvement.

2 years agodoc: adjust build instructions for disabling year 2038 support
Pádraig Brady [Mon, 8 May 2023 11:57:56 +0000 (12:57 +0100)] 
doc: adjust build instructions for disabling year 2038 support

* README-install: Adjust the instructions as per recent gnulib updates.

2 years agobuild: update gnulib submodule to latest
Bernhard Voelker [Sun, 7 May 2023 15:33:49 +0000 (17:33 +0200)] 
build: update gnulib submodule to latest

This fixes failures in "very-expensive" tests on FTS with many
directory entries:
  FAIL: tests/rm/ext3-perf
  FAIL: tests/rm/many-dir-entries-vs-OOM

The following shows the problem in the former of the above tests:
  $ mkdir d && seq 400000 | env -C d xargs touch )
  $ rm -rf d
  rm: traversal failed: d: Operation not supported

Gnulib commit 3f0950f65abb (2023-04-26) introduced this regression
which was fixed again with gnulib commit d4d8abb39eb0.

See discussion in
<https://lists.gnu.org/r/bug-gnulib/2023-05/msg00040.html>

* bootstrap.conf (gnulib_modules): Change "year2038-required" to
"year2038-recommended"; the module has been replaced.
* gnulib: Update to latest.
* tests/init.sh: Likewise.

2 years agodoc: time zone conversion example
Paul Eggert [Sun, 7 May 2023 16:16:29 +0000 (09:16 -0700)] 
doc: time zone conversion example

* doc/coreutils.texi (Examples of date):
Give time zone conversion example.

2 years agodoc: new subsection for date format specs
Paul Eggert [Sun, 7 May 2023 15:59:01 +0000 (08:59 -0700)] 
doc: new subsection for date format specs

* doc/coreutils.texi (Date format specifiers): New subsection,
which groups the date format specifiers without otherwise
changing contents.

2 years agopr: fix parsing of empty arguments
Pádraig Brady [Sat, 6 May 2023 10:22:22 +0000 (11:22 +0100)] 
pr: fix parsing of empty arguments

Before:
  $ pr --expand-tabs=
  pr: '-e' extra characters or invalid number in the argument:
   ‘SHELL=/bin/bash’: Value too large for defined data type

After:
  $ pr --expand-tabs=
  pr: '-e': Invalid argument: ‘’

* src/pr.c (getoptarg): Ensure we don't parse beyond the
end of an empty argument, thus outputting arbitrary stack
info in subsequent error messages.

Addresses https://bugs.debian.org/1035596

2 years agocp: -p --parents: minor cleanup of previous patch
Paul Eggert [Fri, 5 May 2023 18:03:25 +0000 (11:03 -0700)] 
cp: -p --parents: minor cleanup of previous patch

This doesn’t change behavior; it just clarifies the code a bit.
* src/cp.c (re_protect): New arg DST_SRC_NAME, for clarity, and so
that we need to skip '/'s only once.  Caller changed.
Rename a couple of local variables to try to make things clearer.

2 years agocp: -p --parents: fix failure to preserve permissions for absolute paths
Pádraig Brady [Wed, 3 May 2023 16:01:37 +0000 (17:01 +0100)] 
cp: -p --parents: fix failure to preserve permissions for absolute paths

* src/cp.c (re_protect): Ensure copy_acl() is passed an absolute path.
* tests/cp/cp-parents.sh: Add a test case.
* NEWS: Mention the bug.
Fixes https://bugs.gnu.org/63245

2 years agotests: provide more info on DEBUG=yes
Pádraig Brady [Tue, 2 May 2023 21:39:03 +0000 (22:39 +0100)] 
tests: provide more info on DEBUG=yes

* README: State that DEBUG=yes is particularly useful with perl tests.
* tests/split/l-chunk.sh: Use the more standard $DEBUG variable
rather than an internal $DEBUGGING variable.

2 years agodoc: provide more info on the default 32-bit cksum digest
Pádraig Brady [Sun, 30 Apr 2023 21:10:25 +0000 (22:10 +0100)] 
doc: provide more info on the default 32-bit cksum digest

* doc/coreutils.texi (cksum invocation): Say that the default
digest format is 32-bit and based on the Ethernet standard CRC.

2 years agomaint: remove redundant exit status handling
Pádraig Brady [Sun, 30 Apr 2023 12:05:12 +0000 (13:05 +0100)] 
maint: remove redundant exit status handling

* src/numfmt.c: Remove redundant / confusing
use of TIMEOUT_FAILURE.

2 years agomaint: simplify --enable-gcc-warnings='expensive'
Paul Eggert [Thu, 27 Apr 2023 00:14:54 +0000 (17:14 -0700)] 
maint: simplify --enable-gcc-warnings='expensive'

* configure.ac (WERROR_CFLAGS): Omit mention of
-Wno-analyzer-double-free, -Wno-analyzer-null-dereference, and
-Wno-analyzer-use-after-free as manywarnings no longer uses them.

2 years agomaint: suppress GCC 13 false alarms
Paul Eggert [Thu, 27 Apr 2023 00:14:54 +0000 (17:14 -0700)] 
maint: suppress GCC 13 false alarms

* src/csplit.c, src/fmt.c, src/make-prime-list.c, src/nohup.c:
Add pragmas to pacify GCC 13 when coreutils is configured
with --enable-gcc-warnings='expensive'.

2 years agochmod: pacify GCC 13
Paul Eggert [Thu, 27 Apr 2023 00:14:54 +0000 (17:14 -0700)] 
chmod: pacify GCC 13

* src/chmod.c (main): Use xpalloc instead of X2REALLOC,
and make the corresponding variables signed instead of unsigned.
When reallocating the buffer, this grows it by a factor of 1.5, not 2.
This also pacifies gcc -Wanalyzer-null-dereference.

2 years agocsplit: pacify GCC 13
Paul Eggert [Thu, 27 Apr 2023 00:14:54 +0000 (17:14 -0700)] 
csplit: pacify GCC 13

* src/csplit.c (load_buffer): Refactor for clarity.
This also xpacifies gcc -Wanalyzer-use-of-uninitialized-value.
When reallocating the buffer, grow it by a factor of 1.5, not 2.

2 years agobuild: update gnulib submodule to latest
Paul Eggert [Thu, 27 Apr 2023 00:14:54 +0000 (17:14 -0700)] 
build: update gnulib submodule to latest

2 years agotests: more cases for read input diagnostics
Pádraig Brady [Wed, 26 Apr 2023 15:20:50 +0000 (16:20 +0100)] 
tests: more cases for read input diagnostics

* tests/misc/read-errors.sh: Exercise more modes of
various utilities for better read error coverage.
* tests/split/fail.sh: Remove part refactored into the above test.

2 years agouniq: be more specific when diagnosing read errors
Pádraig Brady [Wed, 26 Apr 2023 14:20:47 +0000 (15:20 +0100)] 
uniq: be more specific when diagnosing read errors

* src/uniq.c (check_file): Use the errno when diagnosing read errors.

2 years agobuild: fix build with -mno-ssse3
Jaroslav Skarvada [Wed, 26 Apr 2023 12:48:41 +0000 (13:48 +0100)] 
build: fix build with -mno-ssse3

Avoid the following error with -mno-ssse3:
 inlining failed in call to 'always_inline' '_mm_shuffle_epi8':
 target specific option mismatch

* configure.ac: Ensure we use ssse3 specific code when
checking whether to enable the pclmul cksum implementation.

2 years agopr: fix infinite loop when double spacing
Pádraig Brady [Tue, 25 Apr 2023 13:07:03 +0000 (14:07 +0100)] 
pr: fix infinite loop when double spacing

* src/pr.c (init_parameters): Ensure we avoid a 0 lines_per_body
which was possible when adjusting for double spacing.
That caused print_page() to always return true,
causing an infinite loop.
* tests/pr/pr-tests.pl: Add a test case.
* NEWS: Mention the fix.
Fixes https://bugs.debian.org/1034808

2 years agocopy: reduce verbosity of -i and -u with --verbose
Pádraig Brady [Tue, 25 Apr 2023 10:07:36 +0000 (11:07 +0100)] 
copy: reduce verbosity of -i and -u with --verbose

Since skipping of files is central to the operation of -i and -u,
and with -u one may be updating few files out of many,
reinstate the verbosity of this functionality as it was before 9.3.

* src/copy.c (copy_internal): Only output "skipped" message
with --debug.  Also adjust so message never changes with --debug.
* tests/cp/cp-i.sh: Adjust accordingly.
* tests/mv/mv-n.sh: Likewise.
* tests/cp/debug.sh: Add explicit test case for message.
* NEWS: Mention the change in behavior.

2 years agotests: ensure all utilities that read input diagnose errors
Pádraig Brady [Sat, 22 Apr 2023 20:35:23 +0000 (21:35 +0100)] 
tests: ensure all utilities that read input diagnose errors

* tests/misc/read-errors.sh: Add a new test.
* tests/misc/date-f.sh: Remove unneeded test.
* tests/misc/dircolors.sh: Likewise.
* tests/local.mk: Reference new test, and dereference removed ones.

2 years agofactor: diagnose errors reading the input
Pádraig Brady [Sun, 23 Apr 2023 22:45:08 +0000 (23:45 +0100)] 
factor: diagnose errors reading the input

* src/factor.c (do_stdin): Exit with failure upon read errors.
* NEWS: Mention the bug fix.

2 years agonumfmt: diagnose errors reading the input
Pádraig Brady [Sat, 22 Apr 2023 20:48:51 +0000 (21:48 +0100)] 
numfmt: diagnose errors reading the input

* src/numfmt.c (main): Exit with failure upon read errors.
* NEWS: Mention the bug fix.

2 years agotsort: diagnose errors reading the input
Pádraig Brady [Sat, 22 Apr 2023 20:41:53 +0000 (21:41 +0100)] 
tsort: diagnose errors reading the input

* src/tsort.c (tsort): Check for errors after readtoken().
* NEWS: Mention the bug fix.

2 years agocksum: fix failure to diagnose read errors with crc32
Pádraig Brady [Sat, 22 Apr 2023 14:59:48 +0000 (15:59 +0100)] 
cksum: fix failure to diagnose read errors with crc32

The default crc32 mode fails to diagnose read errors.

* src/cksum.c (cksum_slice8): Fix the check for read errors.
(cksum_pclmul): Likewise.
* NEWS: Mention the bug fix.

2 years agotests: avoid failure when cp fails for proc files
Andreas Schwab [Mon, 24 Apr 2023 08:15:01 +0000 (10:15 +0200)] 
tests: avoid failure when cp fails for proc files

When run under QEmu emulation emulated /proc files have
unstable inode numbers.

* tests/cp/proc-short-read.sh: Skip if unstable inode numbers detected.

2 years agoinstall: support stripping files with a leading hyphen
Pádraig Brady [Fri, 21 Apr 2023 18:07:02 +0000 (19:07 +0100)] 
install: support stripping files with a leading hyphen

* src/install.c (strip): Prepend "./" to file names with a leading "-".
* tests/install/strip-program.sh: Add a test case.
* NEWS: Mention the bug fix.
Reported in https://bugs.debian.org/1034429

2 years agomaint: post-release administrivia
Pádraig Brady [Tue, 18 Apr 2023 14:32:53 +0000 (15:32 +0100)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

2 years agoversion 9.3 v9.3
Pádraig Brady [Tue, 18 Apr 2023 14:08:11 +0000 (15:08 +0100)] 
version 9.3

* NEWS: Record release date.

2 years agotests: avoid allocation checks on ZFS
Pádraig Brady [Sat, 15 Apr 2023 21:19:06 +0000 (22:19 +0100)] 
tests: avoid allocation checks on ZFS

* tests/du/basic.sh: Allocation of files was seen to change
asynchronously on ZFS, so avoid allocation comparisons there.

2 years agotests: tty-eof: fix various issues
Pádraig Brady [Tue, 11 Apr 2023 12:02:21 +0000 (13:02 +0100)] 
tests: tty-eof: fix various issues

* tests/misc/tty-eof.pl: Ensure we don't erroneously
skip commands with parameters.
Comment as to why cut(1) is treated differently.
Adjust expect calls to not wait needlessly for cut output.

2 years agotests: avoid dependence on file layout for cp sparse check
Pádraig Brady [Wed, 12 Apr 2023 13:37:00 +0000 (14:37 +0100)] 
tests: avoid dependence on file layout for cp sparse check

* tests/cp/sparse-2.sh: Don't depend on the copy taking
<= allocation of the source.  Instead leverage --debug
to check that zero detection is being enabled.

2 years agocopy: --debug: indicate if NUL detection is used with SEEK_HOLE
Pádraig Brady [Thu, 13 Apr 2023 12:15:31 +0000 (13:15 +0100)] 
copy: --debug: indicate if NUL detection is used with SEEK_HOLE

* src/copy.c (sparse_copy): With --sparse=always we also detect
NULs in extents we're copying, so indicate this with --debug.

2 years agodoc: update re 32-bit builds
Paul Eggert [Mon, 10 Apr 2023 18:55:54 +0000 (11:55 -0700)] 
doc: update re 32-bit builds

* README-install: Mention how to build on 32-bit-only hosts.
This builds on a previous patch by Pádraig Brady.

2 years agobuild: fix _Noreturn compilation failure
Pádraig Brady [Mon, 10 Apr 2023 18:36:23 +0000 (19:36 +0100)] 
build: fix _Noreturn compilation failure

Fix a build failure seen on gcc 3.4 on Solaris 10 at least.

* src/crctab.c: Ensure we include config.h for all compilation units.
This is now required for new _Noreturn usage in gnulib for stdint.h.
* src/cksum.c: Update generation code to ensure config.h included.
* cfg.mk: Remove crctab.c exclusion from the config.h check.

2 years agotests: avoid non portable brace expansion
Pádraig Brady [Mon, 10 Apr 2023 17:51:34 +0000 (18:51 +0100)] 
tests: avoid non portable brace expansion

* tests/cp/backup-dir.sh: Avoid non portable brace expansion
which is not supported by FreeBSD or Solaris shells at least.

2 years agomaint: require support for post-2038 timestamps
Paul Eggert [Mon, 10 Apr 2023 02:18:57 +0000 (19:18 -0700)] 
maint: require support for post-2038 timestamps

* bootstrap.conf (gnulib_modules): Replace year2038 with
year2038-required.

2 years agobuild: update gnulib submodule to latest
Paul Eggert [Mon, 10 Apr 2023 01:30:00 +0000 (18:30 -0700)] 
build: update gnulib submodule to latest

2 years agowc: ensure we update file offset
Pádraig Brady [Sun, 5 Feb 2023 19:52:31 +0000 (19:52 +0000)] 
wc: ensure we update file offset

* src/wc.c (wc): Update the offset when not reading,
and do read if we can't update the offset.
* tests/misc/wc-proc.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/61300

2 years agocp,mv: issue "skipped" messages when skipping files
Pádraig Brady [Fri, 7 Apr 2023 09:25:41 +0000 (10:25 +0100)] 
cp,mv: issue "skipped" messages when skipping files

* NEWS: Mention the change in behavior to issue a "not replaced"
error diagnostic with -n, and the "skipped" message with -v.
* src/copy.c (copy_internal): Adjust to output the "skipped" messages
depending on -i, -n, -u.
* tests/cp/cp-i.sh: Adjust accordingly.
* tests/mv/mv-n.sh: Likewise.

2 years agocp,mv: add --update=none to always skip existing files
Pádraig Brady [Sat, 1 Apr 2023 15:27:52 +0000 (16:27 +0100)] 
cp,mv: add --update=none to always skip existing files

Add --update=none which is equivalent to the --no-clobber behavior
from before coreutils 9.2.  I.e. existing files are unconditionally
skipped, and them not being replaced does not affect the exit status.

* src/copy.h [enum Update_type]: A new type to support parameters
to the --update command line option.
[enum Interactive]: Add I_ALWAYS_SKIP.
* src/copy.c: Treat I_ALWAYS_SKIP like I_ALWAYS_NO (-n),
except that we don't fail when skipping.
* src/system.h (emit_update_parameters_note): A new function
to output the description of the new --update parameters.
* src/cp.c (main): Parse --update arguments, ensuring that
-n takes precedence if specified.
(usage): Describe the new option.  Also allude that
-u is related in the -n description.
* src/mv.c: Accept the new --update parameters and
update usage() accordingly.
* doc/coreutils.texi (cp invocation): Describe the new --update
parameters.  Also reference --update from the --no-clobber description.
(mv invocation): Likewise.
* tests/mv/update.sh: Test the new parameters.
* NEWS: Mention the new feature.
Addresses https://bugs.gnu.org/62572

2 years agocp: fix --backup with subdirectories
Pádraig Brady [Mon, 3 Apr 2023 17:12:33 +0000 (18:12 +0100)] 
cp: fix --backup with subdirectories

* gnulib: Reference the latest gnulib including the
fix to the backupfile module in commit 94496522.
* tests/cp/backup-dir.sh: Add a test to ensure
we rename appropriately when backing up through subdirs.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/62607

2 years agotests: tee: avoid false failure due to fifo usage
Pádraig Brady [Thu, 30 Mar 2023 14:49:26 +0000 (15:49 +0100)] 
tests: tee: avoid false failure due to fifo usage

* tests/misc/tee.sh: Call cleanup_ in all cases to ensure
there are no overlapping interactions on the fifo that
might impact later parts of the test.  This was seen to
cause issue with dash on musl libc.
Addresses https://bugs.gnu.org/62542

2 years agotests: adjust csplit VM limit
Pádraig Brady [Thu, 30 Mar 2023 13:28:03 +0000 (14:28 +0100)] 
tests: adjust csplit VM limit

* tests/misc/csplit-heap.sh: More memory is required to avoid
a false failure on some systems.  Noticed with musl libc
with bash as the shell.  This is confirmed to still easily
trigger with the original memory leak being tested.
Addresses https://bugs.gnu.org/62542

2 years agowc: diagnose overflow of total counts
Pádraig Brady [Wed, 29 Mar 2023 14:29:52 +0000 (15:29 +0100)] 
wc: diagnose overflow of total counts

* src/wc.c (wc): Use INT_ADD_WRAPV() to detect overflow.
(main): Upon overflow, saturate the total, print a diagnostic,
and set exit status.
* tests/misc/wc-total.sh: Add a test case, which operates
on BTRFS and 64 bit systems at least.
Reported at https://bugs.debian.org/1027100

2 years agodircolors: diagnose read errors
Pádraig Brady [Tue, 28 Mar 2023 13:24:29 +0000 (14:24 +0100)] 
dircolors: diagnose read errors

* NEWS: Mention the fix.
* src/dircolors.c: Fail upon read error from getline().
* tests/misc/dircolors.sh: Add a new test.
* tests/local.mk: Reference the new test.

2 years agotests: add a test case for the previous date fix
Pádraig Brady [Tue, 28 Mar 2023 12:38:52 +0000 (13:38 +0100)] 
tests: add a test case for the previous date fix

* NEWS: Also mention this bug fix.
* tests/misc/date-f.sh: Add a new test.
* tests/local.mk: Reference the new test.

2 years agodate: diagnose -f read errors
Paul Eggert [Tue, 28 Mar 2023 08:52:43 +0000 (01:52 -0700)] 
date: diagnose -f read errors

* src/date.c (batch_convert): Diagnose read errors, fixing Bug#62497.

2 years agocp: clarify commentary
Paul Eggert [Sat, 25 Mar 2023 16:30:22 +0000 (09:30 -0700)] 
cp: clarify commentary

* src/copy.c: Make comments a bit clearer.

2 years agocopy: fix --reflink=auto to fallback in more cases
Pádraig Brady [Thu, 23 Mar 2023 13:19:04 +0000 (13:19 +0000)] 
copy: fix --reflink=auto to fallback in more cases

On restricted systems like android or some containers,
FICLONE could return EPERM, EACCES, or ENOTTY,
which would have induced the command to fail to copy
rather than falling back to a more standard copy.

* src/copy.c (is_terminal_failure): A new function refactored
from handle_clone_fail().
(is_CLONENOTSUP): Merge in the handling of EACCES, ENOTTY, EPERM
as they also pertain to determination of whether cloning is supported
if we ever use this function in that context.
(handle_clone_fail): Use is_terminal_failure() in all cases,
so that we assume a terminal failure in less errno cases.
* NEWS: Mention the bug fix.
Addresses https://bugs.gnu.org/62404

2 years agodoc: add a NEWS entry for the previous fix
Pádraig Brady [Fri, 24 Mar 2023 12:44:50 +0000 (12:44 +0000)] 
doc: add a NEWS entry for the previous fix

* NEWS: Mention the previous cksum --check fix.

2 years agocksum: fix reporting of failed checks
Pádraig Brady [Thu, 23 Mar 2023 12:31:24 +0000 (12:31 +0000)] 
cksum: fix reporting of failed checks

This applies to all checksumming utilities,
where we incorrectly report all subsequent files as checking 'OK'
once any file has passed a digest check.
The exit status was not impacted, only the printed status.

* src/digest.c (digest_check): Use the correct state variable
to determine if the _current_ file has passed or not.
* tests/misc/md5sum.pl: Add a test case.
Fixes https://bugs.gnu.org/62403

2 years agotests: skip some parts of tests/misc/tee.sh if run as root
Nick Alcock [Tue, 21 Mar 2023 12:54:02 +0000 (12:54 +0000)] 
tests: skip some parts of tests/misc/tee.sh if run as root

Similarly to the fix to tests/rmdir/ignore.sh in c0e5f8c59,
tee should not be expected to fail when run with read-only outputs
when run as root.

* tests/misc/tee.sh: Add uid_is_privileged_ guard around test for
read-only outputs.

2 years agomaint: post-release administrivia
Pádraig Brady [Mon, 20 Mar 2023 14:08:46 +0000 (14:08 +0000)] 
maint: post-release administrivia

* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.

2 years agoversion 9.2 v9.2
Pádraig Brady [Mon, 20 Mar 2023 13:44:36 +0000 (13:44 +0000)] 
version 9.2

* NEWS: Record release date.

2 years agotests: avoid false failure on systems without statx
Pádraig Brady [Sun, 19 Mar 2023 23:35:12 +0000 (23:35 +0000)] 
tests: avoid false failure on systems without statx

* tests/ls/stat-free-symlinks.sh: Filter out syscalls that
return ENOSYS, as that was seen with statx() on Debian 10.13
on mips64, and resulted in overcounting of stat calls.

2 years agostty: ensure arbitrary data is not displayed
Pádraig Brady [Sun, 19 Mar 2023 22:22:18 +0000 (22:22 +0000)] 
stty: ensure arbitrary data is not displayed

* src/stty.c (main): Use static structures to ensure
they're initialized (to zero), so that random data is
not displayed, or compared resulting in a inaccurate
failure reported to users.  This was seen on musl libc
where some parts of the termios c_cc array were
not initialized by tcgetattr().
Reported by Bruno Haible.

2 years agotests: df: avoid false failure on systems with multiple roots
Pádraig Brady [Sat, 18 Mar 2023 21:44:56 +0000 (21:44 +0000)] 
tests: df: avoid false failure on systems with multiple roots

* tests/df/df-symlink.sh: Skip the test on systems
with multiple file system roots.