build: fix link errors of sort, split on CentOS 5 and Solaris 10
* src/local.mk (src_sort_LDADD, src_split_LDADD): Add $(CLOCK_TIME_LIB).
build: fix compilation error on AIX 7.1
* src/copy.c (copy_internal): Don't test for ENOTEMPTY if it has the
same value as EEXIST.
2023-08-27 Pádraig Brady
build: update with gnulib fixes
* gnulib: Update to incorporate gnulib fixes
from Bruno Haible from his coreutils 9.4 pre-release testing.
2023-08-24 Pádraig Brady
doc: remove older ChangeLog items
* Makefile.am: Update the oldest documented version
to 8.30 which is now about 5 years old.
2023-08-23 Pádraig Brady
shred: fix operation on Solaris with 64 bit builds
* NEWS: Mention the bug fix.
* gl/lib/randread.c (get_nonce): Limit getrandom() <= 1024 bytes.
2023-08-22 Pádraig Brady
build: update gnulib submodule to latest
* gnulib: Update to latest
doc: reorg texinfo for the checksumming utilities
* doc/coreutils.texi: Reorg so that 'cksum invocation' is the
main node listing all options and output formats, which is then
referenced by the descriptions of the standalone utilities.
Use macros in the description of the standalone utilities
rather than referencing 'md5sum invocation' to be more direct.
2023-08-21 Pádraig Brady
doc: cksum: remove -b description from texinfo
* doc/coreutils.texi (cksum invocation): Following commit 5e1e0993
also remove the desciption of the -b option for the cksum command.
cp: with --sparse=never, avoid COW and copy offload
* src/cp.c (main): Set default reflink mode appropriately
with --sparse=never.
* src/copy.c (infer_scantype): Add a comment to related code.
* tests/cp/sparse-2.sh: Add a test case.
* NEWS: Mention the bug.
2023-08-19 Pádraig Brady
maint: comment spelling fix
* tests/split/l-chunk-root.sh: Fix recently introduced typo.
2023-08-16 Pádraig Brady
maint: remove extraneous line in NEWS
* NEWS: Remove extraneous line.
2023-08-15 Bruno Haible
uptime: simplify following gnulib changes
* build-aux/gen-lists-of-programs.sh (build_if_possible_progs):
Remove uptime.
(normal_progs): Add uptime.
* configure.ac: Remove GNULIB_BOOT_TIME invocation.
* m4/boottime.m4: Remove file.
* src/uptime.c: Don't include , .
(print_uptime): Don't call sysctl, get_system_info, as Gnulib's
readutmp module now does this.
2023-08-15 Paul Eggert
maint: update uptime NEWS
* NEWS: Update as per Bruno Haible .
2023-08-15 Pádraig Brady
tests: fix false failure due to locale on alpine
* tests/sort/sort-debug-keys.sh: Decimal point was seen to be '.'
on fr_FR.UTF-8 on Alpine Linux 3.18, so add an extra guard
to ensure we've a ',' as the decimal point on this locale.
Fixes https://bugs.gnu.org/65310
2023-08-15 Paul Eggert
uptime: be more generous about read_utmp failure
* src/uptime.c (print_uptime): Check for overflow
when computing uptime. Use C99-style decl after statements.
Do not let an idx_t value go negative.
(print_uptime, uptime): Be more generous about read_utmp failures,
or when read_utmp does not report the boot time. Instead of
failing, warn but keep going, printing the information that we did
get, and then exit with nonzero status.
(print_uptime): Return the desired exit status. Caller changed.
2023-08-15 Bruno Haible
uptime: Include VM sleep time in the "up" duration
* src/uptime.c: Don't include c-strtod.h.
(print_uptime): Don't read /proc/uptime, because the value it provides
does not change when a date adjustment occurs.
* bootstrap.conf (gnulib_modules): Remove 'uptime'.
2023-08-15 Paul Eggert
build: update gnulib submodule to latest
2023-08-15 Bernhard Voelker
maint: fix typo in NEWS
* NEWS: s|/who/log/wtmp|/var/log/tmp|, introduced in commit 85edb4afbd1.
2023-08-15 Bernhard Voelker
doc: reference install(1) and cp(1) from each other
* man/cp.x (SEE ALSO): Add install(1).
* man/install.x (SEE ALSO): Add cp(1).
Discussed at
https://lists.gnu.org/r/coreutils/2023-08/msg00026.html
2023-08-14 Bruno Haible
build: fix recent compilation error on GNU/Hurd
* src/copy.c (set_author): Revert change from MACH_PORT_NULL to
MACH_PORT_nullptr from commit 16b5ca6e (2023-06-29).
2023-08-14 Pádraig Brady
maint: avoid syntax-check failure
* po/POTFILES.in: Cater to lib/file-type.c adjustments
as suggested by sc_po_check.
2023-08-14 Bruno Haible
build: fix link errors with gcc < 4.8
* configure.ac: Attempt to link, not only compile, the test programs
with __builtin_cpu_supports, to avoid link errors with cksum and wc.
2023-08-13 Paul Eggert
doc: improve NEWS discussion of systemd
build: update gnulib submodule to latest
2023-08-12 Pádraig Brady
maint: allow use of printf C99 integer size specifiers
Older systems that had issues with these like HP-UX and Solaris 8
are now obsolete, and can easily apply patches to provide support.
Also we've used %td since coreutils 9.1, with no reported issues.
* cfg.mk (sc_prohibit-c99-printf-format): Remove to allow use of
%[jtz] size specifiers, which allows for cleaner code
by avoiding the need to cast to PRI?MAX etc.
2023-08-11 Pádraig Brady
doc: separate out description of 2038 time stamp change
* NEWS: Separate out the description of the _existing_ issues
with outputting timestamps on 32 bit systems, from _future_ issues
outputting timestamps on all systems. Also move this to the
"improvement" section, since it's not really a coreutils
specific issue, and also is a build time configurable option.
2023-08-11 Bruno Haible
pinky,users,who: optimize read_utmp invocation
When we are only interested in entries of type USER_PROCESS, tell
read_utmp that it does not need to determine the boot time.
* src/pinky.c (short_pinky): Pass option READ_UTMP_USER_PROCESS.
* src/users.c (users): Likewise.
* src/who.c (who): Likewise, if calling list_entries_who.
2023-08-09 Paul Eggert
who: simplify based on readutmp changes
* src/pinky.c (time_string, print_entry, scan_entries, short_pinky):
* src/uptime.c (print_uptime, uptime):
* src/users.c (list_entries_users, users):
* src/who.c (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS)
(UT_TYPE_LOGIN_PROCESS, UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME)
(time_string, print_user, print_boottime)
(make_id_equals_comment, print_deadprocs, print_login)
(print_initspawn, print_clockchange, print_runlevel)
(list_entries_who, scan_entries, who):
Simplify, partly by using plain -> rather than macros.
pinky,who: omit pragma
* src/pinky.c, src/who.c:
Omit no-longer-needed -Wstringop-overread pragma.
2023-08-09 Bruno Haible
maint: Simplify after gnulib changed
Update gnulib submodule to latest.
All of UT_USER_SIZE, UT_ID_SIZE, UT_LINE_SIZE, UT_HOST_SIZE are now -1.
* src/pinky.c (print_entry): Remove code for bounded-length ut_line,
ut_user, ut_host.
(scan_entries): Remove code for bounded-length ut_user.
* src/who.c (print_line): Remove userlen, linelen arguments.
(print_user): Remove code for bounded-length ut_line, ut_user, ut_host.
(make_id_equals_comment): Remove code for bounded-length ut_id.
(print_boottime, print_deadprocs, print_login, print_initspawn,
print_clockchange, print_runlevel, print_heading): Update print_line
invocations.
(scan_entries): Remove code for bounded-length ut_line.
2023-08-04 Paul Eggert
maint: Update after gnulib module 'readutmp' changed
(This patch is coauthored with Bruno Haible,
with original version at .)
This updates the gnulib submodule to latest.
For year-2038 safety on Linux/{x86,arm},
this adds an --enable-systemd option to ‘configure’.
The idea is that this sort of thing will become the default
after it has been tested more.
* configure.ac: Don't test whether struct utmp and struct utmpx
have the ut_host field; this is now done in gnulib's readutmp module.
* src/local.mk: Link the programs 'pinky', 'uptime', 'users',
'who' with $(READUTMP_LIB).
* src/pinky.c, src/who.c:
Test HAVE_STRUCT_XTMP_UT_HOST instead of HAVE_UT_HOST.
* src/pinky.c (print_entry):
* src/who.c (print_user, print_deadprocs, print_login)
(print_initspawn, scan_entries):
Support the situation where ut_line is a 'char *' rather than a
'char[]' of fixed size. Likewise for ut_user and ut_host.
(make_id_equals_comment): Likewise for ut_id.
* src/pinky.c (print_entry):
* src/who.c (print_user):
Open /dev to simplify looking up its entries.
Don’t use printf if the output might in theory be longer than INT_MAX.
* src/pinky.c (scan_entries, short_pinky):
* src/uptime.c (print_uptime, uptime):
* src/users.c (list_entries_users, users):
* src/who.c (who):
Use idx_t where new read_utmp needs it.
* src/system.h (STREQ_LEN): Add comment that last arg can be -1.
2023-08-02 Paul Eggert
uptime: fix Y5881633 bug
* src/uptime.c (print_uptime): Prefer signed types.
Fix unlikely bug on platforms with 32-bit long and 64-bit time_t
if the idle time exceeds 2**31 days (about 6 million years...).
pinky: fix "d" typo
Problem reported by Bruno Haible (bug#65003).
* src/pinky.c (idle_string): Fix recently-introduced typo:
missing "d" for "days".
2023-08-01 Dragan Simic
maint: minor comment cleanups
* src/cut.c: Adjust a few comments slightly, simply to have their
trailing whitespace the same as in the majority of the comments.
cut: promptly diagnose write errors, continued
* src/cut.c: Complete the error-handling improvements started in
commit e0a4a60af5, by adding a couple of remaining checks for putchar().
While there, sprinkle a few rather useful comments, and perform a few
small code cleanups, to make the code and the comments more uniform
and more conformant to the official coding style. Also make the help
message slightly more uniform.
maint: reformat text width in HACKING
* HACKING: Adjust line lengths.
2023-08-01 Pádraig Brady
pinky: fix buffer size on 32 bit builds
* src/pinky.c (idle_string): Use the correct buffer size
following the recent int type adjustment.
od: fix issues with recent format string changes
* src/ioblksize.h: Avoid syntax check with redundant idx.h inclusion.
* src/od.c (FMT_BYTES_ALLOCATED): Increase by two to avoid:
error: '%s' directive writing between 1 and 2 bytes into a region
of size between 1 and 4 [-Werror=format-overflow=]
(maint): Use %td to print idx_t rather than invalid %jt format.
2023-08-01 Paul Eggert
pinky: prefer signed types
* src/pinky.c (idle_string): Prefer intmax_t to unsigned long int;
this avoids an overflow on platforms where unsigned long is 32
bits and time_t is 64 bits (the bug could occur on such a system
that was idle for more than 6 million years, so it’s a bit
hard to supply a test case...).
pathchk: prefer signed types
* src/pathchk.c (validate_file_name): Prefer signed types.
numfmt: prefer signed types
* src/numfmt.c (suffix_power_char, powerld, expld)
(simple_strtod_int, double_to_human, prepare_padded_number)
(process_suffixed_number): Prefer signed types.
(process_suffixed_number): Fix an unlikely bug if an
arg has exactly 2**32 spaces at the start.
mktemp,seq: prefer signed types
* src/mktemp.c (main):
* src/seq.c (main): Prefer signed types.
kill: prefer signed types
* src/kill.c (list_signals):
Prefer signed types. This avoids undefined behavior on
theoretical platforms where unsigned and signed int have
different representations.
groups,id: don’t assume gid_t fits in unsigned long
* src/group-list.c (print_group): Convert to intmax_t or
uintmax_t, not to unsigned long.
dircolors,du,expr: prefer signed types
* src/dircolors.c (dc_parse_stream):
* src/du.c (max_depth, main):
* src/expr.c (main):
Prefer signed types.
od: prefer signed types
* src/od.c: Include stdckdint.h.
(bytes_to_oct_digits, bytes_to_signed_dec_digits)
(bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
Use ‘char’ for these small constants.
(simple_strtoi): Rename from simple_strtoul. Convert to int
instead of unsigned long; that’s good enough. All uses changed.
Simplify by using ckd_mul and ckd_add to check for overflow.
(main): Prefer signed types to unsigned.
cksum,df,digest: prefer signed types
* src/cksum.c (main):
* src/df.c (decode_output_arg):
* src/digest.c (valid_digits):
Prefer idx_t to unsigned types when the value is an index
into an array.
join: prefer signed types
* src/join.c (struct outlist, struct field, struct line)
(struct seq, autocount_1, autocount_2, join_field_1, join_field_2)
(extract_field, keycmp, check_order, init_linep, free_spareline)
(getseq, delseq, prfield, prfields, prjoin, join, add_field)
(string_to_join_field, decode_field_spec, add_field_list)
(set_join_field, main):
Prefer signed integers to unsigned.
factor: prefer signed types
When it’s easy, prefer signed types to unsigned, as
they are less confusing and allow overflow checking.
* src/factor.c (struct mp_factors, udiv_qrnnd)
(count_leading_zeros, count_trailing_zeros)
(factor_insert_multiplicity, mp_factor_clear, mp_factor_insert)
(factor_insert_refind, factor_using_division)
(mp_factor_using_division, powm2, millerrabin, millerrabin2)
(mp_millerrabin, prime_p, prime2_p, mp_prime_p, isqrt, isqrt2)
(invtab, q_freq, factor_using_squfof, strto2uintmax)
(print_factors_single, main):
Prefer signed integers to unsigned.
maint: include idx.h everywhere
* src/system.h: Include idx.h here, instead of in every file
that currently uses idx_t. This should make it easier to use
idx_t in the future.
2023-07-31 Paul Eggert
who: fix only-theoretical overflow
Change stzncpy’s implementation to match its comment, in the case
where SRC + LEN would overflow. This case never happens in coreutils.
* src/system.h (stzncpy): Work even if SRC + LEN would overflow.
2023-07-31 Pádraig Brady
tac: handle short reads on input
This can be reproduced by getting the read() above 2G,
which induces a short read, thus triggering the erroneous failure.
$ truncate -s 5G 5G
$ cat 5G | TMPDIR=$PWD tac | wc -c
tac: /tmp/tacFt7txA: read error: Illegal seek
0
With the fix in place we now get:
$ cat 5G | TMPDIR=$PWD src/tac | wc -c
5368709120
* src/tac.c (tac_seekable): Use full_read() to handle short reads.
* NEWS: Mention the bug fix.
Reported at https://bugs.debian.org/1042546
2023-07-31 Bruno Haible
uptime: output correct user count on OpenBSD
* src/uptime.c (print_uptime, uptime): Always call read_utmp
and count the result.
* NEWS: Mention the fix (text by Bruno Haible).
2023-07-31 Paul Eggert
build: update gnulib submodule to latest
2023-07-30 Paul Eggert
build: update gnulib submodule to latest
* NEWS: Mention a bug that this fixes.
2023-07-22 Paul Eggert
mv: better diagnostic for 'mv dir x' failure
Problem reported by Nir Oren .
* src/copy.c (copy_internal): Use a more-specific diagnostic when
a rename fails due to a problem that must be due to the
destination, avoiding user confusion in cases like 'mv dir x'
where x is a nonempty directory.
* tests/mv/dir2dir.sh: Adjust to match.
2023-07-20 Pádraig Brady
doc: clarify tail -n/-c +NUM operation
tail -n/-c +NUM, is different from tail -n/-c NUM,
and head -n/-c NUM, and head -n/c -NUM, in that it
specifies a 1 based index rather than a count to skip/include.
So clarify this in tail --help and tail info manual.
Note we also mention this gotcha at:
https://www.pixelbeat.org/docs/coreutils-gotchas.html#tail
* doc/coreutils.texi (tail invocation): Give examples for -c/-n +NUM,
to make it clear one has to specify a number 1 larger than
might be expected.
* src/tail.c (usage): State the skip at start edge case more clearly
in the -n description. -c is not often used with tail so we leave
full explanation of that to the info manual. Also split the string
to simplify translation.
2023-07-18 Pádraig Brady
maint: add a syntax check to prevent use of NULL
* cfg.mk (sc_prohibit_NULL): Direct to use nullptr instead.
tests: split: provide more isolated /tmp handling
* tests/split/l-chunk.sh: Move the "expensive" portion to ...
* tests/split/l-chunk-root.sh: .. A new test split from l-chunk.sh
which uses an isolated TMPDIR, rather than exhausting /tmp,
as that gives false positive failures with some other coreutils tests
like tac-2-nonseekable.sh and shuf-reservoir.sh at least.
* tests/local.mk: Reference the new test.
split: honor $TMPDIR for temp files
* bootstrap.conf: Depend on tmpdir rather than tmpfile,
as the standard tmpfile() doesn't honor $TMPDIR.
* src/split.c (copy_to_tmpfile): Adjust to call temp_stream() rather
than tmpfile();
* NEWS: Mention the improvement.
2023-07-18 Pádraig Brady
tac: fall back to /tmp if $TMPDIR is unavailable
This also refactors temp_stream() to its own module,
in preparation for use by split.
* src/tac.c: Refactor temp_stream() out to ...
* src/temp-stream.c: ... A new module mostly refactored from tac,
but uses tmpdir to more robustly support $TMPDIR,
while falling back to /tmp if not available.
* src/temp-stream.h: The new module interface.
* src/local.mk: Reference the new module from tac.
* tests/tac/tac.pl: Adjust to non failing missing $TMPDIR.
* po/POTFILES.in: Reference the new module with translatable strings.
* NEWS: Mention the user visible improvements to tac TMPDIR handling.
2023-07-18 Pádraig Brady
maint: add syntax check to ensure safe mkstemp usage
One needs to include stdlib--.h if using mkstemp()
lest one hits esoteric bugs with closed stdin etc.
* cfg.mk (sc_require_stdlib_safer): Add a new syntax check.
(sc_require_stdio_safer): Fix this; broken since commit fa7ed969c3.
2023-07-17 Pádraig Brady
join: promptly diagnose write errors
* src/join.c (prjoin): Check for write errors after each line.
* tests/misc/write-errors.sh: enable the test for join.
* NEWS: Mention the improvement.
comm: promptly diagnose write errors
* src/comm.c (writeline): Simplify by removing the unneeded STREAM
parameter. Call write_error() upon ferror().
(compare_files): Adjust to simplified writeline().
* tests/misc/write-errors.sh: Enable comm test.
* NEWS: Mention the improvement.
cut: promptly diagnose write errors
* src/cut.c (cut_bytes): Diagnose errors from fwrite() and putchar().
(cut_fields): Likewise.
* tests/misc/write-errors.sh: Enable the test for cut,
and augment to cover both cut_bytes() and cut_fields().
* NEWS: Mention the improvement.
uniq: promptly diagnose write errors
* src/uniq.c (write_line): Check the output from fwrite() immediately.
(check_file): Likewise.
* tests/misc/write-errors.sh: Enable the test case.
* NEWS: Mention the improvement.
od: promptly diagnose write errors
* src/od.c (dump): Check for write errors after each block written,
to exit early even with large / unbounded inputs.
* tests/misc/write-errors.sh: enable od check.
* NEWS: Mention the improvement.
Fixes https://bugs.gnu.org/64540
all: avoid repeated diagnostic upon write error
* cfg.mk (sc_some_programs_must_avoid_exit_failure): Adjust to
avoid false positive.
(sc_prohibit_exit_write_error): A new syntax check to prohibit
open coding error(..., "write error"); instead directing to use...
* src/system.h (write_error): ... a new function to clear stdout errors
before we explicitly diagnose a write error and exit.
* src/basenc.c: Use write_error() to ensure no repeated diagnostics.
* src/cat.c: Likewise.
* src/expand.c: Likewise.
* src/factor.c: Likewise.
* src/paste.c: Likewise.
* src/seq.c: Likewise.
* src/shuf.c: Likewise.
* src/split.c: Likewise.
* src/tail.c: Likewise.
* src/tr.c: Likewise.
* src/unexpand.c: Likewise.
* tests/misc/write-errors.sh: Remove TODOs for the fixed utilities:
expand, factor, paste, shuf, tr, unexpand.
tests: ensure utilties exit promptly upon write error
* tests/local.mk: Reference the new test.
* tests/misc/write-errors.sh: A new test to ensure utilities
exit promptly upon writing to /dev/full.
2023-07-14 Jim Meyering
cksum: improve problematic_chars function
* src/digest.c (problematic_chars): Implement using strcspn,
and traversing S only once, rather than once per escaped byte.
2023-07-12 Pádraig Brady
maint: give a new function the "pure" attribute
* src/digest.c (problematic_chars): This recently introduced
function does not modify state so is pure, even though GCC 13.1 at least
did not warn about that attribute being appropriate.
2023-07-11 Pádraig Brady
cksum: escape filenames with a leading '\' in --check status
* src/digest.c (digest_check): Also escape in the case that the
file name contains '\'.
* tests/cksum/md5sum-bsd.sh: Add a test case.
* doc/coreutils.texi (md5um invocation): Clarify escaping operation.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/64392
2023-07-09 Pádraig Brady
cksum: support transparent emulation of older utils
Support -b, --binary, and -t, --text
to allow full emulation of older utilities with:
exec cksum -a $algo --untagged "$@"
Note this would diverge from OpenBSD's support of cksum -b.
* src/digest.c: Change -b to mean --binary, not --base64 in all cases.
Accept -b and -t in all cases. Keep --binary and --text undocumented
for cksum.
* tests/cksum/cksum-base64.pl: s/-b/--base64/.
* tests/cksum/cksum-a.sh: Ensure cksum supports -b and -t appropriately.
* NEWS: Mention the change in behavior.
2023-07-08 Pádraig Brady
maint: avoid static analysis failure for ignored dup2 return
* src/sort.c: We're ignoring failures from these calls,
so do so explicitly to avoid static analysis issues
as reported by coverity.
2023-07-04 Sylvestre Ledru
tests: mktemp -t: $TMPDIR has higher priority than -p
* tests/misc/mktemp.pl: Ensure that with -t,
$TMPDIR has precedence over -p.
2023-07-01 Paul Eggert
maint: update .gitignore
Add some newly-created Gnulib files,
plus some bootstrap temporaries.
stty: fix untranslated diagnostics
* src/stty.c (set_speed): Translate diagnostics.
maint: sync bootstrap from Gnulib
* bootstrap: Copy from gnulib/build-aux/bootstrap.
maint: prefer ckd_add to INT_ADD_WRAPV etc
* bootstrap.conf (gnulib_modules): Add stdckdint.
Also, in C source code, prefer C23 macros like ckd_add
to their Gnulib near-equivalents like INT_ADD_WRAPV.
Include as needed.
who: don’t crash if clock gyrates
* src/who.c (idle_string): Avoid signed integer overflow
if the superuser messes with the clock in bizarre ways.
Remove an ‘assume’ that wasn’t correct under this scenario.
df: omit GCC 5 ‘assume’s
* src/df.c (main):
* src/shred.c (dopass):
Omit ‘assumes’ needed to pacify GCC 5 but not needed with GCC 13.
maint: pacify GCC bug#109613 better
* src/cut.c (cut_file):
* src/nl.c (nl_file): Pacify GCC Bug#109613 in a better way, by
narrowing the coverage of the ‘assume’ so that bugs in the
no-longer-covered part are not masked.
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
,
which went in-house in 2012 and never came back.
build: update gnulib submodule to latest
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.
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 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.
maint: fix indenting in previous change
* src/ptx.c: Adjust to fit into 80 columns.
2023-06-29 Paul Eggert
maint: prefer C23-style nullptr
* bootstrap.conf (gnulib_modules): Add nullptr.
In code, prefer nullptr to NULL where either will do.
2023-06-22 Bruno Haible
build: ensure that makeinfo ≥ 6.8 checks the @menu structure
See .
* doc/local.mk (MAKEINFO): New variable.
* cfg.mk (_makefile_at_at_check_exceptions): Update.
2023-06-22 Pádraig Brady
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
2023-06-21 Paul Eggert
maint: update GCC bug number in comment
2023-06-20 Paul Eggert
doc: mention fix for bug#64123
build: update gnulib submodule to latest
2023-06-19 Sylvestre Ledru
tests: move tests to a directory per utility
* cfg.mk: Adjust syntax check exclusion paths.
* tests/local.mk: Adjust for renamed tests.
2023-06-15 Pádraig Brady
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.
2023-06-14 Paul Eggert
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.
cksum,wc: don’t include
* src/cksum.c [!CRCTAB && USE_PCLMUL_CRC32]:
* src/wc.c [USE_AVX2_WC_LINECOUNT]:
Don’t include ; no longer needed.
cksum: fix bug in check for cksum_pclmul
This fixes a typo in the previous patch.
Problem reported by Pádraig Brady .
* src/cksum.c (pclmul_supported): Also require AVX support
to use cksum_pclmul.
wc: port to kernels that disable XSAVE YMM
Problem reported by Dave Hansen .
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.
2023-06-12 Ville Skyttä
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.
2023-06-11 Pádraig Brady
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
2023-06-09 Pádraig Brady
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.
2023-06-08 Pádraig Brady
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
2023-06-07 Pádraig Brady
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.
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
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
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.
2023-06-06 Pádraig Brady
maint: avoid syntax-check failure
* po/POTFILES.in: Add lib/propername.h due to new comments
that trigger sc_po_check.
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.
2023-06-06 Paul Eggert
build: update gnulib submodule to latest
2023-06-01 Pádraig Brady
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.
2023-05-31 Pádraig Brady
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
2023-05-31 Pádraig Brady
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.
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.
2023-05-30 Paul Eggert
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.
2023-05-28 Pádraig Brady
build: update gnulib submodule to latest
* gnulib: Update to latest.
* src/dd.c: Avoid error macro redefinition.
2023-05-19 Pádraig Brady
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.
2023-05-19 Pádraig Brady
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.
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.
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.
2023-05-18 Pádraig Brady
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.
2023-05-18 Pádraig Brady
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.
2023-05-13 Pádraig Brady
maint: cleanups to NEWS
* NEWS: Use more consistent wording, ordering, and formatting
for recent entries.
2023-05-08 Pádraig Brady
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 Pádraig Brady
doc: adjust build instructions for disabling year 2038 support
* README-install: Adjust the instructions as per recent gnulib updates.
2023-05-07 Bernhard Voelker
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
* 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 Paul Eggert
doc: time zone conversion example
* doc/coreutils.texi (Examples of date):
Give time zone conversion example.
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-06 Pádraig Brady
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-05 Paul Eggert
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-03 Pádraig Brady
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-02 Pádraig Brady
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-04-30 Pádraig Brady
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.
maint: remove redundant exit status handling
* src/numfmt.c: Remove redundant / confusing
use of TIMEOUT_FAILURE.
2023-04-27 Paul Eggert
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.
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'.
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.
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.
build: update gnulib submodule to latest
2023-04-26 Pádraig Brady
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.
uniq: be more specific when diagnosing read errors
* src/uniq.c (check_file): Use the errno when diagnosing read errors.
2023-04-26 Jaroslav Skarvada
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-25 Pádraig Brady
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 Pádraig Brady
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-24 Pádraig Brady
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.
factor: diagnose errors reading the input
* src/factor.c (do_stdin): Exit with failure upon read errors.
* NEWS: Mention the bug fix.
numfmt: diagnose errors reading the input
* src/numfmt.c (main): Exit with failure upon read errors.
* NEWS: Mention the bug fix.
tsort: diagnose errors reading the input
* src/tsort.c (tsort): Check for errors after readtoken().
* NEWS: Mention the bug fix.
2023-04-24 Pádraig Brady
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 Andreas Schwab
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-21 Pádraig Brady
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-18 Pádraig Brady
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 9.3
* NEWS: Record release date.
2023-04-16 Pádraig Brady
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-14 Pádraig Brady
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-13 Pádraig Brady
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.
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-10 Paul Eggert
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 Pádraig Brady
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 Pádraig Brady
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 Paul Eggert
maint: require support for post-2038 timestamps
* bootstrap.conf (gnulib_modules): Replace year2038 with
year2038-required.
build: update gnulib submodule to latest
2023-04-08 Pádraig Brady
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
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 Pádraig Brady
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-04 Pádraig Brady
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-03-31 Pádraig Brady
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
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
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-28 Pádraig Brady
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.
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 Paul Eggert
date: diagnose -f read errors
* src/date.c (batch_convert): Diagnose read errors, fixing Bug#62497.
2023-03-25 Paul Eggert
cp: clarify commentary
* src/copy.c: Make comments a bit clearer.
2023-03-24 Pádraig Brady
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
2023-03-24 Pádraig Brady
doc: add a NEWS entry for the previous fix
* NEWS: Mention the previous cksum --check fix.
2023-03-23 Pádraig Brady
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
2023-03-21 Nick Alcock
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.
2023-03-20 Pádraig Brady
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 9.2
* NEWS: Record release date.
2023-03-19 Pádraig Brady
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.
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.
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.
2023-03-18 Pádraig Brady
doc: uniq: revert previous man page adjustment
* src/uniq.c (usage): -D doesn't take an argument
so should be separated in the description.
doc: uniq: use more standard description of -D long option
* src/uniq.c: Describe -D and --all-repeated together,
as with all other long options.
Fixes https://bugs.gnu.org/62249
tests: aix: avoid unsupported functionality
* tests/misc/tee.sh: AIX doesn't support detecting
closed outputs either with poll() or select() so avoid
testing that functionality.
* tests/tail-2/pipe-f.sh: Likewise.
2023-03-16 Bernhard Voelker
maint: avoid discarded-qualifiers warnings with SELinux 3.5
Since SELinux version 3.5, the return value of context_str(3) is
declared as const; see:
https://github.com/SELinuxProject/selinux/commit/dd98fa322766
Therefore, GCC complains (here with -Werror):
src/selinux.c: In function 'defaultcon':
src/selinux.c:152:16: error: assignment discards 'const' qualifier \
from pointer target type [-Werror=discarded-qualifiers]
152 | if (!(constr = context_str (tcontext)))
| ^
src/selinux.c: In function 'restorecon_private':
src/selinux.c:252:16: error: assignment discards 'const' qualifier \
from pointer target type [-Werror=discarded-qualifiers]
252 | if (!(constr = context_str (tcontext)))
| ^
* src/selinux.c (defaultcon): Define CONSTR as const.
(restorecon_private): Likewise.
2023-03-15 Pádraig Brady
test: avoid a test hang on Hurd
* tests/cp/sparse-to-pipe.sh: Protect the cp call seen to
hang on Hurd/i686 with a timeout.
Reported By: Bruno Haible
cksum: fix --raw on 64 bit big endian systems
* src/sum.c (output_bsd): On sparc64 for example,
a crc of 0 was output due to casting an int variable
to uint16_t and thus operating on the wrong end of the variable.
Instead use explicit assignment to the narrower type
to ensure we get the appropriate data.
(output_sysv): Likewise.
Reported by Bruno Haible.
2023-03-15 Bruno Haible
build: avoid -Wsometimes-uninitialized on macOS 12
* src/pr.c (integer_overflow): Mark as _Noreturn.
* src/test.c (beyond): Likewise.
2023-03-13 Pádraig Brady
doc: remove older ChangeLog items
* Makefile.am: Update the oldest documented version
to 8.29 which is now about 5 years old.
tee: avoid undefined behavior after fclose()
* iopoll.c (fclose_wait): Rename from confusing fclose_nonblock name.
Also adjust to do no operations on the stream after fclose()
as this is undefined. Instead use fflush() to determine EAGAIN status.
(fwrite_wait): Renamed from confusing fwrite_nonblock name.
doc: dircolors: better separate the sections in the database
* src/dircolors.hin: Make the separate sections of the self
documenting dircolors database more apparent,
by adding heading comments, and appropriate separation.
2023-03-13 Pádraig Brady
ls: --color: honor separate sequences for extension cases
Following on from commit v8.29-45-g24053fbd8 which unconditionally
used case insensitive extension matching, support selective
case sensitive matching when there are separate extension cases
defined with different display sequences.
* src/dircolors.hin: Document how file name suffixes are matched.
Note this is displayed with `dircolors --print-database` which
the texi info recommends to use for details.
* src/ls.c (parse_ls_color): Postprocess the list to
mark entries for case sensitive matching,
and also adjust so that unmatchable entries are more quickly ignored.
(get_color_indicator): Use exact matching rather than
case insensitive matching if so marked.
* tests/ls/color-ext.sh: Add test cases.
* NEWS: Mention the change in behavior.
Addresses https://bugs.gnu.org/33123
2023-03-13 Pádraig Brady
tests: adjust du test for recent apparent size change
* tests/du/threshold.sh: Directories are assumed to be
of size 0 with --apparent since commit v9.1-187-g110bcd283
so remove --apparent cases from this test.
2023-03-08 Pádraig Brady
tee: support non blocking outputs
Non blocking outputs can be seen for example
when piping telnet through tee to a terminal.
In that case telnet sets its input to nonblocking mode,
which results in tee's output being nonblocking,
in which case in may receive an EAGAIN error upon write().
The same issue was seen with mpirun.
The following can be used to reproduce this
locally at a terminal (in most invocations):
$ { dd iflag=nonblock count=0 status=none;
dd bs=10K count=10 if=/dev/zero status=none; } |
tee || echo fail >/dev/tty
* src/iopoll.c (iopoll_internal): A new function refactored from
iopoll(), to also support a mode where we check the output
descriptor is writeable.
(iopoll): Now refactored to just call iopoll_internal().
(fwait_for_nonblocking_write): A new internal function which
uses iopoll_internal() to wait for writeable output
if an EAGAIN or EWOULDBLOCK was received.
(fwrite_nonblock): An fwrite() wrapper which uses
fwait_for_nonblocking_write() to handle EAGAIN.
(fclose_nonblock): Likewise.
src/iopoll.h: Add fclose_nonblock, fwrite_nonblock.
src/tee.c: Call fclose_nonblock() and fwrite_nonblock wrappers,
instead of the standard functions.
* tests/misc/tee.sh: Add a test case.
* NEWS: Mention the improvement.
The idea was suggested by Kamil Dudka in
https://bugzilla.redhat.com/1615467
2023-03-08 Pádraig Brady
doc: remove redundant NEWS entry
* NEWS: There was no bug on macOS,
and the split -n new feature is documented already.
2023-03-07 Paul Eggert
split: support split -n on larger pipe input
* bootstrap.conf (gnulib_modules): Add free-posix, tmpfile.
* src/split.c (copy_to_tmpfile): New function.
(input_file_size): Use it to split larger files when sizes cannot
easily be determined via fstat or lseek. See Bug#61386#235.
* tests/split/l-chunk.sh: Mark tests of /dev/zero as
very expensive since they exhaust /tmp.
2023-03-07 Pádraig Brady
tee: fix a crash with unwriteable files
This was introduced recently with commit v9.1-166-g6b12e62d9
* src/tee.c (tee_files): Check the return from fopen()
before passing to fileno() etc.
* tests/misc/tee.sh: Add a test case.
2023-03-06 Paul Eggert
maint: pacify ‘make syntax-check’
Problem reported by Pádraig Brady (Bug#61386#226).
* src/split.c (parse_chunk): Use die instead of error.
(main): Quote a string.
* tests/local.mk (all_root_tests): Move du/apparent.sh from here ...
(all_tests): ... to here.
2023-03-06 Pádraig Brady
tail,tee: avoid issues with many files on systems without poll
* src/iopoll.c (iopoll): Protect the call to select against
passing in a descriptor larger than FD_SETSIZE.
2023-03-05 Paul Eggert
du: --apparent counts only symlinks and regular
Problem reported by Christoph Anton Mitterer (Bug#61884).
* src/du.c (process_file): When counting apparent sizes, count
only usable st_size members.
* tests/du/apparent.sh: New file.
* tests/local.mk (all_root_tests): Add it.
2023-03-04 Paul Eggert
split: tune for when creating output files
* src/split.c (create): Avoid fstat + ftruncate in the usual case
where the output file does not already exist, by trying
to create it with O_EXCL first. This costs a failed open
in the unusual case where the output file already exists,
but that’s OK.
split: style fix
* src/split.c (ofile_open): Avoid ‘if (! (a = b))’ style.
split: prefer signed integers to size_t
This allows for better runtime checking with gcc
-fsanitize=undefined.
* src/split.c: Include idx.h.
(open_pipes_alloc, n_open_pipes, suffix_length)
(set_suffix_length, input_file_size, sufindex, outbase_length)
(outfile_length, addsuf_length, create, cwrite, bytes_split)
(lines_split, line_bytes_split, lines_chunk_split)
(bytes_chunk_extract, ofile_open, lines_rr, main):
Prefer signed integers (typically idx_t) to size_t.
split: handle large numbers better
Prefer signed types to uintmax_t, as this allows for better
runtime checking with gcc -fsanitize=undefined.
Also, when an integer overflows just use the maximal value
when the code will do the right thing anyway.
* src/split.c (set_suffix_length, bytes_split, lines_split)
(line_bytes_split, lines_chunk_split, bytes_chunk_extract)
(lines_rr, parse_chunk, main):
Prefer a signed type (typically intmax_t) to uintmax_t.
(strtoint_die): New function.
(OVERFLOW_OK): New macro. Use it elsewhere, where we now allow
LONGINT_OVERFLOW because the code then does the right thing on all
practical platforms (they have int wide enough so that it cannot
be practically exhausted). We can do this now that we can safely
assume intmax_t has at least 64 bits.
(parse_n_units): New function.
(parse_chunk, main): Use it.
(main): Do not worry about integer overflow when the code
will do the right thing anyway with the extreme value.
Just use the extreme value.
* tests/split/fail.sh: Adjust to match new behavior.
split: prefer ssize_t for read result
* src/split.c (bytes_split, lines_chunk_split)
(bytes_chunk_extract, main): Prefer ssize_t to size_t when
representing the return value of ‘read’. Use a negative value
instead of SIZE_MAX to indicate a missing value.
split: be more careful about buffer sizes
* src/split.c: Include sys-limits.h, not safe-read.h.
(input_file_size, bytes_split, lines_split, line_bytes_split)
(lines_chunk_split, bytes_chunk_extract, lines_rr): Call read, not
safe_read, since safe_read no longer buys us anything.
(main): Reject outlandish buffer sizes right away,
rather than allocating huge buffers and never using them.
split: minor -1 / 0 refactor
* src/split.c (create, bytes_split, ofile_open):
Prefer comparing to 0 to comparing to -1.
split: don’t worry about ECHILD
* src/split.c (closeout): There should be no need for a special
case for ECHILD, since we never wait for the same child twice.
Simplify with this in mind.
split: don’t assume pid_t fits in int
* src/split.c (filter_pid): Now pid_t, not int.
(of_t): opid member is now pid_t, not int.
split: simplify SIGPIPE handling
Ignore and default SIGPIPE, rather than blocking and unblocking it.
* src/split.c (default_SIGPIPE):
New static var, replacing oldblocked and newblocked.
(create): Use it.
(main): Set it.
split: port ‘split -n N /dev/null’ better to macOS
* src/split.c (input_file_size): Do not bother with lseek if the
initial read probe reaches EOF, since the file size is known then.
This works better on macOS, which doesn’t allow lseek on /dev/null.
Do not special-case size-zero files, as the issue can occur
with any size file (though /proc files are the most common).
If the current position is past end of file, treat this as
size zero regardless of whether the file has a usable st_size.
Pass through lseek -1 return values rather than using ‘return -1’;
this makes the code a bit easier to analyze (and a bit faster).
Avoid undefined behavior if the size calculation overflows.
(lines_chunk_split): Do not bother with lseek if it would have
no effect if successful. This works better on macOS, which
doesn’t allow lseek on /dev/null.
* tests/split/l-chunk.sh: Adjust to match fixed behavior.
maint: fix NEWS quoting
* NEWS: Use English-language quoting in recent news.
split: split more evenly with -n
* src/split.c (bytes_split): New arg REM_BYTES.
Use this to split more evenly. All callers changed.
(lines_chunk_split, bytes_chunk_extract):
Be consistent with new byte_split.
* tests/split/b-chunk.sh, tests/split/l-chunk.sh: Test new behavior.
split: small -n lines simplification
* src/split.c (lines_chunk_split):
Rewrite while as if-while for clarity.
split: refactor lines_chunk_split
* src/split.c (lines_chunk_split): Simplify by having chunk_end
point to the first byte after the chunk, rather than to the last
byte of the chunk. This will reduce confusion once we allow
chunks to be empty.
tee: tune when later -p overrides earlier
* src/tee.c (pipe_check): Make this a local var instead
of a static var. This suppresses a -Wmaybe-uninitialized
diagnostic with gcc 12.2.1 20221121 (Red Hat 12.2.1-4).
(main): Don’t set pipe_check unnecessarily if a later
-p option overrides an earlier one that wants pipe_check.
Problem discovered when I investigated the GCC warning.
2023-03-01 Pádraig Brady
maint: refactor tail.c to use iopoll
* src/tail.c (check_output_alive): Reuse iopoll()
rather than directly calling poll() or select().
* src/iopoll.c (iopoll): Refactor to support non blocking operation,
or ignoring descriptors by passing a negative value.
* src/iopoll.h (iopoll): Adjust to support a BLOCK parameter.
* src/tee.c (tee_files): Adjust iopoll() call to explicitly block.
* src/local.mk: Have tail depend on iopoll.c.
2023-02-28 Pádraig Brady
tail: avoid undefined behavior when polling outputs
* src/tail.c (check_output_alive): Only check the returned
events from poll() when it indicates there are events to check.
doc: tee -p: clarify operation
* src/tee.c (usage): Change from describing one (non pipe) aspect
to the more general point of being the option to use if working with
pipes, and referencing the more detailed info below.
* doc/coreutils.texi (tee invocation): s/standard/appropriate/ since
the standard operation with pipes is to exit immediately upon write
error. s/early/immediately/ as it's ambiguous as to what "early"
is in relation to.
tests: tee -p: add test for early exit with closed pipes
* tests/misc/tee.sh: Add a test for the new iopoll logic
to detect closed outputs and exit early without needing
further input.
2023-02-28 Carl Edquist
tee: enhance -p mode using iopoll() to detect broken pipe outputs
If input is intermittent (a tty, pipe, or socket), and all remaining
outputs are pipes (eg, >(cmd) process substitutions), exit early when
they have all become broken pipes (and thus future writes will fail),
without waiting for more input to become available, as future write
attempts to these outputs will fail (SIGPIPE/EPIPE).
Only provide this enhancement when pipe errors are ignored (-p mode).
Note that only one output needs to be monitored at a time with iopoll(),
as we only want to exit early if _all_ outputs have been removed.
* src/tee.c (pipe_check): New global for iopoll mode.
(main): enable pipe_check for -p, as long as output_error ignores EPIPE,
and input is suitable for iopoll().
(get_next_out): Helper function for finding next valid output.
(fail_output, tee_files): Break out write failure/output removal logic
to helper function.
(tee_files): Add out_pollable array to track which outputs are suitable
for iopoll() (ie, that are pipes); track first output index that is
still valid; add iopoll() broken pipe detection before calling read(),
removing an output that becomes a broken pipe.
* src/local.mk (src_tee_SOURCES): include src/iopoll.c.
* NEWS: Mention tee -p enhancement in Improvements.
* doc/coreutils.texi: Mention the new early exit behavior in the nopipe
modes for the tee -p option.
Suggested-by: Arsen Arsenović
2023-02-28 Carl Edquist
all: add broken pipe detection while waiting for input
When a program's output becomes a broken pipe, future attempts to write
to that ouput will fail (SIGPIPE/EPIPE). Once it is known that all
future write attepts will fail (due to broken pipes), in many cases it
becomes pointless to wait for further input for slow devices like ttys.
Ideally, a program could use this information to exit early once it is
known that future writes will fail.
Introduce iopoll() to wait on a pair of fds (input & output) for input
to become ready or output to become a broken pipe.
This is relevant when input is intermittent (a tty, pipe, or socket);
but if input is always ready (a regular file or block device), then
a read() will not block, and write failures for a broken pipe will
happen normally.
Introduce iopoll_input_ok() to check whether an input fd is relevant
for iopoll().
Experimentally, broken pipes are only detectable immediately for pipes,
but not sockets. Errors for other file types will be detected in the
usual way, on write failure.
Introduce iopoll_output_ok() to check whether an output fd is suitable
for iopoll() -- namely, whether it is a pipe.
iopoll() is best implemented with a native poll(2) where possible, but
fall back to a select(2)-based implementation platforms where there are
portability issues. See also discussion in tail.c.
In general, adding a call to iopoll() before a read() in filter programs
also allows broken pipes to "propagate" backwards in a shell pipeline.
* src/iopoll.c, src/iopoll.h (iopoll): New function implementing broken
pipe detection on output while waiting for input.
(IOPOLL_BROKEN_OUTPUT, IOPOLL_ERROR): Return codes for iopoll().
(IOPOLL_USES_POLL): Macro for poll() vs select() implementation.
(iopoll_input_ok): New function to check whether an input fd is relevant
for iopoll().
(iopoll_output_ok): New function to check whether an input fd is
suitable for iopoll().
* src/local.mk (noinst_HEADERS): add src/iopoll.h.
2023-02-27 Pádraig Brady
build: update to latest gnulib
* NEWS: Mention the fts fix to avoid the following assert
in rm on mem pressure:
Program terminated with signal SIGSEGV, Segmentation fault.
at ../lib/cycle-check.c:60
assure (state->magic == CC_MAGIC);
* gnulib: Update to the latest to pick up fts commit f17d3977.
2023-02-26 Pádraig Brady
tests: avoid hang in new test
* tests/rm/empty-inacc.sh: Ensure we're not reading from stdin
when we're relying on no prompt to proceed. Also change the
file being tested so that a failure in one test doesn't impact
following tests causing a framework failure.
2023-02-26 Pádraig Brady
tests: avoid gdb on macOS
gdb was seen to hang intermittently on macOS 12.
Also gdb requires signing on newer macOS systems:
https://sourceware.org/gdb/wiki/PermissionsDarwin
So restrict its use on macOS systems for now.
* tests/rm/r-root.sh: Skip on darwin systems.
* tests/tail-2/inotify-race.sh: Restrict the test to
inotify capable systems to avoid the hang with some gdbs.
* tests/tail-2/inotify-race.sh: Likewise.
2023-02-24 Pádraig Brady
cp,install,mv: --debug: output debug info when reflinking
* src/copy.c (copy_reg): Always check whether to output debug info.
(emit_debug): Restrict output with `cp --attributes-only`.
2023-02-24 Pádraig Brady
tests: determine if SEEK_HOLE is enabled
Upcomming gnulib changes may disable SEEK_HOLE
even if the system supports it, so dynamically
check if we've SEEK_HOLE enabled.
* init.cfg (seek_data_capable_): SEEK_DATA may be disabled in the build
if the system support is deemed insufficient, so also use `cp --debug`
to determine if it's enabled.
* tests/cp/sparse-2.sh: Adjust to a more general diagnostic.
* tests/cp/sparse-extents-2.sh: Likewise.
* tests/cp/sparse-extents.sh: Likewise.
* tests/cp/sparse-perf.sh: Likewise.
2023-02-24 Pádraig Brady
cp,install,mv: add --debug to explain how a file is copied
How a file is copied is dependent on the sparseness of the file,
what file system it is on, what file system the destination is on,
the attributes of the file, and whether they're being copied or not.
Also the --reflink and --sparse options directly impact the operation.
Given it's hard to reason about the combination of all of the above,
the --debug option is useful for users to directly identify if
copy offloading, reflinking, or sparse detection are being used.
It will also be useful for tests to directly query if
these operations are supported.
The new output looks as follows:
$ src/cp --debug src/cp file.sparse
'src/cp' -> 'file.sparse'
copy offload: yes, reflink: unsupported, sparse detection: no
$ truncate -s+1M file.sparse
$ src/cp --debug file.sparse file.sparse.cp
'file.sparse' -> 'file.sparse.cp'
copy offload: yes, reflink: unsupported, sparse detection: SEEK_HOLE
$ src/cp --reflink=never --debug file.sparse file.sparse.cp
'file.sparse' -> 'file.sparse.cp'
copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE
* doc/coreutils.texi (cp invocation): Describe the --debug option.
(mv invocation): Likewise.
(install invocation): Likewise.
* src/copy.h: Add a new DEBUG member to cp_options, to control
whether to output debug info or not.
* src/copy.c (copy_debug): A new global structure to
unconditionally store debug into from the last copy_reg operations.
(copy_debug_string, emit_debug): New functions to print debug info.
* src/cp.c: if ("--debug") x->debug=true;
* src/install.c: Likewise.
* src/mv.c: Likewise.
* tests/cp/debug.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.
2023-02-23 Paul Eggert
build: update gnulib submodule to latest
2023-02-23 Pádraig Brady
doc: chgrp,chmod,chown: state --reference always dereferences
* src/chgrp.c (usage): State that --reference always
dereferences symbolic links.
* src/chmod.c (usage): Likewise.
* src/chown.c (usage): Likewise.
Fixes https://bugs.gnu.org/61720
2023-02-21 ChuanGang Jiang
doc: fix some spelling mistakes
* doc/coreutils.texi: s/functionalty/functionality/,
s/sychronize/synchronize/, s/millsecond/millisecond/
s/paramter/parameters/
* init.cfg: s/parmeters/parameters/
* scripts/build-older-versions/README.older-versions: s/vesion/version/
* tests/misc/env-S-script.sh: s/paramaters/parameters/
Fixes https://bugs.gnu.org/61681
2023-02-21 Pádraig Brady
maint: avoid -Wmaybe-uninitialized warning from GCC13
* src/copy.c (infer_scantype): Always set scan_inference.ext_start,
as per commit 6c03e8fb which was inadvertently reverted by d374d32c.
2023-02-21 Jim Meyering
tests: initialize a variable
* tests/rm/interactive-once.sh (write_prot_msg1): Initialize it,
so an envvar setting cannot perturb the test.
2023-02-21 Jim Meyering
rm: --dir (-d): fix bugs in handling of empty, inaccessible directories
* src/remove.c (prompt, rm_fts): In the dir-handling code of both of
these functions, relax a "get_dir_status (...) == DS_EMPTY" condition
to instead test only "get_dir_status (...) != 0", enabling flow control
to reach the prompt function also for unreadable directories. However,
that function itself also needed special handling for this case:
(prompt): Handle empty, inaccessible directories properly,
deleting them with -d (--dir), and prompting about whether to delete
with -i (--interactive).
* tests/rm/empty-inacc.sh: Add tests for the new code.
Reported by наб in
bugs.debian.org/1015273
* NEWS (Bug fixes): Mention this.
2023-02-18 Paul Eggert
tests: port chmod/setgid.sh to macOS 12
* tests/chmod/setgid.sh: Try all the groups you’re a member of,
in case id -g returns 4294967295 (nogroup) which is special
and does not let you chgrp a file to it.
tests: port better to macOS group numbers
* init.cfg (groups): Port better to macOS 12, where
group 4294967295 (nogroup) is special: you can be a member
without being able to chgrp files to the group.
build: update gnulib submodule to latest
2023-02-16 Paul Eggert
cp: fclonefileat security fix + CLONE_ACL + fixups
* src/copy.c: Some changes if HAVE_FCLONEFILEAT && !USE_XATTR.
(fd_has_acl): New function.
(CLONE_ACL): Default to 0.
(copy_reg): Use CLONE_NOFOLLOW to avoid races like CVE-2021-30995
.
Use CLONE_ACL if available and working, falling back to cloning
without it if it fails due to EINVAL.
If the only problem with fclonefileat is that it would create the
file with the wrong timestamp, or with too few permissions,
do that but fix the timestamp and permissions afterwards,
rather than falling back on a traditional copy.
2023-02-10 ChuanGang Jiang
maint: fix some typos in comments
* NEWS: s/commmand/command/
* cfg.mk: Adjust old_NEWS_hash with `make update-NEWS-hash`.
* src/expand-common.c: s/specifed/specified/
* src/pr.c: s/e.g/e.g./
* tests/misc/comm.pl: s/ouput/output/
Fixes https://bugs.gnu.org/61405
2023-02-10 Paul Eggert
cp: simplify infer_scantype
* src/copy.c (infer_scantype): Do not set *SCAN_INFERENCE
when returning a value other than LSEEK_SCANTYPE.
This is just minor refactoring; it simplifies the code a bit.
Callers are uneffected.
doc: document --preserve=mode better
2023-02-06 Pádraig Brady
tail: improve --follow=name with single non regular files
* src/tail (tail_forever): Attempt to read() from non blocking
single non regular file, which shouldn't block, but also
read data even when the mtime doesn't change.
* NEWS: Mention the improvement.
* THANKS.in: Thanks for detailed testing.
2023-02-06 Pádraig Brady
tail: fix support for -F with non seekable files
This was seen to be an issue when following a
symlink that was being updated to point to
different underlying devices.
* src/tail.c (recheck): Guard the lseek() call to only
be performed for regular files.
* NEWS: Mention the bug fix.
2023-02-06 Pádraig Brady
cksum: add --raw option to output a binary digest
--raw output is the most composable format, and also is a
robust way to discard the file name without parsing (escaped) output.
Examples:
$ cksum --raw -a crc "$afile" | basenc --base16
4ACFC4F0
$ cksum --raw -a crc "$afile" | basenc --base2msbf
01001010110011111100010011110000
$ cksum --raw -a sha256 "$bfile" | basenc --base32
AAAAAAAADHLGRHAILLQWLAY6SNH7OY5OI2RKNQLSWPY3MCUM4JXQ====
* doc/coreutils.texi (cksum invocation): Describe the new feature.
* src/digest.c (output_file): Inspect the new RAW_DIGEST global,
and output the bytes directly if set.
* src/cksum.c (output_crc): Likewise.
* src/sum.c (output_bsd, output_sysv): Likewise.
* tests/misc/cksum-raw.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.
2023-02-05 Pádraig Brady
build: uptime: avoid issues on systems without utmp.h
* src/uptime.c (print_uptime): Following gnulib commit 9041103
HAVE_UTMP_H will always be defined. Therefore key on whether
the utmp.ut_type member is present.
* boottime.m4 (GNULIB_BOOT_TIME): Assume utmp.h is present.
2023-02-04 Paul Eggert
maint: use alignasof, not stdalign
* .gitignore: Update accordingly.
* bootstrap.conf (gnulib_modules): Replace obsolescent stdalign
with alignasof.
* gl/modules/randread (Depends-on): Depend on alignasof, not stdalign.
maint: prefer https: to git:
The idea is to defend against some adversary-in-the-middle attacks.
build: update gnulib submodule to latest
2023-02-03 Pádraig Brady
maint: avoid line length syntax check failure
* src/cp.c: Adjust source line to be <= 80 chars.
tests: fix exit status check in cp -u test
* tests/cp/preserve-link.sh: This should have been part
of commit v9.1-134-g01503ce73.
2023-02-01 Jim Meyering
cksum: accept new option: --base64 (-b)
* src/digest.c [HASH_ALGO_CKSUM]: Include "base64.h"
[HASH_ALGO_CKSUM] (base64_digest): New global.
[HASH_ALGO_CKSUM] (enum BASE64_DIGEST_OPTION): New enum.
[HASH_ALGO_CKSUM] (long_options): Add "base64".
(valid_digits): Rename from hex_digits, now taking an input length argument.
Adjust callers.
(bsd_split_3): Rename arg from hex_digits to digest.
Add new *d_len parameter for length of extracted digest.
Move "i" declaration down to first use.
(split_3): Rename arg from hex_digits to digest.
Add new *d_len parameter for length of extracted digest.
Instead of relying on "known" length of digest to find the following
must-be-whitespace byte, search for the first whitespace byte.
[HASH_ALGO_CKSUM] (output_file): Handle base64_digest.
[HASH_ALGO_CKSUM] (main): Set base64_digest.
[HASH_ALGO_CKSUM] (b64_equal): New function.
(hex_equal): New function, factored out of digest_check.
(digest_check) Factored part into b64_equal and hex_equal.
Rename local hex_digest to digest.
* tests/misc/cksum-base64.pl: Add tests.
* tests/local.mk (all_tests): Add to the list.
* cfg.mk (_cksum): Define.
(exclude_file_name_regexp--sc_prohibit_test_backticks): Exempt new test.
(exclude_file_name_regexp--sc_long_lines): Likewise.
* doc/coreutils.texi (cksum invocation): Document it.
(md5sum invocation) [--check]: Mention digest encoding auto-detect.
* NEWS (New Features): Mention this.
2023-01-31 Paul Eggert
doc: document --preserve=mode better
* doc/coreutils.texi: Spruce up cp --preserve=mode doc.
cp: improve --preserve usage doc
* src/cp.c (usage): Improve description of --preserve.
cp,mv: skipping due to -u is success, not failure
This reverts the previous change, so that when a file
is skipped due to -u, this is not considered a failure.
* doc/coreutils.texi: Document this.
* src/copy.c (copy_internal): If --update says to skip,
treat this as success instead of failure.
* tests/mv/update.sh, tests/cp/slink-2-slink.sh:
Revert previous change, to match reverted behavior.
cp,ln,mv: when skipping exit with nonzero status
* NEWS, doc/coreutils.texi: Document this.
* src/copy.c (copy_internal):
* src/ln.c (do_link): Return false when skipping action due to
--interactive or --no-clobber.
* tests/cp/cp-i.sh, tests/cp/preserve-link.sh:
* tests/cp/slink-2-slink.sh, tests/mv/i-1.pl, tests/mv/i-5.sh:
* tests/mv/mv-n.sh, tests/mv/update.sh:
Adjust expectations of exit status to match revised behavior.
2023-01-30 Pádraig Brady
tests: cksum: fix test to include more cases
* tests/misc/cksum-c.sh: Fix typo which caused part
of the test data to be ignored.
2023-01-30 Jim Meyering
digest.c: remove a duplicate variable
* src/digest.c (digest_check): Locals n_misformatted_lines and
n_improperly_formatted_lines were declared and set/incremented
identically. Remove declaration of the latter. Use the other instead.
build: avoid spurious failures due to lack of EGREP definition
* configure.ac: Use AC_PROG_EGREP, since many doc and test rules
use $EGREP.
* cfg.mk (sc_tests_list_consistency): Use grep -E, not $(EGREP) here.
2023-01-27 Pádraig Brady
tests: ensure we fail if mv --no-copy crashes
* tests/mv/no-copy.sh: Honor `make syntax` check
and use the `returns_ 1 ...` pattern.
2023-01-27 Paul Eggert
mv: new option --no-copy
Wishlist item from Mike Frysinger (Bug#61050).
* src/copy.c (copy_internal):
Do not fall back on copying if x->no_copy.
* src/copy.h (struct cp_options): New member no_copy.
* src/mv.c (NO_COPY_OPTION): New constant.
(long_options, usage, main): Support --no-copy.
* tests/mv/no-copy.sh: New test.
* tests/local.mk (all_tests): Add it.
2023-01-17 Pádraig Brady
maint: add lib/error.h to .gitignore
* .gitignore: Add /lib/error.h as suggested by sc_gitignore_missing
as a result of gnulib change 2886cca8.
doc: csplit: more accurate --elide-empty-files help
* src/csplit.c (usage): Use "suppress" rather than "remove"
when describing -z so it's more apparent that the effect
is a particular numbered file is not created, rather than
being removed later. I.e., don't suggest -z may induce
gaps in file numbering.
Reported at https://bugs.debian.org/1029103
2023-01-14 Paul Eggert
build: update gnulib submodule to latest
* m4/xattr.m4: Remove. This file is now autogenerated by 'bootstrap',
since it's now in Gnulib. (I did this part by hand.)
2023-01-08 Pádraig Brady
copy: copy_file_range: handle ENOENT for CIFS
* src/copy.c (sparse_copy): Fallback to standard copy upon ENOENT,
which was seen intermittently across CIFS file systems.
* NEWS: Mention the bug fix, though qualify it as an "issue"
rather than a bug, as coreutils is likely only highlighting
a CIFS bug in this case.
Fixes https://bugs.gnu.org/60455
2023-01-07 Paul Eggert
maint: update .gitignore
* .gitignore: Add confdefs*, conftest* (temporaries built
by ‘configure’).
maint: adjust to Gnulib macro renaming
* src/local.mk (LDADD, copy_ldadd, remove_ldadd, src_sort_LDADD)
(src_test_LDADD, copy_ldadd, src_date_LDADD, src_ginstall_LDADD)
(src_ln_LDADD, src_ls_LDADD, src_mktemp_LDADD, src_pr_LDADD)
(src_tac_LDADD, src_touch_LDADD, src_dd_LDADD, src_sleep_LDADD)
(src_sort_LDADD, src_tail_LDADD, src_sort_LDADD, LDADD):
Adjust to recent Gnulib changes.
build: update gnulib submodule to latest
2023-01-06 Pádraig Brady
copy: immediately fail with transient reflink errors
* src/copy.c (handle_clone_fail): A new function refactored
from copy_reg() to handle failures from FICLONE or fclonefileat().
Fail with all errors from FICLONE, unless they're from the set
indicating the file system or file do not support the clone operation.
Also fail with errors from fclonefileat() (dest_dest < 0)
if they're from the set indicating a transient failure for the file.
(copy_ref): Call handle_clone_fail() after fclonefileat() and FICLONE.
(sparse_copy): Call the refactored is_CLONENOTSUP()
which is now also used by the new handle_clone_fail() function.
* NEWS: Mention the bug fix. Also mention explicitly
the older --reflink=auto default change to aid searching.
* cfg.mk: Adjust old_NEWS_hash with `make update-NEWS-hash`.
Fixes https://bugs.gnu.org/60489
all: further adjustments for new Ronna, Quetta SI prefixes
* src/dd.c (parse_integer): Support Q,R suffixes.
* src/od.c (main): Likewise.
* src/split.c (main): Likewise.
* src/stdbuf.c (parse_size): Likewise.
* src/truncate.c (main): Likewise.
* src/sort.c (specify_size_size): Likewise.
Also line length syntax check fix.
* tests/misc/numfmt.pl: Adust top end large number checks
to the new largest values.
* doc/coreutils.texi (numfmt invocation): Add a numfmt example.
* NEWS: Tweak to aid searchability.
2023-01-05 Paul Eggert
numfmt: add support for new SI prefixes
* src/dd, src/head.c, src/od.c, src/sort.c, src/stdbuf.c, src/tail.c:
(usage):
* src/system.h (emit_size_note):
Mention new SI prefixes.
* src/du.c (main):
* src/head.c (head_file):
* src/numfmt.c (suffix_power, suffix_power_char, prepare_padded_number):
* src/shred.c (main):
* src/sort.c (unit_order):
* src/tail.c (parse_options):
Support new SI prefixes.
* src/numfmt.c (MAX_ACCEPTABLE_DIGITS): Increase to 33.
(zero_and_valid_suffixes, valid_suffixes): New constants,
with new SI prefixes.
(valid_suffix, unit_to_umax): Use them.
(prepare_padded_number): Diagnose "999Q" instead of "999Y".
* tests/misc/numfmt.pl, tests/misc/sort.pl:
Adjust tests to match new max.
ls: adjust to Gnulib renaming
* src/local.mk (src_ls_LDADD): In Gnulib,
LIB_HAS_ACL was renamed to FILE_HAS_ACL_LIB.
build: update gnulib submodule to latest
2023-01-03 Bernhard Voelker
maint: avoid grep warning in sc_prohibit_test_minus_ao
Newer grep(1) complains:
$ make sc_prohibit_test_minus_ao
/usr/bin/grep: warning: * at start of expression
prohibit_test_minus_ao
* cfg.mk (exclude_file_name_regexp--sc_prohibit_test_minus_ao): Fix
expression inroduced in v8.24-120-g3205bb178, and narrow down the file
pattern to the 'doc/' directory.
2023-01-02 Pádraig Brady
doc: copy: mention the reinstated I/O size constraints
* NEWS: Mention the change in behavior re block size multiples
to support unusual devices with this constraint.
* src/copy.c (copy_reg): Likewise.
2023-01-02 Paul Eggert
copy: fix possible over allocation for regular files
* bootstrap.conf (gnulib_modules): Add count-leading-zeros,
which was already an indirect dependency, since ioblksize.h
now uses it directly.
* src/ioblksize.h: Include count-leading-zeros.h.
(io_blksize): Treat impossible blocksizes as IO_BUFSIZE.
When growing a blocksize to IO_BUFSIZE, keep it a multiple of the
stated blocksize. Work around the ZFS performance bug.
* NEWS: Mention the bug fix.
Problem reported by Korn Andras at https://bugs.gnu.org/59382
2023-01-01 Pádraig Brady
maint: update all copyright year number ranges
Update to latest gnulib with new copyright year.
Run "make update-copyright" and then...
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Manually update copyright year,
until we fully sync with gnulib at a later stage.
* tests/sample-test: Adjust to use the single most recent year.
2023-01-01 Pádraig Brady
build: update gnulib submodule to latest
mainly to get updated copyright year
* tests/init.sh: Sync with gnulib
2022-12-31 Pádraig Brady
stty: fix off by one column wrapping on output
* src/stty.c (wrapf): Adjust the comparison by 1,
to account for the space we're adding.
* tests/misc/stty.sh: Add a test case.
* NEWS: Mention the fix.
Reported in https://bugs.debian.org/1027442
2022-12-31 Pádraig Brady
copy: attempt copy offload with sparse files by default
This was seen to vastly improve performance
on NFS 4.2 systems by allowing server side copies,
with partially sparse files (avidemux generated mp4 files).
* src/copy.c (lseek_copy): Also set hole_size to 0,
i.e. enable copy_file_range(), with --sparse=auto (the default),
to enable copy offload in this case, as we've strong signal
from SEEK_DATA that we're operating on actual data and not holes here.
* NEWS: Mention the improvement.
Fixes https://bugs.gnu.org/60416
2022-12-29 Pádraig Brady
wc: fix regression determining file size
* src/wc.c (wc): Use off_t rather than size_t
when calculating where to seek to, so that
we don't seek to a too low offset on systems
where size_t < off_t, which would result in
many read() calls to determine the file size.
* tests/misc/wc-proc.sh: Add a test case
sufficient for 32 bit systems at least.
* NEWS: Mention the bug fix.
Reported at https://bugs.debian.org/1027101
maint: avoid recent syntax check failure
* tests/cp/proc-short-read.sh: Adjust so shorter lines.
2022-12-26 Paul Eggert
doc: improve doc of du with CoW etc
Problem reported by Krzysztof Żelechowski (Bug#60335).
* doc/coreutils.texi (du invocation): Reword.
doc: improve du --threshold wording
* doc/coreutils.texi (du invocation): Reword.
tests: accommodate bogomips capitalizations
* tests/cp/proc-short-read.sh: Kernel on ARMv7 Processor rev 3 (v7l)
spells it "BogoMIPS", so allow any capitalization. Patch from
Zach van Rijn in .
2022-12-06 Paul Eggert
build: update gnulib submodule to latest
doc: timezone -> time zone
doc: improve date -I doc
Suggested by Marc Chantreux (bug#59827).
* doc/coreutils.texi (Options for date):
Give formats for -I, like we already do for --rfc-3339.
2022-12-05 Dennis Williamson
build: fix missing inclusion of poll.h on macOS
* src/tail.c: Following on from commit v9.1-55-g324c188cf
also include poll.h for __APPLE__, which was seen to be required
on macOS 11.6
2022-11-29 Pádraig Brady
doc: tee: make -p decription more complete
* doc/coreutils.texi (tee invocation): Give a more
cohesive description of the -p option, and how
it differs from the default operation.
2022-11-20 Arsen Arsenović
scripts: commit-msg: recognize Git cut_lines
This prevents spurious failures from happening when someone sets
commit.verbose or passes -v to commit.
2022-11-15 Paul Eggert
doc: more dash fixes
* doc/coreutils.texi, doc/sort-version.texi: Prefer on "x -- y" to
"x---y" in prose, as the result is more readable in Emacs.
Fix some instances of unescaped ‘-’ that should be minus, not
hyphen. Fix some other instances that should be en dash. No
spaces around en dash when it’s a range.
maint: fix cfg.mk comment
* cfg.mk (sc_texi_long_option_escaped): Fix comment.
2022-11-15 Pádraig Brady
tests: make SIGPIPE trap checking more robust
* init.cfg (trap_sigpipe_or_skip_): A subshell with ignored SIGPIPE
was seen to not terminate, on Solaris 11 at least.
So protect with a timeout(1).
maint: avoid new grep -q syntax-check failures
* cfg.mk: Exclude NEWS from the check.
* init.cfg: s/grep -q/grep >/dev/null/.
* tests/ls/hyperlink.sh: Likewise.
* tests/ls/symlink-quote.sh: Likewise.
maint: avoid misquoting of some --long-options in texi
* cfg.mk (sc_texi_long_option_escaped): A new check to
avoid future instances of this.
* doc/coreutils.texi (Common options): Rearrange this menu
to be less repetitive in each description, and avoid long lines.
Addresses https://bugs.gnu.org/59262
2022-11-15 Paul Eggert
doc: fix markup
Problem reported by Antonio Diaz Diaz (bug#59262).
* doc/coreutils.texi: Use markup in menus to prevent
‘--’ from turning into an em dash, and to be more
consistent.
build: update gnulib submodule to latest
2022-10-28 Pádraig Brady
doc: printf: make "java" encoding example more standard
Note using iconv(1) rather than recode(1) is not appropriate
for this example, as the required functionality is only
available on libiconv's iconv implementation, which is
not installed on most systems.
* doc/coreutils.texi (printf invocation): Use env rather than
/usr/local/bin for the printf command. Escape '%' so more robust.
Also use a locale that exists on modern systems.
2022-10-28 Pádraig Brady
doc: move description of printf options to better location
* doc/coreutils.texi (printf invocation): Move the description
of accepted options from the middle of the unicode discussion.
2022-10-28 Pádraig Brady
printf: with \U, support all valid unicode points
Previously this was restricted to the C99 universal character subset,
which restricted most values <= 0x9F, as that simplifies the C lexer.
However printf(1) doesn't need this restriction.
Note also the bash builtin printf already supports all values <= 0x9F.
* src/printf.c (main): Relax the restriction on points <= 0x9F.
* doc/coreutils.texi (printf invocation): Adjust description.
* tests/misc/printf-cov.pl: Adjust accordingly. Add new cases.
* NEWS: Mention the change in behavior.
Reported at https://bugs.debian.org/1022857
2022-10-26 Pádraig Brady
doc: basenc: reference from base{32,64} docs
* doc/coreutils.texi (base32 invocation): Reference basenc
to improve discoverability.
(base64 invocation): Likewise.
* man/base32.x: Likewise.
* man/base64.x: Likewise.
2022-09-30 Pádraig Brady
doc: sort: mention --version useful for IPv4 addresses
* doc/coreutils.texi (sort invocation): Mention in the
multi invocation sort example that the -V GNU extension
could be used to sort IPv4 addresses, and thus simplify
to a single invocation.
2022-09-28 Pádraig Brady
maint: NEWS: use consistent quoting
* NEWS: Change unmatched curly quote to more consistent single quote.
doc: be more consistent when documenting exit status
* src/system.h (emit_exec_status): A new function to
output standard "Exit status:" info for commands that exec others.
* doc/coreutils.texi (Exit status): Add "ls" and "runcon"
to the list of commands with non standard exit status.
* src/numfmt.c (main): Call initialize_exit_failure() explicitly
to better indicate this utility may exit with something other than
EXIT_FAILURE.
* src/timeout.c (usage): Use more consistent capitalization.
* src/chroot.c: Call emit_exec_status().
* src/env.c: Likewise.
* src/nice.c: Likewise.
* src/nohup.c: Likewise.
* src/runcon.c: Likewise.
* src/stdbuf.c: Likewise.
runcon: fix inconsistent exit status upon write error
* src/runcon.c (main): Call initialize_exit_failure(),
so we use an appropriate exit status upon failure to close stdout.
This should have been part of recent commit ea3ee6df.
* tests/misc/help-version.sh: Adjust test case accordingly.
maint: getlimits: diagnose invalid options
* src/getlimits.c: Don't call initialize_exit_failure()
as it's not needed for standard EXIT_FAILURE returns.
Also use the function variant that diagnoses invalid options.
maint: rmdir: also use DS_... constants here
* src/rmdir.c: As with commit 627c9a97,
use DS_NONEMPTY constant to improve readability.
2022-09-26 Pádraig Brady
wc: add --total={auto,never,always,only} option
without this option, control of when the total is output
is quite awkward. Consider trying to suppress the total line,
which could be achieved with something like:
wc-no-total() { wc "$@" /dev/null | head -n-2; }
As well as being non obvious, it's also non general.
It would give a non failure, but zero count if passed a file on stdin.
Also it doesn't work in conjunction with the --files0-from option,
which would need to be handled differently with something like:
{ find files -print0; printf '%s\0' /dev/null; } |
wc --files0-from=- |
head -n2
Also getting just the total can be awkward as file names
are only suppressed when processing stdin, and
also a total line is only printed if processing more than one file.
For completness this might be achieved currently with:
wc-only-total() {
wc "$@" |
tail -n1 |
sed 's/^ *//; s/ [^ 0-9]*$//'
}
* src/wc.c: Add new --total option.
* tests/misc/wc-total.sh: New test suite for the new option.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (wc invocation): Document the new option.
* THANKS.in: Add suggestor.
* NEWS: Mention the new feature.
2022-09-25 Pádraig Brady
maint: use enums to make dir_status code easier to read
* src/system.h: Add DS_EMPTY, and DS_NONEMPTY enums.
* src/remove.c: Use the new enums to make code easier to understand.
doc: mention the recent rm improvement
* NEWS: Mention the improvement re handling of directory errnos.
maint: fix recent syntax-check failures
* .gitignore: Add new headers from gnulib.
* src/basenc.c: Adjust line length due to replacement
of 'verify' with 'static_assert'.
* src/od.c: Likewise.
2022-09-25 Paul Eggert
rm: fix diagnostics on I/O error
I ran into this problem when attempting to recursively
remove a directory in a filesystem on flaky hardware.
Although the underlying readdir syscall failed with errno == EIO,
rm issued no diagnostic about the I/O error.
Without this patch I see this behavior:
$ rm -fr baddir
rm: cannot remove 'baddir': Directory not empty
$ rm -ir baddir
rm: descend into directory 'baddir'? y
rm: remove directory 'baddir'? y
rm: cannot remove 'baddir': Directory not empty
With this patch I see the following behavior, which
lets the user know about the I/O error when rm tries
to read baddir's directory entries:
$ rm -fr baddir
rm: cannot remove 'baddir': Input/output error
$ rm -ir baddir
rm: cannot remove 'baddir': Input/output error
* src/remove.c (Ternary): Remove. All uses removed.
(get_dir_status): New static function.
(prompt): Last arg is now directory status, not ternary.
Return RM_USER_ACCEPTED if user explicitly accepted.
All uses changed.
Report any significant error in directory status right away.
(prompt, rm_fts): Use get_dir_status to get directory status lazily.
(excise): Treat any FTS_DNR errno as being more descriptive, not
just EPERM and EACCESS. For example, EIO is more descriptive.
(rm_fts): Distinguish more clearly between explicit and implied
user OK.
* src/remove.h (RM_USER_ACCEPTED): New constant.
(VALID_STATUS): Treat it as valid.
* src/system.h (is_empty_dir): Remove, replacing with ...
(directory_status): ... this more-general function.
All uses changed. Avoid undefined behavior of looking at
a non-null readdir pointer after corresponding closedir.
* tests/rm/rm-readdir-fail.sh: Adjust test of internals
to match current behavior.
2022-09-25 Paul Eggert
rm: fix readdir test
* tests/rm/rm-readdir-fail.sh [_DIRENT_HAVE_D_NAMELEN]:
Fix off-by-1 bug in directory entry length.
2022-09-20 Paul Eggert
doc: fix typo in previous change
doc: warn about tabs command (bug#57946)
2022-09-18 Stefan Kangas (tiny change)
all: prefer HTTPS to HTTP
* README-hacking:
* README-prereq:
* THANKS.in:
* doc/sort-version.texi (Other version/natural sort implementations):
* gl/lib/rand-isaac.c:
* gl/tests/test-rand-isaac.c:
* src/operand2sig.c (operand2sig):
* src/remove.c (nonexistent_file_errno):
* tests/misc/env-signal-handler.sh:
* tests/misc/sort-debug-warn.sh (LC_ALL): Prefer HTTPS to HTTP.
Addresses https://bugs.gnu.org/56512
2022-09-18 Paul Eggert
kill: port to picky-conversion hosts
* src/kill.c (send_signals): Don’t rely on conversion overflow
being silent.
2022-09-15 Paul Eggert
maint: fix bootstrap module lists for alignof
* bootstrap.conf (gnulib_modules): Remove alignof, which isn’t
needed since coreutils source modules don’t include alignof.h.
Add stdalign, since they depend on alignof working without
stdalign.h.
maint: prefer static_assert to verify
* bootstrap.conf: Add assert-h.
* gl/lib/randperm.c: Do not include verify.h.
* gl/lib/randperm.c, src/basenc.c, src/dd.c, src/digest.c:
* src/dircolors.c, src/expr.c, src/factor.c, src/ls.c, src/numfmt.c:
* src/od.c, src/seq.c, src/shred.c, src/sort.c, src/stat.c:
Prefer C23’s static_assert to nonstandard verify.
* gl/modules/randperm (Depends-on): Add assert-h.
maint: assume C23 alignof
* gl/lib/randread.c, src/stat.c (print_statfs):
No need to include stdalign.h, now that alignof is a keyword
in C23 and Gnulib arranges for this.
maint: don’t include config.h twice
* gl/lib/fadvise.h, gl/lib/smack.h, src/blake2/blake2-impl.h:
Do not include config.h from a .h file. config.h is supposed
to be included once, at the start of compilation and before
any other file.
build: update gnulib submodule to latest
2022-09-13 Álvar Ibeas (tiny change)
doc: shred: minor fix
* doc/coreutils.texi: Fix wording.
2022-09-13 Paul Eggert
maint: adjust to Gnulib stdbool C23 change
* gl/lib/mbsalign.c, gl/lib/randread.c, gl/lib/targetdir.h:
* gl/lib/xdectoint.c, gl/lib/xfts.c, gl/lib/xfts.h:
* src/blake2/b2sum.c, src/copy.h, src/die.h, src/system.h:
Don’t include , since Gnulib now emulates C23.
build: update gnulib submodule to latest
2022-09-11 Pádraig Brady
stty: give explicit error for unsupported asymmetric speeds
* src/stty.c (check_speed): If difference input and output speeds
are specified, then validate the system supports that, before
interacting with the device.
stty: fix false warnings from [io]speed settings
* src/stty.c (eq_mode): A new function to compare
equivalence of two modes.
(main): Use eq_mode() rather than memcmp() to compare
two modes. Also use stack variables rather than implicitly
initialized static variables. Also remove all uses of
the SPEED_WAS_SET hack since we now more robustly compare modes.
* NEWS: Update the [io]speed fix entry.
Reported at https://bugs.debian.org/1019468
2022-09-02 Pádraig Brady
maint: add lib/gmp.h to .gitignore
* .gitignore: Add generated file. Tested with:
./configure --without-libgmp && make && git status
2022-08-31 Pádraig Brady
stty: add an undocumented ---debug option for more info
* src/stty.c (main): Move internal TESTING code that showed
the new and old mode, upon failure to apply the new mode,
to being runtime controlled with the ---debug option.
Also augment the display to show which items were not
set as expected.
doc: stty: clarify that [-]drain is treated as an option
* doc/coreutils.texi (stty invocation): Say that "drain"
is treated as an option, rather than a line setting,
and so option processing rules apply to it.
Reported in https://bugs.debian.org/1018803
stty: validate ispeed and ospeed arguments
* src/stty.c (apply_settings): Validate [io]speed arguments
against the internal accepted set.
(set_speed): Check the cfset[io]speed() return value so
that we validate against the system supported set.
* tests/misc/stty-invalid.sh: Add a test case.
* NEWS: Mention the bug fix.
Reported in https://bugs.debian.org/1018790
2022-08-29 Pádraig Brady
maint: be defensive in avoiding gnulib's poll module
* src/tail.c (check_output_alive): Add a guard that would
trigger on most platforms, to detect if we're using the
gnulib poll module. That's currently problematic in the
way it emulates poll() using select() and would cause
issues on macOS and AIX at least as poll() is replaced there.
tail: use poll() on macOS
* src/tail.c (check_output_alive): poll() is the most commonly used
interface, so use this on macOS also to minimize divergence.
2022-08-27 Pádraig Brady
tests: runcon: fix new test to skip on non SELinux systems
* tests/misc/runcon-compute.sh: Use our new internal error
125 status to detect SELinux errors, and skip in this case.
doc: NEWS: document recent comm fix, and runcon change
* NEWS: Mention comm bug fix, and runcon change in behavior.
2022-08-27 Pádraig Brady
tests: fix tests after recent runcon change
Following commit v9.1-49-gea3ee6df2
* tests/misc/invalid-opt.pl: Map runcon failure status to 125.
* tests/misc/usage_vs_getopt.sh: Likewise.
2022-08-27 Pádraig Brady
comm: fix NUL --output-delimiter with --total
* src/comm.c (compare_files): Handle the single character
--output-delimeter case separately so that NUL is appropriately
handled.
* doc/coreutils.texi (comm invocation): Fix the description
of --output-delimiter to say an empty delimeter is treated
as a NUL separator, rather than being disallowed.
* tests/misc/comm.pl: Add a test case.
Reported at https://bugs.debian.org/1014008
maint: remove FIXME comment from timeout.c
* src/timeout.c: We shouldn't hardcode `sh -c` as users
can specify that if needed, so remove the comment.
runcon: distinguish runcon specific errors in exit status
* src/runcon.c: Use EXIT_CANCELED (125) instead of EXIT_FAILURE (1),
so that errors specific to runcon can be distinguished,
from those of the invoked program.
* doc/coreutils.texi (runcon invocation): Fix the Exit status
description to say we return 125 (not 127) for internal errors.
* tests/misc/runcon-no-reorder.sh: Add a test case.
2022-08-13 Pádraig Brady
doc: README: split out ancillary information
The README was becoming too long and contained
quite a bit of info only pertaining to rarely used systems, so...
* README: Split out install specific info to README-install.
Also remove a few stale lines, and reorder a few items.
* README-install: A new file split from README.
* Makefile.am [EXTRA_DIST]: Explicitly reference new README-install
file for distribution, since automake only auto adds README.
* TODO: Reference the HPUX info now in README-install.
2022-08-13 Pádraig Brady
ls: support explicit --time=modification selection
* src/ls.c [time_args]: Add support for explicit
'mtime' or 'modification' arguments to --time.
* tests/misc/ls-time.sh: Add explicit --time=mtime usage.
* doc/coreutils.texi (ls invocation): Describe --time=mtime.
* NEWS: Mention the new feature.
2022-08-12 Pádraig Brady
doc: ls: clarify description of timestamps
* src/ls.c (usage): Don't mention "modification" in the
description of ctime (-c), as it's confusing with mtime.
Mention "metadata" when discussing "change" time to
disambiguate from data change time.
* doc/coreutils.texi (ls invocation): State that --time=creation
falls back to using mtime where not available.
2022-08-01 Pierre Marsais
doc: cp: fix --reflink=when typo in texinfo
This behaviour is correctly documented when doing `cp --help`.
There is no `--reflink=when` option.
* doc/coreutils.texi (cp invocation): Fix document stating
that `--reflink` is equivalent to `--reflink=always`.
2022-08-01 Pádraig Brady
doc: uniq: clarify -f operation
* doc/coreutils.texi (uniq invocation): State that leading blanks
are part of the field, and also that -f is one based.
2022-07-30 Pádraig Brady
doc: reference fmt(1) from fold(1)
* man/fold.x: fold and fmt have overlapping functionality,
so reference fmt(1) from the lower level fold(1) utility.
2022-07-27 Paul Eggert
touch: fix aliasing bug
Problem reported by Tim Lange in:
https://lists.gnu.org/r/coreutils/2022-07/msg00008.html
* src/touch.c (date_relative): Rename from get_reldate,
and use a functional style to fix the aliasing bug.
2022-07-26 Pádraig Brady
doc: env: clarify that empty signal args are ignored
It's useful to treat empty and missing arguments differently.
Missing means all signals, while empty means no signals and
so is a no-op. It's useful to treat empty arguments like
this, so that dynamically specified arguments like the following
are supported
env --ignore-signals "$SIGS_TO_IGNORE"
Note `env --ignore-signals=` is treated as an empty argument.
* doc/coreutils.texi (env invocation): Empty args are treated
differently to missing arguments, so call that out explicitly.
* src/env.c (usage): Likewise.
Addresses https://bugs.debian.org/1016049
2022-07-24 Pádraig Brady
doc: date: clarify which options are mutually exclusive
* src/date.c (usage): Specify that --date, --file, --reference,
and --resolution are mutually exclusive. This is also useful
documentation to group similar options.
* doc/coreutils.texi (Options for date): Likewise.
Addresses https://bugs.gnu.org/55401
date: --debug: diagnose discarded -d or -s options
* src/date.c: (main): Track and diagnose whether any
-d or -s options are dropped, as users may think
multiple options are supported, given they can be relative.
* tests/misc/date-debug.sh: Add a test case.
* NEWS: Mention the improvement.
runcon: ensure --compute runs the file it inspects
* src/runcon.c (main): With -c avoid searching the path
to ensure the file specified to --compute is executed.
* tests/misc/runcon-compute.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Reported in https://bugs.debian.org/1013924
doc: tr: clarify that -t is ignored unless translating
* src/tr.c (usage): Don't say that -t is disallowed unless translating.
Reported in https://bugs.debian.org/1012447
2022-07-23 Paul Eggert
rm: don’t assume st_size is nonnegative
* src/remove.c: Include stat-time.h.
(cache_fstatat, cache_stat_init): Use negative st->st_atim.tv_sec to
determine whether the stat is cached, not negative st->st_size.
On non-POSIX platforms that lack st_atim.tv_sec, don’t bother to cache.
2022-07-22 Paul Eggert
stat: -c %s now prints unsigned
* src/stat.c (unsigned_file_size): New static function,
copied from src/ls.c.
(print_stat): %s prints an unsigned value now (Bug#56710).
2022-07-07 Paul Eggert
dd: doc improvement (Bug#54586)
* doc/coreutils.texi (dd invocation): Explain
fdatasync and fsync better.
2022-07-06 Paul Eggert
cp: don’t remove nonempty cloned dest
This follows up on comments by Pádraig Brady (bug#56391).
* src/copy.c (copy_reg): When --reflink=always removes a file
due to an FICLONE failure, do not remove a nonempty file.
2022-07-05 Paul Eggert
cp: don’t create empty file if cannot clone
* src/copy.c (copy_reg): With --reflink=always, if FICLONE fails
on a file we just created, clean up by removing the file (Bug#56391).
2022-07-04 Ivan Radić
maint: fix comment typo
* src/uniq.c: s/preceges/precedes/
2022-06-24 Paul Eggert
shuf: better diagnostic for ‘shuf -i -10-10’
* src/shuf.c: Do not include xdectoint.h.
(main): Improve diagnostic for ‘shuf -i -10-10’. Without this
patch, the diagnostic was “shuf: invalid input range: ‘’” which is
not helpful. Now it is “shuf: invalid input range: ‘-10-10’”.
2022-06-23 Jim Meyering
cp: avoid -Wmaybe-uninitialized warning from GCC13
* src/copy.c (infer_scantype): Always set scan_inference.ext_start,
to make the code match the comment.
maint: remove unnecessary inclusion of hash.h
* src/cut.c: Don't include hash.h. The implementation was
changed not to need that in v8.21-43-g3e466ad05.
2022-06-21 Paul Eggert
maint: prefer POSIX-compatible EREs
* cfg.mk (begword, endword): New macros.
(sc_prohibit_stat_macro_address, sc_prohibit_fail_0)
(sc_prohibit_short_facl_mode_spec, sc_require_stdio_safer)
(sc_prohibit_sleep, sc_prohibit_framework_failure)
(sc_marked_devdiagnostics):
* build-aux/gen-single-binary.sh:
Prefer POSIX-compatible EREs to GNU extensions like \w and \<.
2022-06-11 Paul Eggert
cp: fix ‘cp -rx / /mnt’
Problem reported by pkoraou@gmail.com (Bug#55910).
* src/copy.c (copy_internal): Treat a relative destination name ""
as if it were "." for the purpose of directory-relative syscalls
like fstatat that might might refer to the destination directory.
2022-06-04 Paul Eggert
maint: avoid \] in REs
* cfg.mk (sc_dd_max_sym_length, sc_prohibit_man_see_also_period):
Do not rely on undefined interpretation of \] in regular expressions.
build: update gnulib submodule to latest
* bootstrap: Copy from latest Gnulib.
* tests/misc/ls-misc.pl (v_files): Adjust to new Gnulib behavior.
2022-05-26 Bernhard Voelker
maint: fix spelling in NEWS entry
* NEWS: s/x86-64/x86_64/
2022-05-25 Paul Eggert
maint: spelling fix
sort: tune diff_reversed
* src/sort.c (diff_reversed): Tune. On x86-64 with GCC, this
saves a conditional branch and shortens the generated machine code.
sort: refactor tricky diff reversal
* src/sort.c (diff_reversed): New function, to make the intent clearer.
(keycompare, compare): Use it.
2022-05-25 Pádraig Brady
maint: sort.c: fix syntax-check issue in recent commit
* src/sort.c (keycompare): Avoid useless if before free()
as detected with sc_avoid_if_before_free.
sort: fix issue with -rk in previous commit
* src/sort.c (keycompare): Fix typo causing -r to be
effectively ignored with -k.
Fixes https://bugs.gnu.org/55622
2022-05-18 Paul Eggert
sort: fix unlikely int overflow with -r
* src/sort.c (keycompare, compare): Don’t overflow if -r is
specified and a comparison function returns INT_MIN, as this
causes the comparison to have undefined behavior (typically the
reverse of correct). glibc memcmp on s390x reportedly returns
INT_MIN in some cases, so this is not a purely academic issue.
maint: simplify comparisons
* src/comm.c (compare_files):
* src/join.c (keycmp):
* src/ls.c (off_cmp):
* src/ptx.c (compare_words, compare_occurs):
* src/set-fields.c (compare_ranges):
Prefer ((a > b) - (a < b)) to variants like (a < b ? -1 : a > b)
as it’s typically faster these days.
sort: remove some gotos
* src/sort.c (keycompare): Rework to avoid gotos.
This also shrinks the machine code a bit (112 bytes)
with GCC 12 x86-64 -O2. Nowadays compilers are smart
enough to coalesce jumps so we need not do it by hand.
sort: pacify GCC 12 false positive
* src/sort.c (keycompare): Rework to pacify a GCC 12
-Wmaybe-uninitialized false positive, by coalescing some minor
duplicate code and eliminating a branch. This should execute an
insn or two less in the usual case.
build: update gnulib submodule to latest
2022-05-09 Rasmus Villemoes
factor: --exponents: new option for printing in p^e format
When factoring numbers that have a large 2^n factor, it can be hard to
eyeball just how many 2's there are. Add an option to print each prime
power factor in the p^e format (omitting the exponent when it is 1).
* src/factor.c: Add -h, --exponents option for printing in p^e format.
* doc/coreutils.texi (factor invocation): Document the new option.
* tests/misc/factor.pl: Add test case.
* THANKS.in: Add previous suggester
(https://lists.gnu.org/r/coreutils/2017-11/msg00015.html).
Suggested-by: Emanuel Landeholm
2022-05-02 Pádraig Brady
tests: sort-NaN-infloop: augment testing for recent fix
* tests/misc/sort-NaN-infloop.sh: Add test case from
https://unix.stackexchange.com/a/700967/37127
* src/sort.c: Avoid syntax-check failure.
2022-05-02 Paul Eggert
build: update gnulib submodule to latest
sort: fix sort -g infloop again
Problem reported by Giulio Genovese (Bug#55212).
* src/sort.c (nan_compare): To compare NaNs, simply printf+strcmp.
This avoids the problem of padding bits and unspecified behavior.
Args are now long double instead of char *; caller changed.
2022-04-21 Paul Eggert
mv: test Bug#55029
* tests/mv/backup-dir.sh: New test for Bug#55029,
reported by Steve Ward.
build: update gnulib submodule to latest
2022-04-20 Paul Eggert
pr: don’t use uninitialized var
Found with -flto and --enable-gcc-warnings.
* src/pr.c (getoptarg): Fix misuse of xstrtol, which does not
necessarily set tmp_long on errror, and does not set errno in any
reliable way. The previous code might access uninitialized
storage; on typical platforms this merely causes it to possibly
print the wrong diagnostic.
2022-04-19 Paul Eggert
doc: fix ' and ` in PDF output of code
* doc/coreutils.texi: Set txicodequoteundirected and
txicodequotebacktick so that ' and ` in code examples appear
as-is, rather than being transliterated to ’ and ‘. E.g., prefer
“... this is equivalent to ‘tr '\303\266' '\305\201'’ and ...” to
“... this is equivalent to ‘tr ’\303\266’ ’\305\201’’ and ...”
in PDF output.
doc: fix footnote formats
* doc/coreutils.texi: Reword footnote, or put it right next
to previous punctuation.
doc: prefer ö to $'\u7530'
* doc/coreutils.texi (Character arrays): Avoid using shell
notation like $'\u7530' since this isn’t in POSIX yet. Instead,
use ö and Ł which should work in all texinfo output formats.
2022-04-17 Pádraig Brady
doc: rmdir: clarify --ignore-fail-on-non-empty operation
This option has changed from ignoring only ENOTEMPTY|EEXIST
(i.e. ignore errors _solely_ due to dir not empty),
to ignoring some other errors from more protected dirs
that are not empty. That adjustment was made to better
support use with --parents, to essentially remove as much of
a hierarchy as possible, without erroring as we hit more
protected non empty parent dirs.
That functionality adjustment was originally discussed at:
https://lists.gnu.org/r/bug-coreutils/2008-01/msg00283.html
* src/rmdir.c (usage): Adjust to be more accurate to current behavior.
Also adjust --parents option to be easier to read.
* doc/coreutils.texi (rmdir invocation): Likewise.
Reported at https://github.com/coreutils/coreutils/issues/40
2022-04-15 Pádraig Brady
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
version 9.1
* NEWS: Record release date.
2022-04-15 Pádraig Brady
doc: avoid unicode errors in texi conversion
Avoid "Unicode character U+#1 not supported, sorry" error
when converting from texi to dvi or pdf.
* doc/coreutils.texi (tr invocation): Avoid the @U{XXXX}
texi representation, as even though info and html can represent
these characters directly, there are conversion errors
for pdf and dvi. Instead use the more abstract shell
$'\uXXXX' representation.
2022-04-14 Pádraig Brady
build: copy: fix build on macos 10.12
* src/copy.c (copy_reg): Handle the case where CLONE_NOOWNERCOPY
is not defined.
Reported by Jeffrey Walton
2022-04-13 Pádraig Brady
tail: detect closed stdout on Solaris
* src/tail.c (check_output_alive): Use poll() on Solaris.
Also handle POLLHUP, which Solaris returns in this case.
* tests/tail-2/pipe-f.sh: Use `head -n2` rather than `sed 2q`
as Solaris sed does not exit in this case.
* NEWS: Mention the improvement.
Reported by Bruno Haible.
maint: syntax-check: fix preprocessor indentation
* gl/lib/targetdir.h: Keep '#' at start of line.
2022-04-13 Paul Eggert
cp,mv,install: omit an ‘inline’
* gl/lib/targetdir.c (target_directory_operand):
Omit unnecessary ‘inline’.
cp,mv,install: improve EACCES targetdir messages
This improves on the fix for --target-directory diagnostics bugs on
Solaris 11. Problem reported by Bruno Haible and Pádraig Brady; see:
https://lists.gnu.org/r/coreutils/2022-04/msg00044.html
Also, omit some unnecessary stat calls.
* gl/lib/targetdir.c (target_directory_operand): If !O_DIRECTORY,
do not bother calling open if stat failed with errno != EOVERFLOW.
Rename is_a_dir to try_to_open since that’s closer to what it means.
If the open failed with EACCES and we used O_SEARCH, look at stat
results to see whether errno should be ENOTDIR for better diagnostics.
Treat EOVERFLOW as an “I don’t know whether it’s a directory and
there’s no easy way to find out” rather than as an error.
cp,mv,install: avoid excess stat calls on non-GNU
* gl/lib/targetdir.c (target_directory_operand): New arg ST.
All callers changed.
* src/cp.c (do_copy):
* src/mv.c (main):
Avoid unnecessary stat call if target_directory_operand already
got the status.
cp,mv,install: modularize targetdir
Move target directory code out of system.h to a new targetdir module.
This doesn’t change functionality.
* bootstrap.conf (gnulib_modules): Add targetdir.
* src/cp.c, src/install.c, src/mv.c: Include targetdir.h.
* src/system.h (must_be_working_directory, target_directory_operand)
(targetdir_dirfd_valid): Move from here ...
* gl/lib/targetdir.c, gl/lib/targetdir.h, gl/modules/targetdir:
... to these new files.
2022-04-13 Pádraig Brady
cp,mv,install: avoid EACCES with non directory destination
* src/system.h (target_directory_operand): Also check with stat()
on systems with O_SEARCH, to avoid open("file", O_SEARCH|O_DIRECTORY)
returning EACCES rather than ENOTDIR, which was seen on Solaris 11.4
when operating on non dirs without execute bit set.
* NEWS: Remove related bug entry, as that issue was only introduced
after coreutils v9.0 was released.
Reported by Bruno Haible.
sync: support syncing files on cygwin
* src/sync.c (sync_arg): Similarly to AIX, Cygwin 2.9.0
was seen to need write access to have permission to sync a file.
tests: cygwin: handle ENOENT from execvp(".")
* tests/misc/env.sh: Verify with another command that
execvp() doesn not return ENOENT, before testing the
exit code from the command in question.
* tests/misc/nice-fail.sh: Likewise.
* tests/misc/stdbuf.sh: Likewise.
* tests/misc/timeout-parameters.sh: Likewise.
tests: env-S.pl: unset cygwin hardwired env vars
* tests/misc/env-S.pl: Unset SYSTEMROOT and WINDIR.
2022-04-12 Pádraig Brady
tests: md5sum: fix false failures on cygwin
* tests/misc/md5sum-newline.pl: Avoid binary '*' tags when
comparing checksums.
* tests/misc/md5sum-bsd.sh: Avoid binary '*' tags so that we correctly
trigger the ambiguity test.
Reported by Bruno Haible
2022-04-11 Pádraig Brady
tests: b2sum.sh: fix false failure on cygwin
* tests/misc/b2sum.sh: Avoid binary '*' tags when comparing checksums.
Reported by Bruno Haible
tests: dircolors.pl: avoid false failure with TERM=dumb
* tests/Coreutils.pm: Ensure an unset $TERM env var,
which is required on perl 5.22.2 on Solaris 11 OpenIndiana at least,
where TERM was being reset to 'dumb'.
Reported By Bruno Haible.
tests: printf-mb.sh: fix false failure with french translations
* tests/misc/printf-mb.sh: As per commit 04148c99c,
adjust non C warnings before comparison, to those of LC_MESSAGES=C.
Reported by Adam Sampson
2022-04-10 Pádraig Brady
tests: stty.sh: skip on systems without perl
* init.cfg (stty_reversible_init_): Add require_perl_
to ensure we skip rather than error, without perl.
2022-04-09 Pádraig Brady
cp,mv,install: avoid opening non directory destination
commit v9.0-66-ge2daa8f79 introduced an issue, for example
where cp could hang when overwriting a destination fifo,
when it would try to open() the fifo on systems
like Solaris 10 that didn't support the O_DIRECTORY flag.
This is still racy on such systems, but only in the
case where a directory is replaced by a fifo in
the small window between stat() and open().
* src/system.h (target_directory_operand): On systems without
O_DIRECTORY, ensure the file is a directory before attempting to open().
* tests/cp/special-f.sh: Protect cp with timeout(1),
as cp was seen to hang when trying to overwrite an existing fifo.
* NEWS: Mention the bug fix.
2022-04-09 Pádraig Brady
doc: install --compare: clarify mode of operation
* doc/coreutils.texi (install invocation): For the --compare option,
clarify that the ownership or permissions of the source files don't
matter. Also don't imply --owner or --group need to be specified
for --compare to be effective.
* src/install.c (usage): Add more detail on what's being compared.
Fixes https://bugs.gnu.org/50889
2022-04-08 Pádraig Brady
doc: remove older ChangeLog items
* Makefile.am: Update the oldest documented version
to 8.27 which is now about 5 years old.
2022-04-08 Bernhard Voelker
maint: remove obsolete statat gnulib module
* bootstrap.conf (gnulib_modules): Remove statat.
2022-04-07 Pádraig Brady
build: update gnulib submodule to latest
* gnulib: Update to latest
* src/copy.c: Replace deprecated {l,}statat(), with fstatat().
* src/cp.c: Likewise.
* src/install.c: Likewise.
* src/remove.c: Likewise.
2022-04-04 Pádraig Brady
factor: improve support on RISCV and loongson
* src/longlong.h: Pull in RISCV fix and loongarch64 support from
https://gmplib.org/repo/gmp/log/tip/longlong.h
2022-04-03 Pádraig Brady
doc: describe `dd iseek` as a feature not a change
* NEWS: Move description from "Changes in behavior"
to "New features".
2022-04-03 Pádraig Brady
ls: avoid expensive capability lookup by default
Lookup of file-based capabilities adds 30% overhead to the common
case of ls --color usage. Since the use of file capabilities is
very rare, it doesn't make sense to pay this cost in the common
case. It's better to use getcap to inspect capabilities, and the
following run shows only 8 files using capabilities on my fedora
35 distro (14 years after the feature was introduced to the linux
kernel).
$ getcap -r /
/usr/bin/arping = cap_net_raw+p
/usr/bin/clockdiff = cap_net_raw+p
/usr/bin/gnome-keyring-daemon = cap_ipc_lock+ep
/usr/bin/gnome-shell = cap_sys_nice+ep
/usr/bin/newgidmap = cap_setgid+ep
/usr/bin/newuidmap = cap_setuid+ep
/usr/sbin/mtr-packet = cap_net_raw+ep
/usr/sbin/suexec = cap_setgid,cap_setuid+ep
* src/dircolors.hin: Set "CAPABILITY" to "00", to indicate unused.
* src/ls.c: Set the default C_CAP color to not colored.
* NEWS: Mention the change in behavior.
2022-04-03 Ville Skyttä
dircolors: colorize backup files with bright black
* src/dircolors.hin: Add patterns for suffixes for "backup files".
The color used is so they stand out less than non-backup files,
and bright black works well on both light and dark backgrounds.
* THANKS.in: Remove duplicate.
Fixes https://bugs.gnu.org/54521
2022-03-29 Pádraig Brady
doc: join: clarify that -e only effective for -12jo fields
* src/join.c (usage): Clarify that -e is not sufficient
to enable output of missing fields from one of the inputs.
Rather the -12jo options are required to explicitly
enable output of those fields.
Fixes https://bugs.gnu.org/54625
2022-03-25 Pádraig Brady
maint: sync latest bootstrap from gnulib
* bootstrap: Should have updated this with the last gnulib update.
2022-03-20 Pádraig Brady
tests: improve recent printf test
* tests/misc/printf-mb.sh: Given we shortcut the single char
(invalid multi-byte) case, add a case to ensure we're correctly
checking the return from mbrtowc().
2022-03-19 Pádraig Brady
printf: support printing the numeric value of multi-byte chars
* src/printf.c (STRTOX): Update to support multi-byte chars.
* tests/misc/printf-mb.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
Fixes https://bugs.gnu.org/54388
2022-03-18 Pádraig Brady
maint: move build-related NEWS item to its own section
* NEWS: Follow other Build-related patterns in NEWS.
2022-03-12 Pádraig Brady
doc: test: clarify that -rwx don't just check perm bits
* src/test.c (usage): State that -rwx is determined by
user access, rather than permission bits.
* doc/coreutils.texi (Access permission tests): Likewise.
* man/test.x [SEE ALSO]: access(2).
Fixes https://bugs.gnu.org/54338
2022-03-07 Pádraig Brady
maint: address syntax-check issues in recent commit
* cfg.mk (sc_die_EXIT_FAILURE): Generalize to match any EXIT_ define,
and also relax to ignore error() usage with ternary operator.
* src/chroot.c (main): Use () to avoid the sc_error_quotes check.
2022-03-07 Pádraig Brady
stat: only automount with --cached=never
Revert to the default behavior before the introduction of statx().
* src/stat.c (do_stat): Set AT_NO_AUTOMOUNT without --cached=never.
* doc/coreutils.texi (stat invocation): Mention the automount
behavior with --cached=never.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/54287
2022-03-07 Rohan Sable
ls: avoid triggering automounts
statx() has different defaults wrt automounting
compared to stat() or lstat(), so explicitly
set the AT_NO_AUTOMOUNT flag to suppress that behavior,
and avoid unintended operations or potential errors.
* src/ls.c (do_statx): Pass AT_NO_AUTOMOUNT to avoid this behavior.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/54286
2022-03-07 Pádraig Brady
build: ensure AT_NO_AUTOMOUNT is defined
update gnulib submodule to latest,
where this is the only change
2022-03-05 Paul Eggert
date: fix newly-introduced %%-N bug
* src/date.c (adjust_resolution): Don’t mishandle %%-N.
* tests/misc/date.pl (pct-pct): New test.
2022-02-25 Paul Eggert
chown: warn about USER.GROUP
Suggested by Dan Jacobson (Bug#44770).
* src/chown.c, src/chroot.c (main):
Issue warnings if obsolete USER.GROUP notation is present.
build: update gnulib submodule to latest
2022-02-24 Pádraig Brady
fmt: fix invalid multi-byte splitting on macOS
On macOS, isspace(0x85) returns true,
which results in splitting within multi-byte characters.
* src/fmt.c (get_line): s/isspace/c_isspace/.
* tests/fmt/non-space.sh: Add a new test.
* tests/local.mk: Reference new test.
* NEWS: Mention the fix.
Addresses https://bugs.gnu.org/54124
2022-02-24 Pádraig Brady
tests: improve compat with macOS
* tests/misc/wc-nbsp.sh: Only the en_US.iso8859-1 form
is accepted on macOS 10.15.7 at least. GNU/Linux also
accepts ISO-8859-1 (and canonicalizes the charmap to this).
2022-02-23 Paul Eggert
dd: counts ending in "B" now count bytes
This implements my suggestion in Bug#54112.
* src/dd.c (usage): Document the change.
(parse_integer, scanargs): Implement the change.
Omit some now-obsolete checks for invalid flags.
* tests/dd/bytes.sh: Test the new behavior, while retaining
checks for the now-obsolete usage.
* tests/dd/nocache_eof.sh: Avoid now-obsolete usage.
2022-02-22 Paul Eggert
dd: improve doc relative to POSIX
* doc/coreutils.texi (dd invocation): Improve documentation,
clarifying whether features are extensions to POSIX.
dd: support iseek= and oseek=
Alias iseek=N to skip=N, oseek=N to seek=N (Bug#45648).
* src/dd.c (scanargs): Parse iseek= and oseek=.
* tests/dd/skip-seek.pl (sk-seek5): New test case.
2022-02-21 Paul Eggert
cp: avoid unnecessary buffer allocation
Do not allocate I/O buffer if copy_file_range suffices.
* src/copy.c (sparse_copy, lseek_copy): Buffer arg is now char **
instead of char *, and buffer is now allocated only if needed.
All uses changed.
2022-02-19 Paul Eggert
build: update gnulib submodule to latest
2022-02-15 Pádraig Brady
doc: env: fix man page reference of exec(2) to exec(3p)
* man/env.x: Change exec() reference from section 2 to 3p.
2022-02-15 Pádraig Brady
doc: use bold style for man page references
It's more common to use bold style than not,
for references to other man pages.
Ideally each man page renderer would highlight references,
but currently some rely on styles in the page itself.
* man/help2man: Implement a --bold-refs option that
will mark up references like "name(1)" with bold
style around the "name" component.
* man/local.mk: Pass --bold-refs to our help2man unless disabled.
* configure.ac: Add a --disable-bold-man-page-references option.
Addresses https://bugs.gnu.org/53977
2022-02-15 Pádraig Brady
dircolors: speed up processing of TERM entries
* src/dircolors.c (main): Avoid glob matching
when we've already matched in a group of {COLOR,}TERM entries.
2022-02-15 Pádraig Brady
dircolors: consider COLORTERM as well as TERM env vars
COLORTERM is an environment used usually to expose truecolor support in
terminal emulators. Therefore support matches on that in addition
to TERM. Also set the default COLORTERM match pattern so that
we apply colors if COLORTERM is any value.
This implicitly supports a terminal like "foot"
without a need for an explicit TERM entry.
* NEWS: Mention the new feature.
* src/dircolors.c (main): Match COLORTERM like we do for TERM.
* src/dircolors.hin: Add default config to match any COLORTERM.
* tests/misc/dircolors.pl: Add test cases.
2022-02-14 Paul Eggert
tr: mention multibyte problem in man page
* man/tr.x: Document tr problem.
tr: improve multibyte etc. doc
Problem reported by Dan Jacobson (Bug#48248).
* doc/coreutils.texi (tr invocation): Improve documentation for
tr's failure to support multibyte characters POSIX-style.
* doc/coreutils.texi (tr invocation), src/tr.c (usage):
Use terminology closer to POSIX's.
2022-02-13 Pádraig Brady
dircolors: add --print-ls-colors to display colored entries
* NEWS: Mention the new feature.
* doc/coreutils.texi (dircolors invocation): Describe the new
--print-ls-colors option.
* src/dircolors.c (print_ls_colors): A new global to select
between shell or terminal output.
(append_entry): A new function refactored from dc_parse_stream()
to append the entry in the appropriate format.
(dc_parse_stream): Adjust to call append_entry().
* tests/misc/dircolors.pl: Add test cases.
2022-02-13 Pádraig Brady
chown,chgrp: reinstate numeric id output in -v messages
since gnulib commit ff208d546a,
related to coreutils commit v9.0-143-gabde15969
we no longer maintain numeric IDs through chopt->{user,group}_name.
Therefore we need to adjust to ensure tests/chown/basic.sh passes.
* src/chown-core.c (uid_to_str, gid_to_str): New helper functions
to convert numeric id to string.
(change_file_owner): Use the above new functions to pass
numeric ids to describe_change().
2022-02-13 Paul Eggert
sort: fix several version-sort problems
This also affects ls -v in some corner cases.
Problems reported by Michael Debertol .
While looking into this, I spotted some more areas where the
code and documentation did not agree, or where the documentation
was unclear. In some cases I changed the code; in others
the documentation. I hope things are nailed down better now.
* doc/sort-version.texi: Distinguish more carefully between
characters and bytes. Say that non-identical strings can
compare equal, since they now can. Improve readability in
various ways. Make it clearer that a suffix can be the
entire string.
* src/ls.c (cmp_version): Fall back on strcmp if filevercmp
reports equality, since filevercmp is no longer a total order.
* src/sort.c (keycompare): Use filenvercmp, to treat NULs correctly.
* tests/misc/ls-misc.pl (v_files):
Adjust test to match new behavior.
* tests/misc/sort-version.sh: Add tests for stability,
and for sorting with NUL bytes.
build: update gnulib submodule to latest
2022-02-12 Pádraig Brady
doc: avoid using "[" is URLS in --help output
* src/system.h (emit_ancillary_info): While supported if entered
manually, the "[" character is not highlighted as part of a
URL by default in terminals, so avoid using it.
Addresses https://bugs.gnu.org/53946
doc: adust --help, --version alignment
* src/system.h: Adjust the alignment of the --help
and --version option descriptions, to start at column 21.
This better aligns with the descriptions of most commands,
and also aligns with the minimum column a description must
start at to ensure a blank line is not output when a description
follows an option on a line by itself.
doc: rmdir: improve --help formatting
* src/rmdir.c (usage): Move description to column 21,
so that a --long-option on its own line without a
trailing description, doesn't have an erroneous blank
line inserted between the option and description.
Also group descriptions with blank lines rather than indents,
so that man pages don't have erroneous blank lines
added within the description.
Addresses https://bugs.gnu.org/53946
doc: ls: reference dircolors(1) from --help
* src/ls.c (usage): s/dircolors/dircolors(1)/.
* man/ls.x [SEE ALSO]: Reference dircolors(1).
Addresses https://bugs.gnu.org/53946
doc: ls: improve --help formatting
* src/ls.c (usage): Use blank lines to group multi-line
option descriptions, rather than indenting.
This results in more consistent alignment of descriptions,
and also avoids erroneous new lines in generated in man pages.
Addresses https://bugs.gnu.org/53946
2022-02-08 Paul Eggert
doc: improve version-sort doc
* doc/coreutils.texi, doc/sort-version.texi:
Capitalize “Coreutils”.
* doc/sort-version.texi: Don’t emphasize natural sort so much,
since Coreutils has just version sort.
Use the term “lexicographic” instead of “alphabetic” or “standard”.
Suggest combining ‘V’ with ‘b’, and show why ‘b’ is needed.
Use shorter titles for sections, as GNU Emacs displays info poorly
when titles are too long to fit in a line.
Use @samp instead of @code for samples of data.
Do not use @samp{@code{...}}; @samp{...} should suffice and
double-nesting looks bad with Emacs.
Omit blank lines in examples that would not be present
in actual shell sessions.
Quote with `` and '', not with " or with '.
Mention dpkg --compare-versions more prominently.
Don’t rely on "\n" being equivalent to "\\n" in shell args.
Prefer Unicode name for hyphen-minus.
2022-02-07 Christian Hesse
dircolors: highlight .avif as image
This add highlighting for AV1 Image File Format (AVIF):
https://aomediacodec.github.io/av1-avif/
* src/dircolors.hin: Highlight .avif as image.
2022-02-05 Paul Eggert
date: test against bug#50115
* tests/misc/date.pl: Add test.
build: update gnulib submodule to latest
2022-02-05 Pádraig Brady
doc: fix somewhat ambiguous date format representation
* doc/coreutils.texi (date invocation): Remove @var{...} usage,
as that capitalizes in the representation and thus somewhat
ambiguates the format wrt Month and Minute. This also avoids
a syntax check failure about redundant capitalization in @var{}.
2022-02-05 Paul Eggert
date: improve doc
Problem reported by Dan Jacobson (Bug#51288).
* doc/coreutils.texi (date invocation, Setting the time)
(Options for date):
* src/date.c (usage): Improve doc.
build: update gnulib submodule to latest
2022-02-04 Paul Eggert
id: print groups of listed name
Problem reported by Vladimir D. Seleznev (Bug#53631).
* src/id.c (main): Do not canonicalize user name before
deciding what groups the user belongs to.
2022-02-01 Bernhard Voelker
doc: add NEWS entry for recent cksum change
* NEWS (Changes in behavior): Add entry for commit v9.0-92-ga42a03913.
2022-02-01 Paul Eggert
maint: suppress bogus noreturn warnings
* configure.ac: Move the single-binary code before the
gcc-warnings code, so that the latter can depend on the former.
Suppress -Wsuggest-attribute=noreturn with single binaries,
to avoid diagnostics like the following:
src/expr.c: In function 'single_binary_main_expr':
error: function might be candidate for attribute 'noreturn'
Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/coreutils/2022-01/msg00061.html
tr: pacify -fsanitizer=leak
* src/tr.c (main): Use main_exit, not return, in a couple of
places missed last time.
chgrp: fix typo in previous change
* src/chgrp.c (main): Use main_exit, not exit.
maint: mark some _Noreturn functions
* src/basenc.c (finish_and_exit, do_encode, do_decode):
* src/comm.c (compare_files):
* src/tsort.c (tsort):
* src/uptime.c (uptime):
Mark with _Noreturn. Otherwise, unoptimized compilations may warn
that the calling renamed-main function doesn't return a value,
when !lint and when single-binary.
df: fix memory leak
* src/df.c (devlist_free): Remove.
(filter_mount_list): Free all of devlist, instead of merely
the entries in devlist_table.
2022-01-31 Pádraig Brady
maint: cut: avoid exporting recently added variable
* src/cut.c: Make output_delimiter_default static,
as identified by `make syntax-check`.
2022-01-31 Paul Eggert
maint: pacify gcc -flto -Wmaybe-uninitialized
* gl/lib/xdectoint.c (__xnumtoint): Tell gcc that ‘error’
does not return here.
* gl/modules/xdectoint (Depends-on): Add stdbool, verify.
dd: do not access uninitialized
* src/dd.c (parse_integer): Avoid undefined behavior
that accesses an uninitialized ‘n’ when e == LONGINT_INVALID.
Return more-accurate error code when INTMAX_MAX < n.
uptime: simplify -fsanitize=leak pacification
* src/uptime.c (uptime): Exit here ...
(main): ... instead of here.
uniq: remove IF_LINT
* src/uniq.c (check_file): Remove a no-longer-needed IF_LINT.
unexpand: remove IF_LINT
* src/unexpand.c (unexpand): Remove a no-longer-needed IF_LINT.
pr: remove IF_LINT
* src/pr.c (read_line): Remove a no-longer-needed IF_LINT.
truncate: simplify
* src/truncate.c (do_ftruncate): Check != 0 instead of == -1.
Avoid a cast.
(main): Use C99 style decls after statements.
Simplify ‘open’ logic.
2022-01-31 Paul Eggert
shred: remove IF_LINT
* src/shred.c (dopass): Remove a no-longer-needed IF_LINT.
(read_line): Remove an IF_LINT; no longer needed with
today’s GCC.
2022-01-31 Paul Eggert
pr: simplify -fsanitize=leak pacification
* src/pr.c (main): Remove an IF_LINT.
Use main_exit rather than return.
pinky: simplify -fsanitize=leak pacification
* src/pinky.c (short_pinky): exit instead of freeing.
paste: remove IF_LINT
* src/paste.c (paste_parallel): Remove no-longer-needed IF_LINT.
hostname: simplify
* src/hostname.c (sethostname): Provide a substitute on all
platforms, to simplify the mainline code.
(main): Simplify. Remove an IF_LINT.
Use main_exit rather than return.
factor: remove IF_LINT
* src/factor.c (factor_using_squfof) [USE_SQUFOF]:
Use plain assert (...), not IF_LINT (assert (...)).
This code is currently never compiled or executed,
so this is merely a symbolic cleanup.
expand: remove IF_LINT
* src/expand.c (expand): Remove no-longer-needed IF_LINT.
env: simplify -fsanitize=leak pacification
* src/env.c (unset_envvars): Remove IF_LINT code.
(main): Use main_exit, not return.
md5sum: remove IF_LINTs
* src/digest.c (digest_check): Remove IF_LINTs that are no longer
needed, as GCC has gotten smarter since 2008.
df: simplify -fsanitize=leak pacification
* src/df.c (print_table, main) [lint]: Omit unnecessary cleanup.
(main): Use main_exit, not return.
date: simplify -fsanitize=leak pacification
* src/date.c (main) [lint]: Omit unnecessary cleanup.
Use main_exit, not return.
cut: simplify and remove an IF_LINT
* src/cut.c (enum operating_mode, operating_mode)
(output_delimiter_specified, cut_stream):
Remove; no longer needed.
(output_delimiter_default): New static var. Code can now
use ‘output_delimiter_string != output_delimiter_default’
instead of ‘output_delimiter_specified’.
(cut_file): New arg CUT_STREAM. Caller changed.
(main): Simplify. Coalesce duplicate code. Redo to avoid need
for IF_LINT, or for the static var. No need to xstrdup optarg.
cut: simplify -fsanitize=leak pacification
* src/set-fields.c (reset_fields): Remove, as it’s not needed for
-fsanitize=leak even when ‘lint’ is defined. All uses removed.
cp: simplify GCC pacification
* src/cp.c (make_dir_parents_private): Remove IF_LINT code that is
no longer needed, as GCC has apparently gotten smarter since 2008.
chown: simplify -fsanitize=leak pacification
* src/chgrp.c, src/chown.c (main) [lint]: Omit unnecessary cleanup.
Use main_exit, not return.
basenc: simplify -fsanitize=leak pacification
* src/basenc.c (finish_and_exit): New function.
(do_encode, do_decode): Use it. Accept new INFILE arg. Remove
no-longer-needed IF_LINT code. Exit when done. Caller changed.
test: simplify gcc pacification
* src/test.c (get_mtime) [lint]: Omit ifdef lint code that is no
longer needed, as GCC has gotten smarter since 2005.
tail: simplify -fsanitize=leak pacification
Also, close a no-longer-needed file descriptor when falling
back from inotify.
* src/tail.c (tail_forever_inotify): Return void, not bool. Exit
on fatal error, or on successful completion. Accept an extra
argument pointing to a hash table that the caller should free on
non-fatal error; this simplifies cleanup. Don’t bother setting
errno when returning. Caller changed.
(main): Omit no-longer-needed IF_LINT code. Close inotify
descriptor if inotify fails; this fixes a file descriptor leak and
means we needn’t call inotify_rm_watch. Use main_exit, not return.
tac: simplify -fsanitize=leak pacification
* src/tac.c (main) [lint]: Omit unnecessary cleanup.
Use main_exit, not return.
shuf: simplify -fsanitize=leak pacification
* src/shuf.c (main) [lint]: Omit unnecessary cleanup.
Use main_exit, not return.
numfmt: simplify -fsanitize=leak pacification
* src/numfmt.c (main) [lint]: Omit unnecessary cleanup.
Use main_exit, not return.
mktemp: simplify -fsanitize=leak pacification
* src/mktemp.c (main) [lint]: Omit unnecessary cleanup.
Use main_exit, not return.
dd: simplify -fsanitize=leak pacification
* src/dd.c (cleanup) [lint]: Omit unnecessary cleanup.
(main): Use main_exit, not return.
cp: simplify cp/install/ln/mv pacification
* src/copy.c (dest_info_free, src_info_free) [lint]:
Remove. All uses removed.
(copy_internal): Pacify only Clang and Coverity; GCC doesn’t need it.
* src/cp-hash.c (forget_all) [lint]: Remove. All uses removed.
* src/cp.c, src/install.c, src/ln.c, src/mv.c (main):
Use main_exit, not return.
chmod: pacify -fsanitizer=leak
* src/chmod.c (main): Use main_exit, not return.
yes: pacify -fsanitizer=leak
* src/yes.c (main): Use main_exit, not return.
tsort: pacify -fsanitizer=leak
* src/tsort.c (detect_loop): Free removed successor.
sort: pacify -fsanitizer=leak
* src/sort.c (pipe_fork, keycompare, sort, main):
Remove lint code that no longer seems to be needed.
(sort): Unconditionally compile ifdef lint code that is needed
to free storage even when not linting.
(main): Use main_exit, not return.
split: pacify -fsanitizer=leak
* src/split.c (lines_rr): New arg FILESP. All uses changed.
(main): Use main_exit, not return. Omit unnecessary alignfree.
ptx: pacify -fsanitizer=leak
* src/ptx.c (unescape_string): Rename from copy_unescaped_string,
and unescape the string in place. Callers changed. This way,
we needn’t allocate storage and thus needn’t worry about
-fsanitizer=leak.
seq: pacify -fsanitizer=leak
* src/seq.c (seq_fast): If successful, exit rather than returning true.
Callers changed.
(main): Use main_exit, not return.
tsort: pacify -fsanitizer=leak
* src/tsort.c (struct item.balance): Now signed char to save space.
(struct item.printed): New member.
(new_item): Initialize k->printed to false. Simplify via xzalloc.
(scan_zeros): Use k->printed rather than nulling out string.
(tsort): Move exiting code here ...
(main): ... from here.
(tsort) [lint]: Omit no-longer-needed code. Instead, set head->printed.
tr: pacify -fsanitizer=leak
* src/tr.c (main): Use main_exit, not return.
stat: pacify -fsanitizer=leak
* src/stat.c (main): Use main_exit, not return.
comm: pacify -fsanitizer=leak
* src/comm.c (compare_files): Move exiting code here ...
(main): ... from here, to pacify gcc -fsanitize=leak.
expr: lint cleanup, and introducing main_exit
This introduces a new macro main_exit, which is useful
for pacifying gcc -fsanitizer=lint and in some cases
means we can remove some ‘IF_LINT’ and ‘ifdef lint’ code.
* src/expr.c (main): Use main_exit, not return.
(docolon): Omit an IF_LINT that GCC no longer needs.
* src/system.h (main_exit): New macro.
2022-01-30 Pádraig Brady
cksum: use more exact selection of digest algorithms
Use more constrained argument matching
to improve forward compatibility and robustness.
For example it's better that `cksum -a sha3` is _not_
equivalent to `cksum -a sha386`, so that a user
specifying `-a sha3` on an older cksum would not be surprised.
Also argmatch() is used when parsing tags from lines like:
SHA3 (filename) = abcedf....
so it's more robust that older cksum instances to fail
earlier in the parsing process, when parsing output from
possible future cksum implementations that might support SHA3.
* src/digest.c (algorithm_from_tag): Use argmatch_exact()
to ensure we don't match abbreviated algorithms.
(main): Likewise.
* tests/misc/cksum-a.sh: Add a test case.
2022-01-30 Pádraig Brady
build: update gnulib submodule to latest
To provide argmatch_exact() that does not
use abbreviated matching, to be used by cksum.
2022-01-30 Paul Eggert
mv: when installing to dir use dir-relative names
When the destination for mv is a directory, use functions like openat
to access the destination files, when such functions are available.
This should be more efficient and should avoid some race conditions.
Likewise for 'install'.
* src/cp.c (must_be_working_directory, target_directory_operand)
(target_dirfd_valid): Move from here ...
* src/system.h: ... to here, so that install and mv can use them.
Make them inline so GCC doesn’t complain.
* src/install.c (lchown) [HAVE_LCHOWN]: Remove; no longer needed.
(need_copy, copy_file, change_attributes, change_timestamps)
(install_file_in_file, install_file_in_dir):
New args for directory-relative names. All uses changed.
Continue to pass full names as needed, for diagnostics and for
lower-level functions that do not support directory-relative names.
(install_file_in_dir): Update *TARGET_DIRFD as needed.
(main): Handle target-directory in the new, cp-like way.
* src/mv.c (remove_trailing_slashes): Remove static var; now local.
(do_move): New args for directory-relative names. All uses changed.
Continue to pass full names as needed, for diagnostics and for
lower-level functions that do not support directory-relative names.
(movefile): Remove; no longer needed.
(main): Handle target-directory in the new, cp-like way.
* tests/install/basic-1.sh:
* tests/mv/diag.sh: Adjust to match new diagnostic wording.
cp: fix comment typo
2022-01-28 Pádraig Brady
doc: NEWS: explain _why_ copy_file_range() is used
* NEWS: Mention why we're making the change in behavior in cat(1).
build: update gnulib submodule to latest
To fix a syntax-check false failure
2022-01-28 Paul Eggert
dd: synchronize output after write errors
Problem reported by Sworddragon (Bug#51345).
* src/dd.c (cleanup): Synchronize output unless dd has been interrupted.
(synchronize_output): New function, split out from dd_copy.
Update conversions_mask so synchronization is done at most once.
(main): Do not die with the output file open, since we want to be
able to synchronize it before exiting. Synchronize output before
exiting.
dd: output final progress before syncing
Problem reported by Sworddragon (Bug#51482).
* src/dd.c (reported_w_bytes): New var.
(print_xfer_stats): Set it.
(dd_copy): Print a final progress report if useful before
synchronizing output data.
2022-01-27 Paul Eggert
cat: prefer copy_file_range to read+write
* src/cat.c (copy_cat): New function.
(main): Use it.
csplit: improve integer overflow checking
* src/csplit.c: Prefer signed integers to unsigned for sizes
when either will do. Check for some unlikely overflows.
(INCR_SIZE): Remove; no longer used.
(free_buffer): Also free the arg, simplifying callers.
(get_new_buffer): Use xpalloc instead of computing new
size by hand. Add ATTRIBUTE_DEALLOC.
(delete_all_files, close_output_file):
If unlink fails with ENOENT, treat it as success.
(close_output_file): If unlink fails, decrement count anyway.
(parse_repeat_count, parse_patterns): Check for int overflow.
(check_format_conv_type): Use signed format.
maint: simplify memory alignment
Use the new Gnulib modules alignalloc and xalignalloc
to simplify some memory allocation.
Also, fix some unlikely integer overflow problems.
* bootstrap.conf (gnulib_modules): Add alignalloc, xalignalloc.
* src/cat.c, src/copy.c, src/dd.c, src/shred.c, src/split.c:
Include alignalloc.h.
* src/cat.c (main):
* src/copy.c (copy_reg):
* src/dd.c (alloc_ibuf, alloc_obuf):
* src/shred.c (dopass):
* src/split.c (main):
Use alignalloc/xalignalloc/alignfree instead of doing page
alignment by hand.
* src/cat.c (main):
Check for integer overflow in page size calculations.
* src/dd.c (INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP, MAX_BLOCKSIZE):
(real_ibuf, real_obuf) [lint]:
Remove; no longer needed.
(cleanup) [lint]:
(scanargs): Simplify.
* src/ioblksize.h (io_blksize): Do not allow blocksizes largest
than the largest power of two that fits in idx_t and size_t.
* src/shred.c (PAGE_ALIGN_SLOP, PATTERNBUF_SIZE): Remove.
build: update gnulib submodule to latest
copy: remove unnecessary ‘free’
* src/copy.c (copy_reg): Remove a ‘free’ call that does nothing
because its argument is always a null pointer, starting with
2007-11-1608:31:15Z!jim@meyering.net.
dd: simplify conv=swab code
Simplify byte-swapping, so that the code no longer needs to
allocate a page before the input buffer.
* src/dd.c (SWAB_ALIGN_OFFSET, char_is_saved, saved_char): Remove.
All uses removed.
(INPUT_BLOCK_SLOP): Simplify to just page_size.
(alloc_ibuf, dd_copy): Adjust to new swab_buffer API.
(swab_buffer): New arg SAVED_BYTE, taking the place of the old
global variables. Do not access BUF[-1].
dd: improve integer overflow checking
* src/dd.c: Prefer signed to unsigned types where either will do,
as this helps improve checking with gcc -fsanitize=undefined.
Limit the signed types to their intended ranges.
(MAX_BLOCKSIZE): Don’t exceed IDX_MAX - slop either.
(input_offset_overflow): Remove; overflow now denoted by negative.
(parse_integer): Return INTMAX_MAX on overflow, instead of unspecified.
Do not falsely report overflow for ‘00x99999999999999999999999999999’.
* tests/dd/misc.sh: New test for 00xBIG.
* tests/dd/skip-seek-past-file.sh: Adjust to new diagnostic wording.
New test for BIGxBIG.
shred: fix declaration typo
* gl/lib/randint.h (randint_all_new):
Do not declare with _GL_ATTRIBUTE_NONNULL (), as
the arg can be a null pointer. This fixes a typo added in
2021-11-01T05:30:28Z!eggert@cs.ucla.edu.
cat: prefer signed to unsigned
* src/cat.c: Prefer signed to unsigned types
where either will do, as they allow for better
overflow checking at runtime.
cat: improve style
* cat.c: Improve style a bit, mostly by assuming C99-style
declarations after statements
2022-01-27 Pádraig Brady
doc: csplit: clarify [OFFSET] syntax
* src/csplit.c (usage): Clarify that '+' prefix is optional on OFFSET.
* doc/coreutils.texi (csplit invocation): Likewise.
Fixes https://bugs.gnu.org/53574
2022-01-15 Paul Eggert
build: allow readlinkat calls
Problem reported by Bernhard Voelker in:
https://lists.gnu.org/r/coreutils/2022-01/msg00026.html
* cfg.mk (sc_prohibit_readlink): Remove. It’s OK to call
readlinkat to determine whether a file is a symbolic link.
cp: rely on Gnulib for copy_file_range workaround
Gnulib now replaces copy_file_range on buggy hosts
so there is no need for Coreutils to worry about the bug.
* src/copy.c: Do not include sys/utsname.h, xstrtol.h.
(functional_copy_file_range): Remove. All uses now
simply call copy_file_range.
build: update gnulib submodule to latest
2022-01-14 Paul Eggert
doc: fix pluralization typo
cp: fix two typos in previous change
Somehow ‘make check’ didn’t catch these the first few times.
* src/copy.c (copy_dir): Don’t pass null pointer to
copy_internal where it now expects non-null if move mode.
* src/cp.c (make_dir_parents_private): Initialize *attr_list
before recentely-added quick return.
cp: omit unnecessary stat of destination
'cp A B' attempts to open B as a directory, to see whether to
write to B/A instead of to B. In the common case where the
open fails with ENOENT, do not bother to stat B afterwards
since the stat should also fail with ENOENT.
* src/copy.c (copy_internal, copy): Change bool arg about
nonexistent destination to a 3-way int argument. All callers changed.
(copy_internal): Do not bother to stat a destination already known
to not exist when following symlinks.
2022-01-13 Paul Eggert
build: update gnulib submodule to latest
cp: when copying to dir use dir-relative names
When copying to a directory, use functions like openat to access
the destination files, when such functions are available. This
should be more efficient and should avoid some race conditions.
* bootstrap.conf (gnulib_modules): Add areadlinkat-with-size,
fchmodat, fchownat, mkdirat, mkfifoat, utimensat.
* src/copy.c (lchown) [!HAVE_LCHOWN]:
* src/copy.c, src/system.h (rpl_mkfifo, mkfifo) [!HAVE_MKFIFO]:
Remove. All uses removed.
(utimens_symlink): Remove; we shouldn’t have to worry about
those obsolete systems any more. All uses replaced by utimensat.
* src/copy.c (copy_dir, set_owner, fchmod_or_lchmod, copy_reg)
(same_file_ok, writable_destination, overwrite_ok, abandon_move)
(create_hard_link, src_is_dst_backup, copy_internal, copy):
* src/cp.c (make_dir_parents_private, re_protect):
New args for directory-relative names. All uses changed.
Continue to pass full names as needed, for diagnostics and for
lower-level functions like qset_acl that do not support
directory-relative names.
* src/copy.c (copy_reg): Prefer readlinkat to lstatat for merely
checking whether a file is a symlink, to avoid EOVERFLOW issues.
(subst_suffix): New function.
(create_hard_link): Accept a null SRC_NAME as meaning that if it
is needed it needs to be constructed from SRC_RELNAME, DST_NAME,
and DST_RELNAME.
(source_is_dst_backup): Use subst_suffix instead of doing it by hand.
(copy_internal): Remember and use directory-relative names instead
of full names.
* src/cp.c (lchown) [!HAVE_LCHOWN]: Remove. All uses removed.
(must_be_working_directory): New function.
(target_directory_operand): Simply take file name as arg,
and return a file descriptor or negative number on failure;
open with O_DIRECTORY to obtain any file descriptor.
All uses changed.
(target_dirfd_valid): New function.
(do_copy): Use these new functions to obtain a file descriptor
for any target directory, and use directory-relative names
for that directory.
(main): Omit no-longer-needed stat when --target-directory,
as do_copy now does this.
* src/ln.c (O_PATHSEARCH): Move from here ...
* src/system.h: ... to here.
* tests/cp/fail-perm.sh: Adjust to change in diagnostic wording,
and add a test for --no-target-directory.
cp: tweak internal name
* src/cp.c (do_copy): Omit confusingly-named local new_dest, since
there’s another var new_dst that means something quite different.
2022-01-12 Daniel Knittl-Frank
scripts: fix typo in commit-msg git-hook script
Commit 2f438fa9f53250fb3c8b39a95eedd627b5569ca4 (basenc: A new program
complementary to base64/base32) introduced a typo in the list of allowed
commit message prefixes, accidentally changing "basename" to
"nbasename". Revert it back to the correct "basename".
2022-01-07 Paul Eggert
df: tiny simplification
* src/df.c (LOG_EQ): Remove. All callers replaced by ==.
2022-01-02 Pádraig Brady
maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* tests/sample-test: Adjust to use the single most recent year.
2022-01-02 Pádraig Brady
build: update gnulib submodule to latest
mainly to get updated copyright year
* doc/fdl.texi: Sync from gnulib.
* .gitignore: Add lib/unictype, as bitmap.h therein is depended on
since gnulib commit f698ea71
2021-12-31 Paul Eggert
date: new option --resolution
* NEWS, doc/coreutils.texi (Options for date): Mention this.
* src/date.c (RESOLUTION_OPTION): New constant.
(DEBUG_DATE_PARSING_OPTION): Rename from DEBUG_DATE_PARSING.
All uses changed.
(long_options, usage, main): Support --resolution.
date: %-N now means suppress extra digits
* NEWS, doc/coreutils.texi: Mention this.
* bootstrap.conf (gnulib_modules): Add gettime-res.
* src/date.c (res_width, adjust_resolution): New functions.
(main): Adjust %-N to be %9N, or whatever, before using it.
build: update gnulib submodule to latest
doc: Document , vs . in date --rfc-3339=ns
build: port to AIX 7.1
This fixes a porting bug introduced in
2019-08-12T03:29:00Z!bruno@clisp.org.
Problem discovered on AIX 7.1.
* src/local.mk (LDADD): Add $(LIB_MBRTOWC), since pretty much
every command uses quotearg or mbrtowc or whatever.
(src_sort_LDADD): Add $(LIBPMULTITHREAD) and
$(LIB_PTHREAD_SIGMASK) instead of $(LIBTHREAD).
2021-12-28 Paul Eggert
build: be more careful about Perl
Problem reported by Serge Belyshev (Bug#52844).
* configure.ac (HAVE_PERL): Rely on latest Gnulib gl_PERL, which
sets gl_cv_prog_perl.
build: update gnulib submodule to latest
2021-12-27 Max Filippov
all: fix adjustment of /proc/$pid/cmdline by single binary
When configured with --enable-single-binary tools issue incorrect prctl:
prctl(PR_SET_KEEPCAPS, ...) = -1 EINVAL (Invalid argument)
PR_SET_MM_ARG_START is not a prctl 'option' parameter, it's 'arg2'
parameter for the option PR_SET_MM. It also has to have 'arg4' and
'arg5' set to 0 explicitly, otherwise the kernel also returns -EINVAL.
* src/coreutils.c (launch_program): Fix prctl arguments.
* NEWS: Mention the improvement.
Fixes https://bugs.gnu.org/52800
2021-12-24 Paul Eggert
ls: improve doc for =WHEN
* src/ls.c (usage): Improve clarity of =WHEN args (Bug#52782).
doc: colorize -> color
Living so close to Hollywood I know that "colorize"
means adding color to something that was already monochrome,
whereas "color" means to give color to something.
Coreutils apps color text instead of colorizing it.
2021-12-20 Bernhard Voelker
maint: update tests/init.sh from gnulib
* tests/init.sh: Sync from gnulib/tests/init.sh.
A recent gnulib update (4f497bf3c) missed this.
2021-12-20 Jim Meyering
maint: syntax-check requires "char const *", not "const char *"
* gl/lib/mbsalign.c (mbs_align_pad): Adjust.
* src/chroot.c (is_root): Adjust.
* src/digest.c (main): Adjust.
* src/relpath.c (buffer_or_output) Adjust.
* src/ls.c (print_name_with_quoting, get_color_indicator): Adjust.
maint: split a long line
* src/test.c (three_arguments): Split long line.
maint: commit-msg: compute UTF-8-aware line-length
* scripts/git-hooks/commit-msg: Count UTF-8 characters rather
than bytes to avoid erroneously rejecting as "longer than 72" a
log message line like the UTF-8 one for id.c just prior. It has
77 bytes but only 67 characters.
(check_msg): Read in "utf8" mode. Also include actual length
in the diagnostic.
(main): Don't loop when stdout is redirected, as it is when
invoked via vc-dwim.
Paul Eggert reported privately both the error of counting bytes
rather than chars and the re_edit loop when failing via vc-dwim.
2021-12-19 Paul Eggert
id: improve doc for when USER is omitted
* src/id.c (usage): “current user” → “current process” (Bug#52656).
2021-12-18 Paul Eggert
maint: use GNU style for spacing
2021-12-16 Bruno Haible
build: non-recursive Automake in a less hacky way
* bootstrap.conf (gnulib_modules): Remove
non-recursive-gnulib-prefix-hack.
(gnulib_tool_option_extras): Add --automake-subdir.
(bootstrap_post_import_hook): No need to massage lib/gnulib.mk.
2021-12-16 Paul Eggert
build: update bootstrap to latest
build: update gnulib submodule to latest
2021-12-15 Jim Meyering
maint: factor.c: avoid new GCC 12 warning
* src/factor.c (millerrabin2): Mark as ATTRIBUTE_PURE,
per advice from GCC 12.
2021-12-14 Paul Eggert
build: update gnulib submodule to latest
* NEWS: Mention the bugfix.
2021-12-10 Paul Eggert
mv: Bug#52410 fix
The recent Gnulib update fixed this bug reported by Vincent Vermilya.
* tests/mv/backup-dir.sh: Test for Bug#52410.
build: update gnulib submodule to latest
2021-12-07 Paul Eggert
uname: port to recent macOS
Problem reported by Jakub Sokołowski (bug #52330).
* src/uname.c [__APPLE__]: Don’t include sys/syctl.h,
mach/machine.h, mach-o/arch.h.
(print_element_env): New function. With __APPLE__, it defers to the
env var UNAME_MACHINE (if given) for uname -m, and similarly for -nrsv.
(main): Use it. For -p with __APPLE__, rely on predefined macros
and omit any 64-bit indication, for compatibility with macOS uname.
2021-11-22 Paul Eggert
cp: clone on macOS
* configure.ac: Check for fclonefileat.
* src/copy.c [HAVE_FCLONEFILEAT && !USE_XATTR]:
Include .
(copy_reg): If possible, use fclonefileat to clone.
2021-11-21 Paul Eggert
cp: streamline cloning by skipping fstat
* src/copy.c (copy_reg): Attempt clone_file before fstat of dest,
so that if clone_file succeeds we can skip the fstat.
2021-11-20 Paul Eggert
cp: fix --preserve=ownership permissions bug
This fixes a bug that I introduced in
2006-12-06T19:44:08Z!eggert@cs.ucla.edu.
* src/copy.c (USE_XATTR): New macro.
(copy_reg): Use it to help the compiler. Prefer open u+w to a
later chmod u=rw; u+r isn’t needed for xattr. For the later u-r,
do only one (or zero) chmod calls instead of two (or one).
In the last chmod, respect the umask instead of ignoring it.
* tests/cp/preserve-mode.sh: Test for the bug.
2021-11-19 Paul Eggert
maint: prefer MAYBE_UNUSED
Prefer MAYBE_UNUSED to _GL_UNUSED, since the C2x syntax
will be [[maybe_unused]] at the start of the declaration,
and we want to look forward to that. All uses of _GL_UNUSED
either changed to MAYBE_UNUSED, or (when not needed) removed.
2021-11-18 Paul Eggert
cp: fix security context race
This fixes an issue introduced in the fix for Bug#11100.
* NEWS: Mention this.
* src/copy.c (copy_reg): Fix obscure bug where open-without-CREAT
failed with ENOENT and we forget to call set_process_security_ctx
before calling open-with-CREAT. Also, don’t bother to unlink
DST_NAME if open failed with ENOENT; and if unlink fails with
ENOENT, don’t consider that to be an error (someone else could
have removed the file for us, and that’s OK). Also, don’t worry
about move mode, since we use O_EXCL|O_CREAT and so won’t open
an existing file.
2021-11-17 Paul Eggert
maint: update NEWS for macOS fix
cp: minor clarity tweak
* src/copy.c (copy_reg): Use cached data_copy_required.
cp: fix ptrdiff_t/ssize_t theoretical glitches
* src/copy.c (sparse_copy): Use system.h’s SSIZE_MAX.
Don’t assume SSIZE_MAX <= PTRDIFF_MAX.
2021-11-16 Paul Eggert
build: update gnulib submodule to latest
maint: fix nonnull decl
* gl/lib/randread.h (randread_new): Do not mark with
_GL_ATTRIBUTE_RETURNS_NONNULL, since it can return NULL.
2021-11-15 Paul Eggert
build: update gnulib submodule to latest
2021-11-13 Pádraig Brady
tests: avoid false failure in env-signal-handler.sh
* tests/misc/env-signal-handler.sh: Use retry_delay_ to
avoid a false failure under load, where env hasn't setup
the SIGINT handling before timeout(1) sends the SIGINT.
Fixes https://bugs.gnu.org/51793
2021-11-01 Pádraig Brady
maint: fix recent syntax-check failures
* cfg.mk (exclude_file_name_regexp--sc_system_h_headers):
Add chown-core.h to the regexp, to better decouple from system.h.
* src/env.c: Remove minmax.h include already included in system.h.
* src/libstdbuf.c: Likewise.
* src/prog-fprintf.h: Remove doubled semicolon.
2021-11-01 Paul Eggert
maint: use minmax.h instead of rolling our own
* gl/lib/mbsalign.c, gl/lib/randread.c, src/system.h (MAX, MIN):
Remove; include minmax.h instead.
* gl/modules/mbsalign, gl/modules/randread (Depends-on): Add minmax.
* src/factor.c (MIN): Remove.
maint: add function attributes to .h files
Add _GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_MALLOC,
_GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DALLOC_FREE,
_GL_ATTRIBUTE_RETURNS_NONNULL to .h files when appropriate.
* gl/lib/mbsalign.h, gl/lib/randperm.h, src/chown-core.h:
Include stdlib.h, for the benefit of _GL_ATTRIBUTE_DALLOC_FREE.
* gl/lib/randread.c (randread_free_body): New static function.
(randread_new, randread_free): Use it.
* src/copy.c (valid_options): Remove assert that is no longer
needed because it is now checked statically.
maint: enable -Wsuggest-attribute=format
* configure.ac (WERROR_CFLAGS): Enable -Wsuggest-attribute=format
for lib/ and src/.
* src/copy.c (copy_attr_error, copy_attr_allerror):
Add ATTRIBUTE_FORMAT.
(copy_attr): Ignore -Wsuggest-attribute=format in the
small section of code that needs it ignored.
* src/test.c (test_syntax_error): Mark with ATTRIBUTE_FORMAT.
(binary_operator): Omit unnecessary NULL args, pacifying
-Wsuggest-attribute=format.
maint: modernize attribute usage
* src/system.h (__attribute__): Remove. Replace all uses that
rely on this by _GL_ATTRIBUTE_xxx or ATTRIBUTE_xxx.
(ATTRIBUTE_WARN_UNUSED_RESULT): Remove. Replace all uses by
NODISCARD.
maint: remove unused __attribute__ defn
* gl/lib/randread.c (__attribute__): Remove; no longer
used after the recent _Noreturn change.
b2sum: simplify attribute usage
* src/blake2/blake2.h (BLAKE2_PACKED): Simplify, and port better
to older GCC, by using _GL_ATTRIBUTE_PACKED.
maint: prefer attribute.h in .c files
This will help us make the transition to C2x, where some
attributes must come at the start of function decls.
Leave the attributes alone in .h files for now,
as the Gnulib tradition is to not expose attribute.h to users.
* bootstrap.conf (gnulib_modules): Add ‘attribute’.
* gl/lib/randperm.c, src/make-prime-list.c, src/system.h:
Include attribute.h.
* gl/lib/strnumcmp.c (strnumcmp): Remove _GL_ATTRIBUTE_PURE here,
as this belongs in the .h file.
* gl/lib/strnumcmp.h (strnumcmp): Add _GL_ATTRIBUTE_PURE here.
* src/sort.c (human_numcompare, numcompare): Now ATTRIBUTE_PURE;
discovered due to strnumcmp.h change.
* gl/lib/randperm.c, src/copy.c, src/dd.c, src/df.c, src/digest.c:
* src/env.c, src/expr.c, src/factor.c, src/ls.c:
* src/make-prime-list.c, src/numfmt.c, src/od.c, src/pathchk.c:
* src/pinky.c, src/pr.c, src/ptx.c, src/realpath.c, src/relpath.c:
* src/seq.c, src/sort.c, src/stat.c, src/stty.c, src/system.h:
* src/tr.c, src/uniq.c, src/wc.c:
In .c files, crefer ATTRIBUTE_CONST to _GL_ATTRIBUTE_CONST, and
similarly for ATTRIBUTE_FORMAT and ATTRIBUTE_PURE.
* src/system.h (FALLTHROUGH): Remove; attribute.h defines it.
2021-10-31 Pádraig Brady
sort: --debug: add warnings about sign, radix, and grouping chars
New warnings are added related to the handling
of thousands grouping characters, decimal points, and sign characters.
Examples now diagnosed are:
$ printf '0,9\n1,a\n' | sort -nk1 --debug -t, -s
sort: key 1 is numeric and spans multiple fields
sort: field separator ‘,’ is treated as a group separator in numbers
1,a
_
0,9
___
$ printf '1,a\n0,9\n' | LC_ALL=fr_FR.utf8 sort -gk1 --debug -t, -s
sort: key 1 is numeric and spans multiple fields
sort: field separator ‘,’ is treated as a decimal point in numbers
0,9
___
1,a
__
$ printf '1.0\n0.9\n' | LC_ALL=fr_FR.utf8 sort -s -k1,1g --debug
sort: note numbers use ‘,’ as a decimal point in this locale
0.9
_
1.0
_
$ LC_ALL=fr_FR.utf8 sort -n --debug /dev/null
sort: text ordering performed using ‘fr_FR.utf8’ sorting rules
sort: note numbers use ‘,’ as a decimal point in this locale
sort: the multi-byte number group separator in this locale \
is not supported
$ sort --debug -t- -k1n /dev/null
sort: key 1 is numeric and spans multiple fields
sort: field separator ‘-’ is treated as a minus sign in numbers
sort: note numbers use ‘.’ as a decimal point in this locale
$ sort --debug -t+ -k1g /dev/null
sort: key 1 is numeric and spans multiple fields
sort: field separator ‘+’ is treated as a plus sign in numbers
sort: note numbers use ‘.’ as a decimal point in this locale
* src/sort.c (key_warnings): Add the warnings above.
* tests/misc/sort-debug-warn.sh: Add test cases.
Also check that all sort invocations succeed.
* NEWS: Mention the improvement.
Addresses https://bugs.gnu.org/51011
2021-10-31 Paul Eggert
maint: modernize README-{hacking,prereq}
2021-10-30 Paul Eggert
cp: revert unnecessary FreeBSD workaround
That was a false alarm due to a bug in FreeBSD 9.1 truss;
see Pádraig Brady’s report (Bug#51433#29).
* src/copy.c (lseek_copy, infer_scantype): Don’t bother checking
whether lseek returned -1. This doesn’t entirely revert the
previous change, as it keeps the code simplification of the
previous change while reverting the check for -1.
cp: defend better against FreeBSD 9.1 zfs bug
Problem reported by Pádraig Brady (Bug#51433#14).
* src/copy.c (lseek_copy, infer_scantype): Report an error if
lseek with SEEK_DATA or SEEK_HOLE returns less than -1,
as this is an lseek bug.
2021-10-22 Pádraig Brady
doc: say that printf(1) is preferred over echo(1)
* src/echo.c (usage): Say printf(1) is preferred
due to being more standard and robust.
* man/echo.x [SEE ALSO]: Reference printf(1).
* doc/coreutils.texi (echo invocation): Mention in the
summary that echo is not robust when outputting
any string, and that printf is preferred.
Also expand on the examples showing how to
output a single '-n' string.
Addresses https://bugs.gnu.org/51311
2021-10-12 Pádraig Brady
doc: timeout --kill-after: clarify disabled timeouts
* doc/coreutils.texi (timeout invocation): Clarify
that -k is ignored if either its duration or the
main timeout duration is 0.
Addresses https://bugs.gnu.org/51128
timeout: ensure --foreground -k exits with status 137
* src/timeout.c (main): Propagate the killed status from the child.
* doc/coreutils.texi (timeout invocation): Remove the
description of the --foreground specific handling of SIGKILL,
now that it's consistent with the default mode of operation.
* tests/misc/timeout.sh: Add a test case.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/51135
2021-10-11 Pádraig Brady
doc: timeout --foreground: add clarification on exit status
* doc/coreutils.texi (timeout invocation): Add detail on
how --foreground allows timeout(1) to use more standard
exit status as the uncatchable SIGKILL is not sent to itself.
Fixes https://bugs.gnu.org/51135
2021-10-11 Paul Eggert
sort: fix unlikely bug when '\377' < 0
* gl/lib/strintcmp.c (strintcmp): Don’t assume that the input
cannot contain ((char) -1), as this equals '\377' when char is
signed (assuming 8-bit char).
* src/sort.c (decimal_point): Now char, to make it clear
that it’s always in char range now.
(NON_CHAR): New constant.
(traverse_raw_number): Return char not unsigned char;
this is simpler and could be faster. All callers changed.
(main): Do not convert decimal_point and thousands_sep to
unsigned char, as this can mishandle comparisons on
machines where char is signed and the input data contains
((char) -1). Use NON_CHAR, not -1, as an out-of-range value for
thousands_sep.
2021-10-03 Paul Eggert