Commit Graph

29766 Commits

Author SHA1 Message Date
Pádraig Brady
f218412b9a maint: cleanups to NEWS
* NEWS: Use more consistent wording, ordering, and formatting
for recent entries.
2023-05-13 10:33:14 +01:00
Pádraig Brady
059e53e5b4 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.
2023-05-08 21:34:58 +01:00
Pádraig Brady
ba128e628c doc: adjust build instructions for disabling year 2038 support
* README-install: Adjust the instructions as per recent gnulib updates.
2023-05-08 12:57:56 +01:00
Bernhard Voelker
3f942cd03f 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.
2023-05-07 23:07:12 +02:00
Paul Eggert
42f33ae68c doc: time zone conversion example
* doc/coreutils.texi (Examples of date):
Give time zone conversion example.
2023-05-07 09:17:27 -07:00
Paul Eggert
7edec89fc3 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.
2023-05-07 09:17:26 -07:00
Pádraig Brady
fae65623a9 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
2023-05-06 11:26:04 +01:00
Paul Eggert
300af78691 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.
2023-05-05 11:05:03 -07:00
Pádraig Brady
c6b1fe4347 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
2023-05-03 18:15:59 +01:00
Pádraig Brady
7223651ad1 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.
2023-05-02 22:39:03 +01:00
Pádraig Brady
6d683a1d02 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.
2023-04-30 22:10:25 +01:00
Pádraig Brady
2cae0419c9 maint: remove redundant exit status handling
* src/numfmt.c: Remove redundant / confusing
use of TIMEOUT_FAILURE.
2023-04-30 13:05:12 +01:00
Paul Eggert
35adc746a0 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.
2023-04-26 18:20:20 -07:00
Paul Eggert
21e7573508 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'.
2023-04-26 18:20:20 -07:00
Paul Eggert
6c199713ed 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.
2023-04-26 18:20:19 -07:00
Paul Eggert
d178b49754 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.
2023-04-26 18:20:19 -07:00
Paul Eggert
941027eeb7 build: update gnulib submodule to latest 2023-04-26 18:20:19 -07:00
Pádraig Brady
5e1c5f2d71 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.
2023-04-26 16:20:50 +01:00
Pádraig Brady
4eb5abbff4 uniq: be more specific when diagnosing read errors
* src/uniq.c (check_file): Use the errno when diagnosing read errors.
2023-04-26 16:19:51 +01:00
Jaroslav Skarvada
b16553cdad 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.
2023-04-26 13:51:42 +01:00
Pádraig Brady
3fb0cc80fa 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
2023-04-25 14:18:35 +01:00
Pádraig Brady
cc078f747f 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.
2023-04-25 11:17:54 +01:00
Pádraig Brady
7ea7c020e8 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.
2023-04-24 11:46:28 +01:00
Pádraig Brady
82e1750daa factor: diagnose errors reading the input
* src/factor.c (do_stdin): Exit with failure upon read errors.
* NEWS: Mention the bug fix.
2023-04-24 11:46:28 +01:00
Pádraig Brady
5595673d5c numfmt: diagnose errors reading the input
* src/numfmt.c (main): Exit with failure upon read errors.
* NEWS: Mention the bug fix.
2023-04-24 11:46:28 +01:00
Pádraig Brady
0e62ba282e tsort: diagnose errors reading the input
* src/tsort.c (tsort): Check for errors after readtoken().
* NEWS: Mention the bug fix.
2023-04-24 11:46:28 +01:00
Pádraig Brady
9d333aca43 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.
2023-04-24 11:46:28 +01:00
Andreas Schwab
e29f4411c8 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.
2023-04-24 11:37:09 +01:00
Pádraig Brady
6bab375973 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
2023-04-21 19:13:52 +01:00
Pádraig Brady
f6229adb09 maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2023-04-18 15:32:53 +01:00
Pádraig Brady
f386722dc0 version 9.3
* NEWS: Record release date.
2023-04-18 15:08:11 +01:00
Pádraig Brady
d81094dc7b 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.
2023-04-16 16:11:20 +01:00
Pádraig Brady
cf91b9d62c 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.
2023-04-14 00:02:22 +01:00
Pádraig Brady
daa1e4f557 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.
2023-04-13 20:19:18 +01:00
Pádraig Brady
854c90ecc0 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.
2023-04-13 20:19:09 +01:00
Paul Eggert
cc95246ee2 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.
2023-04-10 11:56:43 -07:00
Pádraig Brady
ae4dace2ec 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.
2023-04-10 19:45:14 +01:00
Pádraig Brady
09ded7049b 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.
2023-04-10 18:54:19 +01:00
Paul Eggert
ffd62ab92c maint: require support for post-2038 timestamps
* bootstrap.conf (gnulib_modules): Replace year2038 with
year2038-required.
2023-04-09 19:21:55 -07:00
Paul Eggert
6f91c2eac3 build: update gnulib submodule to latest 2023-04-09 19:21:55 -07:00
Pádraig Brady
ce630dfc7e 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
2023-04-08 12:19:40 +01:00
Pádraig Brady
f6c21f6d3a 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.
2023-04-08 12:11:58 +01:00
Pádraig Brady
db28af406f 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
2023-04-08 12:11:50 +01:00
Pádraig Brady
5891d28ede 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
2023-04-04 12:00:11 +01:00
Pádraig Brady
17c31a73f1 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
2023-03-31 11:58:53 +01:00
Pádraig Brady
5e170ff0b8 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
2023-03-31 11:58:53 +01:00
Pádraig Brady
7ad749886c 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
2023-03-31 11:58:49 +01:00
Pádraig Brady
a9bd274616 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.
2023-03-28 14:24:29 +01:00
Pádraig Brady
a4525de1ef 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.
2023-03-28 13:40:43 +01:00
Paul Eggert
9c5e542fd1 date: diagnose -f read errors
* src/date.c (batch_convert): Diagnose read errors, fixing Bug#62497.
2023-03-28 01:53:06 -07:00