2022-04-15 Pádraig Brady
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
build: update gnulib submodule to latest
maint: switch to C11-style _Noreturn
Use C11-style _Noreturn instead of the old ATTRIBUTE_NORETURN
macro. This pacifies clang on OpenBSD 6.9, which otherwise
complains "'noreturn' function does return" in some places.
* gl/lib/randread.c, src/system.h (ATTRIBUTE_NORETURN):
Remove. All uses either removed as GCC no longer needs them, or
changed to C11-style _Noreturn since Gnulib arranges for _Noreturn
globally nowadays.
ls: port to OpenBSD
Problem reported by Brian Callahan (Bug#50972).
* src/ls.c (decode_switches): Don’t assume __GNUC_PREREQ.
2021-09-26 Pádraig Brady
doc: adjust ls --zero option order in texinfo
* doc/coreutils.texi (ls invocation - general output formatting):
The option ordering was not changed when the option was renamed
from --null to --zero.
2021-09-25 Pádraig Brady
tests: cp/sparse-perf: make more robust and add zfs comments
* init.cfg (seek_data_capable_): Add a timeout to ensure failure for
slow lseek(...SEEK_DATA) calls (even if that syscall isn't interrupted).
* tests/cp/sparse-perf.sh: Run the SEEK_DATA check on the
1TiB empty file to exclude both FreeBSD 9.1 which takes 35s,
and ZFS which requires a delay of about 5s between file creation
and use of SEEK_DATA to correctly determine it's empty (return ENXIO).
Also remove the stat size checks as they invalidate the test
due to cp never writing data due to it being always zeros,
and thus converted to holes in the output.
2021-09-24 Pádraig Brady
chmod: fix exit status when ignoring symlinks
* src/chmod.c: Reorder enum so CH_NOT_APPLIED
can be treated as a non error.
* tests/chmod/ignore-symlink.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/50784
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.0
* NEWS: Record release date.
tests: sparse-perf: avoid false failure
* tests/cp/sparse-perf.sh: Avoid the case where
we saw SEEK_DATA take 35s to return a result
against a 1TB sparse file. This happened on
a FreeBSD 9.1 VM at least.
Reported by Nelson H. F. Beebe.
cksum: fix -a crc on 64 bit big endian systems
* src/cksum.c (crc_sum_stream): On sparc64 for example,
a crc of 0 was printed due to mismatch in size of
variable copied between generator and output functions.
uint_fast32_t is generally 64 bits on 64 bit systems,
so we copy through an int to ensure we don't use the wrong
end of a 64 bit variable.
Reported by Nelson H. F. Beebe
2021-09-21 Pádraig Brady
tail: fix detection of closed stdout on macOS
* bootstrap.conf: We only need poll on Linux and AIX
where poll is not replaced. Also resinstate dependence
on select so we can use it unconditionally.
* src/tail.c (check_output_alive): Reinstate use of select()
by default as poll was seen to be ineffective for this
application on macOS.
Fixes https://bugs.gnu.org/50714
maint: clean up c++ style comments
* src/expand-common.h: Remove commented variables.
* src/remove.h: Change to C style comment.
* src/tail.c: Likewise.
2021-09-20 Pádraig Brady
tests: date-debug: avoid a false failure on solaris
* tests/misc/date-debug.sh: Use a dynamic time format,
as the C locale on solaris uses %T rather than %H:%M:%S
for the time component.
2021-09-20 Jim Meyering
doc: drop extraneous single quotes in help
* src/digest.c (usage) [cksum --help]: Drop single quotes
around each checksum name.
* src/tee.c (usage) [tee --help]: Likewise.
cksum: list Pádraig as coauthor
* src/digest.c (AUTHORS) [HASH_ALGO_CKSUM]: Add Pádraig as
cksum coauthor.
* AUTHORS: Likewise.
tests: env-s.pl: avoid spurious failure on OS X
* tests/misc/env-S.pl: The __CF_USER_TEXT_ENCODING envvar
would cause many of these sub-tests to fail. Ignore it.
2021-09-20 Pádraig Brady
build: update gnulib submodule to latest
* gnulib: Update to latest.
Fixes "extern inline" and "rpl_free" issues.
doc: fix --help formatting for checksum utils
* src/digest.c (usage): Indicate that --length and --algorithm
require arguments. Emit corresponding emit_mandatory_arg_note().
Use consistent alignment.
cksum: support more transparent emulation of older utils
* src/digest.c: Allow using the --untagged option with --check,
so that `cksum -a md5 --untagged` used to emulate md5sum for example,
may be augmented with the --check option. Also support the --tag
option with cksum, to allow overriding a previous --untagged setting.
* doc/coreutils.texi: Adjust accordingly.
* tests/misc/cksum-a.sh: Likewise.
tests: avoid rare race in tail-2/F-vs-rename.sh
* tests/tail-2/F-vs-rename.sh: Keep stdout and stderr separate,
so that interspersion doesn't impact regex checks. Also wait
for each file's data to be printed to avoid multiple writes
to a file to be printed in a single iteration, which would
impact the regex checks. Also we refactor the check function,
rather than repeatedly redefining variations.
2021-09-17 Pádraig Brady
maint: remove duplicate from THANKS.in
* THANKS.in: Now that Tianjia Zhang has a commit in the repo.
2021-09-17 Tianjia Zhang
tests: fix typo in cksum-a.sh
* tests/misc/cksum-a.sh: fix typo md5um to md5sum.
2021-09-17 Pádraig Brady
tests: fix rare false failure in tail-2/F-vs-rename
This is wrong fix really, as only introducing delay I think.
* tests/tail-2/F-vs-rename.sh: Avoid a rare false failure
due to a race in the test. Now wait until tail has noticed
that b is replaced before writing to a, so that the subsequent
write of "y" to b will be displayed independently from
current contents of b ("x").
2021-09-17 Pádraig Brady
tests: port removed-directory test to FreeBSD
* tests/ls/removed-directory.sh: On FreeBSD 9.1 at least,
one gets ENOENT when trying to traverse the current removed dir
with ../, so instead reference the parent dir directly.
2021-09-16 Pádraig Brady
rmdir: fix uninitialized memory causing incorrect error
* src/rmdir.c (main): Only inspect the returned stat structure,
when stat(2) returns success.
2021-09-16 Jim Meyering
build: avoid new chmod.c warnings from upcoming GCC12
Here are the warnings:
src/chmod.c:175:3: error: 'ch.new_mode' may be used uninitialized in\
this function [-Werror=maybe-uninitialized]
175 | strmode (ch->new_mode, perms);
src/chmod.c:178:3: error: 'ch.old_mode' may be used uninitialized in\
this function [-Werror=maybe-uninitialized]
178 | strmode (ch->old_mode, old_perms);
* src/chmod.c (process_file): Initialize ch. Its new_mode and
old_mode fields could indeed be used uninitialized to form mode
strings, but those are used only when built from initialized members.
2021-09-16 Pádraig Brady
digest: ignore empty lines when checking
* src/digest.c (digest_check): Treat empty lines like comments,
as commented checksum files very often have empty lines.
* tests/misc/md5sum.pl: Adjust accordingly.
factor: sync longlong.h adjustments from upstream
* src/longlong.h: Sync changes from:
https://gmplib.org/repo/gmp/log/tip/longlong.h
stat,tail: add support for the secretmem file system
* src/stat.c (human_fstype): Add case for the 'secretmem'
file system type.
* NEWS: Mention the Improvement.
maint: sync help2man to latest version
* man/help2man: sync to changes from version 1.48.5.
Note this doesn't materially change the generated man pages.
doc: remove older ChangeLog items
* Makefile.am: Update the oldest documented version
to 8.25 which is now about 5 years old.
tests: ensure returns_ check failures are propagated
* tests/misc/cksum-a.sh: Set fail=1 if returns_ check fails.
* tests/misc/sync.sh: Likewise.
* tests/misc/yes.sh: Likewise.
cksum: fix --check with non tagged format checksums
* src/digest.c: Always set the digest_length, so that
we check the correct number of hex digits when parsing
non tagged format checksums.
* tests/misc/cksum-a.sh: Add a test case. Also fix
up this test which was ineffective due to fail=1
being set in a subshell and ignored.
2021-09-16 Paul Eggert
cksum: fix off-by-1 bug with \r stripping
Problem reported by Jim Meyering (Bug#50611).
* src/digest.c (digest_check): When stripping trailing \r,
avoid subscript error before start of line.
2021-09-15 Paul Eggert
maint: prefer rawmemchr to memchr when easy
* bootstrap.conf (gnulib_modules): Add rawmemchr.
* src/csplit.c: Include idx.h.
* src/csplit.c (record_line_starts):
* src/head.c (elide_tail_lines_pipe):
* src/shuf.c (next_line):
* src/split.c (lines_split):
* src/tail.c (pipe_lines):
* src/wc.c (wc_lines):
Prefer rawmemchr to memchr when rawmemchr is easy.
* src/csplit.c (load_buffer):
* src/head.c (struct linebuffer):
Make room for a 1-byte sentinel.
split: avoid NULL + 1
* src/split.c (lines_chunk_split): Don’t add to a null pointer.
It’s undefined behavior, and it’s unnecessarily confusing
regardless.
2021-09-15 Pádraig Brady
digest: support windows format checksum files
Support checksum files with CRLF line endings,
which is a common gotcha for using --check on windows,
or with checksum files generated on windows.
Note we escape \r here to support the original coreutils format
(with file name at EOL), and file names with literal
\r characters as the last character of their name.
* src/digest.c (filename_unescape): Convert \\r -> \r.
(print_filename): Escape \r -> \\r.
(output_file): Detect \r chars in file names.
(digest_check): Ignore literal \r char at EOL.
* tests/misc/md5sum.pl: Add a test case.
* tests/misc/sha1sum.pl: Likewise.
* NEWS: Mention the improvement.
2021-09-15 Pádraig Brady
doc: improve --help indenting in checksum utils
* src/digest.c (usage): Indent multi-line descriptions for clarity.
2021-09-15 Pádraig Brady
cksum: operate in binary mode only
This only practically matters on windows.
But given there are separate text handling options in cygwin,
keep the interface simple, and avoid exposing the
confusing binary/text difference here.
* doc/coreutils.texi (md5sum invocation): Mention that
--binary and --text are not supported by the cksum command.
* src/digest.c: Set flag to use binary mode by default.
(output_file): Don't distinguish text and binary modes with
' ' and '*', and just use ' ' always.
2021-09-15 Pádraig Brady
cksum: use --tag format by default
This format is a better default, since it results in simpler usage,
as you don't need to specify --tag on generation or -a on
checking invocations. Also it's a more general format supporting
mixed and length adjusted digests.
* doc/coreutils.texi (cksum invocation): Document a new --untagged
option, to use the older coreutils format.
(md5sum invocation): Mention that cksum doesn't support --tag.
* src/digest.c: Adjust cksum(1) to default to --tag,
and accept the new --untagged option.
* tests/misc/b2sum.sh: Adjust accordingly.
* tests/misc/cksum-a.sh: Likewise.
* tests/misc/cksum-c.sh: Likewise.
2021-09-15 Pádraig Brady
cksum: support --zero in default mode
* src/cksum.h: Thread DELIM through the output functions.
* src/digest.c: Likewise.
* src/sum.c: Likewise.
* src/sum.h: Likewise.
* src/cksum.c: Likewise. Also adjust check to allow -z
with traditional output modes. Also ajust the global variable
name to avoid shadowing warnings.
* tests/misc/cksum-a.sh: Adjust accordingly.
2021-09-15 Pádraig Brady
digest: support -length specifiers on all digest tags
This will be generally useful going forward, for sha3-256 etc.
* src/digest.c: Rename b2_length to digest_length, and
adjust/simplify the code to operate on this for both
b2sum and cksum -a blake2b.
2021-09-15 Pádraig Brady
cksum: support digest detection for tagged format
Support `cksum --check FILE` without having to specify a digest
algorithm, allowing for more generic file check instructions.
This also supports mixed digest checksum files, supporting
more robust multi digest checks.
* src/digest.c (algorithm_from_tag): A new function to
identify the digest algorithm from a tagged format line.
(split3): Set the algorithm depending on tag, and update
the expected digest length accordingly.
* tests/misc/cksum-c.sh: Add a new test.
* tests/local.mk: Reference the new test.
* tests/misc/md5sum.pl: Adjust to more generic error.
* tests/misc/sha1sum.pl: Likewise.
* doc/coreutils.texi (md5sum invocation): Mention the new -c feature.
* NEWS: Mention the new feature.
2021-09-15 Pádraig Brady
maint: simplify b2sum to only handle BLAKE2b
Any further variants will use the cksum -a table driven mechanism.
* src/digest.c: Remove BLAKE2 specific table driven code.
2021-09-15 Pádraig Brady
digest: add support for sm3
Add message digest sm3, which uses the OSCCA SM3 secure
hash (OSCCA GM/T 0004-2012 SM3) generic hash transformation.
* bootstrap.conf: Add the sm3 module.
* doc/coreutils.texi: Mention the cksum -a option.
* src/digest.c: Provide support for --algorithm='sm3'.
* tests/misc/sm3sum.pl: Add a new test (from Tianjia Zhang)
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.
Tested-by: Tianjia Zhang
2021-09-15 Pádraig Brady
cksum: add --algorithm option to select digest mode
* src/digest.c: Organize HASH_ALGO_CKSUM to be table driven,
and amalgamate all digest algorithms.
(main): Parse all options if HASH_ALGO_CKSUM, and disallow
--tag, --zero, and --check with the traditional bsd, sysv, and crc
checksums for now.
* src/local.mk: Reorganize to include all digest modules in cksum.
* tests/misc/cksum-a.sh: Add a new test.
* tests/misc/b2sum.sh: Update to default to checking with cksum,
as b2sum's implementation diverges a bit from the others.
* tests/local.mk: Reference the new test.
* doc/coreutils.texi (cksum invocation): Adjust the summary to
identify the new mode, and document the new --algorithm option.
* man/cksum.x: Adjust description to be more general.
* man/*sum.x: Add [See Also] section referencing cksum(1).
* NEWS: Mention the new feature.
digest: refactor cksum(1) into digest.c
* cfg.mk: Adjust cksum.c to not require config.h
and support a main (for crctab) without calling bindtextdomain().
* po/POTFILES.in: Remove cksum_pclmul.c since it no longer
concerns itself with diagnostics.
* src/cksum.c: Refactor to just providing stream digest,
and digest printing functionality.
* src/cksum.h: Adjust to the new interface.
* src/cksum_pclmul.c: Remove diagnostics, and determine errors
internally.
* src/crctab.c: Separate from cksum.h since that's now included
multiple times.
* src/digest.c: Provide cksum(1) functionality if -DHASH_ALGO_CKSUM
* src/local.mk: Adjust to new crctab.c and HASH_ALGO_CKSUM define.
2021-09-15 Pádraig Brady
cksum: document the --debug option
This should have been part of commit v8.32-113-gb73b9fcb1
* doc/coreutils.texi (cksum invocation): Add the --debug description.
* src/cksum.c (usage): Likewise.
(main): Also give explicit indication when using generic hardware.
2021-09-15 Pádraig Brady
sum: handle EOVERFLOW for too large inputs
* src/sum.c (bsd_sum_stream): Detect overflow when updating length.
(sysv_sum_stream): Likewise.
2021-09-15 Pádraig Brady
digest: refactor sum(1) into digest.c
Since digest will be providing all digest functionality,
refactor sum.c into it.
* po/POTFILES.in: sum.c no longer has translatable strings so remove.
* src/digest.c: Call out to new stream interfaces in sum.c
* src/local.mk: Adjust sources for the sum binary.
* src/sum.c: Provide a stream interface for BSD and SYSV digests.
* src/sum.h: A new file to declare the exported functions in sum.c
2021-09-15 Pádraig Brady
digest: add LENGTH parameter to digest to support cksum
* src/digest.c (digest_file): Add a LENGTH param,
to support cksum(1), and sum(1) which output the
length as part of their output.
2021-09-15 Pádraig Brady
maint: rename md5sum.c to more general digest.c
md5sum.c will be the base for all digest functions,
so rename accordingly.
* src/md5sum.c: Rename to ...
* src/digest.c: ... renamed from md5sum.c
* scripts/git-hooks/commit-msg: Allow digest: commit prefix.
* po.POTFILES.in: Adjust to new name.
* src/local.mk: Likewise.
2021-09-15 Pádraig Brady
doc: fix ambiguities in logname(1) and whoami(1)
* doc/coreutils.texi (whoami invocation): Clarify it prints names,
not numeric IDs.
* man/whoami.x: Likewise.
* man/logname.x: Reference getlogin(3).
* src/logname.c: Clarify that it prints the login name,
rather than the name of the effective user ID.
Fixes https://bugs.gnu.org/48894
2021-09-15 nl6720
dircolors: add *direct* to TERM matching
Search for "direct color" at:
https://invisible-island.net/xterm/terminfo.html
* src/dircolors.hin: Add *direct* to match terminals that
support direct colors (24-bit color / TrueColor).
The trailing * will match entries like xterm-direct2.
Addresses https://bugs.gnu.org/39827
2021-09-12 Pádraig Brady
tests: stat-vs-dirent.sh: avoid a false failure
* tests/ls/stat-vs-dirent.sh: Skip the test if we can't stat(1),
as the file may have been removed, or have a malformed name
due to '\n' etc. in the file name.
2021-09-09 Pádraig Brady
tests: add new stdin reading programs to tty-eof test
* tests/misc/tty-eof.pl: Add b2sum and basenc.
build: update gnulib submodule to latest
* gnulib: Update to latest. This fixes a gnulib test failure in base64,
among other fixes.
* cfg.mk: Disable sc_indent as auto indent is too invasive for now.
2021-09-09 Pádraig Brady
doc: fix repeated word
A proposed change to gnulib's sc_prohibit_doubled_word
was made to detect this in future.
* README: s/can can/can/.
Fixes https://bugs.gnu.org/50484
2021-09-09 Paul Eggert
doc: can “can can”
Problem reported by Akbarkhon Variskhanov (Bug#50484).
2021-09-08 Paul Eggert
doc: add missing "as" (thanks to Nelson H.F. Beebe)
2021-09-05 Justin Tracey
tests: narrow scope of faulty join args
* tests/misc/join.pl: Only test invalid-j with an invalid -j field,
not with missing operands as well.
2021-08-31 Pádraig Brady
doc: indicate the default algorithm in the sum(1) man page
* src/sum.c (usage): Indicate that -r (BSD algorithm) is the default.
2021-08-31 Pádraig Brady
sum: always output a file name if one passed
Adjust to output the file name if any name parameter is passed.
This is consistent with sum -s, cksum, and sum implementations
on other platforms. This should not cause significant compat
issues, as multiple fields are already output, and so already
need to be parsed.
* src/sum.c (bsd_sum_file): Output the file name
if any name parameter is passed.
* tests/misc/sum.pl: Adjust accordingly.
* doc/coreutils.texi (sum invocation): Likewise.
* NEWS: Mention the change in behavior.
2021-08-31 Paul Eggert
tests: port better to NetBSD
* tests/misc/help-version.sh: Test that /dev/full causes
shell printf to fail. This ports better to NetBSD 9.88.46,
where it doesn’t. Problem reported by Nelson H. F. Beebe.
tests: merge help-version changes back from gzip
* tests/misc/help-version.sh: Merge gzip-related changes
back from gzip/tests/help-version. This fixes problems
when TERM is not 'dumb', and should simplify maintenance.
2021-08-30 Assaf Gordon
basenc: fix bug49741: using wrong decoding buffer length
Emil Lundberg reports in
https://bugs.gnu.org/49741 about a 'basenc --base64 -d' decoding bug.
The input buffer length was not divisible by 3, resulting in
decoding errors.
* NEWS: Mention fix.
* src/basenc.c (DEC_BLOCKSIZE): Change from 1024*5 to 4200 (35*3*5*8)
which is divisible by 3,4,5,8 - satisfying both base32 and base64;
Use compile-time verify() macro to enforce the above.
* tests/misc/basenc.pl: Add test.
2021-08-28 Paul Eggert
basenc: prefer signed to unsigned integers
This patch modifies basenc to prefer signed integers to
unsigned, as signed are less error-prone.
This patch also updates Gnulib to to latest, which updates Gnulib’s
base32 and base64 modules to prefer signed to unsigned integers.
* src/basenc.c: Include idx.h.
(struct base2_decode_context): Use unsigned char, not unsigned
for an octet that must fit in an unsigned char.
(base_encode, struct base_decode_context)
(base64_decode_ctx_wrapper, prepare_inbuf, base64url_encode)
(base64url_decode_ctx_wrapper, base32_decode_ctx_wrapper)
(base32hex_encode, base32hex_decode_ctx_wrapper, base16_encode)
(base16_decode_ctx, z85_encode, Z85_HI_CTX_TO_32BIT_VAL)
(z85_decoding, z85_decode_ctx, base2msbf_encode)
(base2lsbf_encode, base2lsbf_decode_ctx, base2msbf_decode_ctx)
(wrap_write, do_encode, do_decode, main):
Prefer signed integers to unsigned.
(main): Treat extremely large wrap columns as if they were
infinite; that’s good enough. Since we’re now using xstrtoimax,
this allows ‘-w -0’ (same as ‘-w 0’).
* tests/misc/base64.pl (gen_tests): -w-0 is no longer an error.
2021-08-25 Jim Meyering
maint: avoid new syntax-check failure
find-mount-point.h rightly includes for its use
of _GL_ATTRIBUTE_DEALLOC_FREE, which uses free, yet that new
inclusion provoked a syntax-check failure. Exempt this header
file as we've done for others.
* cfg.mk (exclude_file_name_regexp--sc_system_h_headers):
Add find-mount-point.h to the regexp.
(sc_system_h_headers): Use grep -E, for a more readable regexp.
2021-08-25 Pádraig Brady
tests: avoid reflinks when testing SEEK_DATA logic
This better tests the SEEK_HOLE logic which
replaced the original fiemap hole identification logic.
Also it avoids a false failure in sparse-2.sh
on reflink supporting file systems, where we
try to correlate the file sizes produced by cp and dd.
* tests/cp/sparse-2.sh: s/cp/cp --reflink=never/
* tests/cp/sparse-extents-2.sh: Likewise.
* tests/cp/sparse-extents.sh: Likewise.
* tests/cp/sparse-perf.sh: Likewise.
* tests/cp/sparse.sh: Likewise.
Fixes https://github.com/coreutils/coreutils/issues/54
2021-08-22 Paul Eggert
df: pacify -Wsuggest-attribute=malloc
Problem found with latest Gnulib and GCC 11.2.1.
* src/find-mount-point.h (find_mount_point):
Add _GL_ATTRIBUTE_MALLOC and _GL_ATTRIBUTE_DEALLOC_FREE.
build: update gnulib submodule to latest
maint: use clearerr on stdin when appropriate
This is so that commands like ‘fmt - -’ read from stdin
both times, even when it is a tty. Fix some other minor
issues that are related.
* src/blake2/b2sum.c (main):
* src/cksum.c (cksum):
* src/cut.c (cut_file):
* src/expand-common.c (next_file):
* src/fmt.c (fmt):
* src/fold.c (fold_file):
* src/md5sum.c (digest_file, digest_check):
* src/nl.c (nl_file):
* src/od.c (check_and_close):
* src/paste.c (paste_parallel, paste_serial):
* src/pr.c (close_file):
* src/sum.c (bsd_sum_file):
Use clearerr on stdin so that stdin can be read multiple times
even if it is a tty. Do not assume that ferror preserves errno as
POSIX does not guarantee this. Coalesce duplicate diagnostic
calls.
* src/blake2/b2sum.c (main):
* src/fmt.c (main, fmt):
Report read error, even if it's merely fclose failure.
* src/fmt.c: Include die.h.
(fmt): New arg FILE. Close input (reporting error) if not stdin.
All callers changed.
* src/ptx.c (swallow_file_in_memory): Clear stdin's EOF flag.
* src/sort.c (xfclose): Remove unnecessary feof call.
doc: spell out stdin, stdout, stderr
* doc/coreutils.texi: Spell out words like “stdin” in
English prose.
2021-08-16 Paul Eggert
chmod: fix use of uninitialized var if -v
Problem reported by Michael Debertol (Bug#50070).
* NEWS: Mention the fix.
* src/chmod.c (struct change_status): New struct, replacing the
old enum Change_status. All uses changed.
(describe_change): Distinguish between cases depending on
whether 'stat' or its equivalent succeeded. Report a line
of output even if 'stat' failed, as that matches the documentation.
Rework to avoid casts.
(process_file): Do not output nonsense modes computed from
uninitialized storage, removing a couple of IF_LINTs. Simplify by
defaulting to CH_NO_STAT.
2021-08-14 Pádraig Brady
maint: update .gitignore
* .gitignore: ignore new lib/malloc gnulib directory.
maint: allow hook script accept "Signed-off-by:"
* scripts/git-hooks/commit-msg: Relax this constraint.
2021-08-11 Paul Eggert
df: fix bug with automounted
If the command-line argument is automounted, df would use
stat info that became wrong after the following open.
* NEWS: Mention the fix (bug#50012).
* src/df.c (automount_stat_err): New function.
This fixes the hang on fifos in a better way, by using O_NONBLOCK.
(main): Use it.
2021-08-08 Pádraig Brady
cat: with -E fix handling of \r\n spanning buffers
We must delay handling when \r is the last character
of the buffer being processed, as the next character
may or may not be \n.
* src/cat.c (pending_cr): A new global to record whether
the last character processed (in -E mode) is '\r'.
(cat): Honor pending_cr when processing the start of the buffer.
(main): Honor pending_cr if no more files to process.
* tests/misc/cat-E.sh: Add test cases.
Fixes https://bugs.gnu.org/49925
2021-07-31 Paul Eggert
maint: update .gitignore
build: update gnulib submodule to latest
uniq: pacify GCC -fanalyzer
Pacify GCC 11.1 -fanalyzer.
* src/uniq.c (check_file): Use simpler test to check whether this
is the first time through the loop. Although the old test was
correct, the new one is easier to understand and perhaps a tiny
bit more efficient.
numfmt: omit unnecessary pointer test
Caught by GCC 11.1 -fanalyzer.
* src/numfmt.c (simple_strtod_int): Remove unnecessary test of
*endptr vs NULL. Presumably this was a typo and **endptr was
intended instead of *endptr, but an **endptr test is also
unnecessary since c_isdigit (0) returns false.
2021-07-29 Pádraig Brady
doc: add options summary list to tr texinfo
* doc/coreutils.texi (tr invocation): Provide a summary
list of the available options, which is useful to
provide a quick reminder for those already familiar
with the functionality of tr.
Fixes https://bugs.gnu.org/49764
2021-07-28 Pádraig Brady
tests: augment new ls --zero test cases
* tests/ls/zero-option.sh: Check for the disabled, disallowed,
and allowed option combinations.
maint: avoid syntax-check failures in recent ls changes
* src/ls.c: Fix ifdef indenting and long line.
2021-07-28 Paul Eggert
doc: modernize usage of “disk” and “core”
In documentation and comments, don’t assume that secondary storage
devices are disk devices. Similarly, don’t assume that main memory
uses magnetic cores, which became obsolete in the 1970s.
* src/du.c (usage):
* src/ls.c (usage):
* src/shred.c (usage): Reword to avoid “disk” in usage messages.
doc: improve ls documentation
* doc/coreutils.texi (ls invocation): Document implementation more
closely. Be more consistent about style. Omit some needless words.
* src/ls.c (usage): Don’t overdocument -f, as the details were wrong.
Omit -1 advice as it’s a bit obsolete now that we have --zero and
is a bit much for --usage output anyway.
ls: rename --null to --zero (Bug#49716)
* NEWS, doc/coreutils.texi (General output formatting):
* src/ls.c (usage):
Document this.
* src/ls.c (ZERO_OPTION): Rename from NULL_OPTION.
All uses changed.
(long_options): Rename --null to --zero.
(dired_dump_obstack, main, print_dir): Use '\n' instead of
eolbyte where eolbyte must equal '\n'.
(decode_switches): Decode --zero instead of --null.
--zero also implies -1, -N, --color=none, --show-control-chars.
Use easier-to-decipher code to set ‘format’ and ‘dired’.
Reject attempts to combine --dired and --zero.
* tests/local.mk: Adjust to test script renaming.
* tests/ls/zero-option.sh: Rename from tests/ls/null-option.sh,
and test --zero instead of --null.
ls: compute defaults more lazily
* src/ls.c (enum time_type, enum sort_type, enum indicator_style)
(enum Dereference_symlink, ignore_mode):
Put ‘= 0’ after default values, since the code relies
on static storage defaulting to zero.
(enum sort_type): Reorder so that -1 can be used to represent unset.
(main): Test print_with_color after parse_ls_color may have reset it.
(decode_line_length): Return the line length instead of setting
static storage. All uses changed. Treat line lengths exceeding
PTRDIFF_MAX as infinite, to avoid pointer-subtraction glitches.
(stdout_isatty): New function, to avoid calling isatty twice.
(decode_switches): Calculate defaults more lazily, to avoid using
syscalls or getenv during startup unless the results are more
likely to be needed. Use -1 to indicate options that haven’t been
set on the command line yet. Move print_with_color test from
here to ‘main’. Suppress bogus GCC warning.
(getenv_quoting_style): Return the quoting style instead of
setting static storage.
(init_column_info): New arg MAX_COLS, to avoid recalculating it.
Caller changed.
2021-07-26 Pádraig Brady
maint: avoid recent syntax-check issues
* .gitignore: Cater for recently added poll module.
* src/stdbuf.c: Avoid false positive from sc_prohibit_readlink.
2021-07-26 Paul Eggert
ls: add --null option (Bug#49716)
* NEWS, doc/coreutils.texi (General output formatting):
* src/ls.c (usage): Document this.
* src/ls.c (NULL_OPTION): New constant.
(long_options): Add --null.
(eolbyte): New static var.
(dired_dump_obstack, main, print_dir, print_current_files)
(print_many_per_line, print_horizontal, print_with_separator):
Output eolbyte instead of '\n'.
(decode_switches): Decode --null.
* tests/ls/null-option.sh: New file.
* tests/local.mk (all_tests): Add it.
ls: port to wider off_t, uid_t, gid_t
* src/ls.c (dired_pos): Now off_t, not size_t, since it counts
output file offsets.
(dired_dump_obstack): This obstack's file offsets are now
off_t, not size_t.
(format_user_or_group, format_user_or_group_width):
ID arg is now uintmax_t, not unsigned long, since uid_t and
gid_t values might exceed ULONG_MAX.
(format_user_or_group_width): Use snprintf with NULL instead of
sprintf with a discarded buffer. This avoids a stack buffer,
and so should be safer.
ls: demacroize
Prefer functions or constants to macros where either will do.
That’s cleaner, and nowadays there’s no performance reason to
prefer macros. All uses changed.
* src/ls.c (INITIAL_TABLE_SIZE, MIN_COLUMN_WIDTH):
Now constants instead of macros.
(file_or_link_mode): New function, replacing the old macro
FILE_OR_LINK_MODE.
(dired_outbyte): New function, replacing the old macro DIRED_PUTCHAR.
(dired_outbuf): New function, replacing the old macro DIRED_FPUTS.
(dired_outstring): New function, replacing the old macro
DIRED_FPUTS_LITERAL.
(dired_indent): New function, replacing the old macro DIRED_INDENT.
(push_current_dired_pos): New function, replacing the old macro
PUSH_CURRENT_DIRED_POS.
(assert_matching_dev_ino): New function, replacing the old macro
ASSERT_MATCHING_DEV_INO.
(do_stat, do_lstat, stat_for_mode, stat_for_ino, fstat_for_ino)
(signal_init, signal_restore, cmp_ctime, cmp_mtime, cmp_atime)
(cmp_btime, cmp_size, cmp_name, cmp_extension)
(fileinfo_name_width, cmp_width, cmp_version):
No longer inline; compilers can deduce this well enough nowadays.
(main): Protect unused assert with ‘if (false)’ rather than
commenting it out, so that the compiler checks the code.
(print_dir): Output the space and newline in the same buffer
as the human-readable number they surround.
(dirfirst_check): New function, replacing the old macro
DIRFIRST_CHECK. Simplify by using subtraction.
(off_cmp): New function, replacing the old macro longdiff.
(print_long_format): No need to null-terminate the string now.
(format_user_or_group): Let printf count the bytes.
ls: simplify sprintf usage
* src/ls.c (format_user_or_group_width, print_long_format):
Use return value from sprintf instead of calling strlen on
the resulting buffer, or inferring the length some other way.
build: update gnulib submodule to latest
maint: fix white space
env: fix usage typo
* src/env.c (usage): Fix pluralization typo.
2021-07-02 Kamil Dudka
df: fix duplicated remote entries due to bind mounts
As originally reported in ,
df invoked without -a printed duplicated entries for NFS mounts
of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99,
which introduced the use of a hash table.
The proposed patch makes sure that the devlist entry seen the last time
is used for comparison when eliminating duplicated mount entries. This
way it worked before introducing the hash table.
Patch co-authored by Roberto Bergantinos.
* src/ls.c (struct devlist): Introduce the seen_last pointer.
(devlist_for_dev): Return the devlist entry seen the last time if found.
(filter_mount_list): Remember the devlist entry seen the last time for
each hashed item.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/49298
2021-06-27 Paul Eggert
tail: use poll, not select
This fixes an unlikely stack out-of-bounds write reported by
Stepan Broz via Kamil Dudka (Bug#49209).
* bootstrap.conf (gnulib_modules): Replace select with poll.
* src/tail.c: Do not include .
[!_AIX]: Include poll.h.
(check_output_alive) [!_AIX]: Use poll instead of select.
(tail_forever_inotify): Likewise. Simplify logic, as there is no
need for a ‘while (len <= evbuf_off)’ loop.
tail: fix abuse2 test race
* tests/tail-2/inotify-hash-abuse2.sh (fastpoll):
Fix race where tailed file ‘f’ temporarily did not exist.
maint: while (1) → while (true)
2021-06-21 Nikolay Nechaev
maint: remove redundant checks on buffer sizes in tail
* src/tail.c: remove redundant size checks before calls to
`xwrite_stdout`
2021-06-21 Pádraig Brady
stat: use decomposed decimal device numbers by default
* src/stat.c (default_format): Use decomposed decimal
representation (major,minor) in the default format.
This is least ambiguous for human interpretation,
and more consistent with ls for example.
Fixes https://bugs.gnu.org/48960
2021-06-21 Pádraig Brady
stat: support more device number representations
In preparation for changing the default device number
representation (to decomposed decimal), provide more
formatting options for device numbers.
These new (FreeBSD compat) formatting options are added:
%Hd major device number in decimal (st_dev)
%Ld minor device number in decimal (st_dev)
%Hr major device type in decimal (st_rdev)
%Lr minor device type in decimal (st_rdev)
%r (composed) device type in decimal (st_rdev)
%R (composed) device type in hex (st_rdev)
* doc/coreutils.texi (stat invocation): Document new formats.
* src/stat.c (print_it): Handle the new %H and %L modifiers.
(print_statfs): Adjust to passing the format as two chars
rather than an int. Using an int was introduced in commit db42ae78,
but using separate chars is cleaner and more extensible.
(print_stat): Likewise. Handle any modifiers and the new 'r' format.
(usage): Document the new formats.
* tests/misc/stat-fmt.sh: Add a test case for new modifiers.
Addresses https://bugs.gnu.org/48960
2021-06-12 Paul Eggert
build: update gnulib submodule to latest
Coreutils mistakenly did not list xstrndup as a module
that it depends on directly. When the latest Gnulib removed
the dirname module's dependency on xstrndup, this mistake
caused coreutils to not build. Since all of Coreutils's
uses of xstrndup know the string length, xmemdup0 is a better
match for what's needed. Since the size args are typically
signed or derived from subtracting pointers, the new Gnulib
ximemdup0 function is a better match yet.
So, use ximemdup0 instead of xstrndup.
* src/cut.c, src/dircolors.c, src/expand-common.c, src/expand.c:
* src/numfmt.c, src/set-fields.c, src/unexpand.c:
Do not include xstrndup.h; no longer needed.
* src/dircolors.c (parse_line):
* src/expand-common.c (parse_tab_stops):
* src/numfmt.c (parse_format_string):
* src/set-fields.c (set_fields):
Use ximemdup0 instead of xstrndup.
2021-05-28 Jim Meyering
maint: bootstrap: remove reference to unused hash-pjw module
* bootstrap.conf (gnulib_modules): Remove hash-pjw. No longer used.
2021-05-15 Pádraig Brady
build: update gnulib submodule to latest
Fixes a false test failure with MALLOC_CHECK_ set.
* gnulib: Update to latest.
2021-05-15 Pádraig Brady
copy: remove fiemap logic
This is now only used on 10 year old linux kernels,
and performs a sync before each copy.
* src/copy.c (extent_copy): Remove function and all callers.
* src/extent-scan.c: Remove.
* src/extent-scan.h: Remove.
* src/fiemap.h: Remove.
* src/local.mk: Adjust for removed files.
* NEWS: Adjust to say fiemap is removed.
2021-05-13 Pádraig Brady
copy: disallow copy_file_range() on Linux kernels before 5.3
copy_file_range() before Linux kernel release 5.3 had many issues,
as described at https://lwn.net/Articles/789527/, which was
referenced from https://lwn.net/Articles/846403/; a more general
article discussing the generality of copy_file_range().
Linux kernel 5.3 was released in September 2019, which is new enough
that we need to actively avoid older kernels.
* src/copy.c (functional_copy_file_range): A new function
that returns false for Linux kernels before version 5.3.
(sparse_copy): Call this new function to gate use of
copy_file_range().
2021-05-12 Pádraig Brady
tests: fix tests/cp/sparse-2.sh false failure on some systems
* tests/cp/sparse-2.sh: Double check cp --sparse=always,
with dd conv=sparse, in the case where the former didn't
create a sparse file. Now that this test is being newly run
on macos, we're seeing a failure due to seek() not creating
holes on apfs unless the size is >= 16MiB.
2021-05-12 Pádraig Brady
tests: ensure we test SEEK_DATA where used
fiemap is no longer the default copy implementation,
so check for SEEK_DATA support instead as that's preferred.
This will ensure better test coverage on systems without fiemap.
* init.cfg: Replace fiemap_capable_ with seek_data_capable_.
This is best supported with python 3 so prefer that.
* tests/seek-data-capable: A new test script checking for
SEEK_DATA support on the passed file name,
called from seek_data_capable_.
* tests/fiemap-capable: Remove no longer used probing script.
* tests/cp/fiemap-perf.sh: Renamed to tests/cp/sparse-perf.sh
* tests/cp/fiemap-2.sh: Renamed to tests/cp/sparse-2.sh
* tests/cp/fiemap-extents.sh: Renamed to tests/cp/sparse-extents.sh
* tests/cp/sparse-fiemap.sh: Renamed to tests/cp/sparse-extents-2.sh
* tests/cp/fiemap-FMR.sh: Renamed to tests/cp/copy-FMR.sh
* tests/local.mk: Reference the renamed tests.
2021-05-12 Pádraig Brady
copy: handle system security config issues with copy_file_range()
* src/copy.c (sparse_copy): Upon EPERM from copy_file_range(),
fall back to a standard copy, which will give a more accurate
error as to whether the issue is with the source or destination.
Also this will avoid the issue where seccomp or apparmor are
not configured to handle copy_file_range(), in which case
the fall back standard copy would succeed without issue.
This specific issue with seccomp was noticed for example in:
https://github.com/golang/go/issues/40900
copy: handle EOPNOTSUPP from SEEK_DATA
* src/copy.c (infer_scantype): Ensure we don't error out
if SEEK_DATA returns EOPNOTSUPP, on systems where this value
is distinct from ENOTSUP. Generally both of these should be checked.
copy: handle ENOTSUP from copy_file_range()
* src/copy.c (sparse_copy): Ensure we fall back to
a standard copy if copy_file_range() returns ENOTSUP.
This generally is best checked when checking ENOSYS,
but it also seems to be a practical concern on Centos 7,
as a quick search gave https://bugzilla.redhat.com/1840284
2021-05-10 Pádraig Brady
build: update gnulib submodule to latest
Fixes a bits/long-double.h include build issue on some systems.
* bootstrap: Sync new --version option from gnulib.
* gnulib: Update to lastest.
Reported by Carl Edquist
2021-05-10 Carl Edquist
build: fix __get_cpuid_count check to catch link failure
The test program will compile successfully even if __get_cpuid_count
is not declared. The error for the missing symbol will only show up
at link time. Thus, use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE.
* configure.ac (__get_cpuid_count check): Use C_LINK_IFELSE instead
of AC_COMPILE_IFELSE.
(__get_cpuid check): Likewise.
2021-05-08 Pádraig Brady
maint: consistently free hash structures in dev mode
Ensure we call hash_free() to avoid valgrind and leak_sanitizer
"definitely lost" warnings. These were not real leaks as
we terminate immediately after, but we should avoid these
"definitely lost" warnings where possible.
* src/copy.c: Add dest_info_free() and src_info_free().
* src/copy.h: Declare the above.
* src/cp-hash.c: Don't define unless "lint" is defined.
* src/install.c: Call dest_info_free() in dev mode.
* src/mv.c: Likewise.
* src/cp.c: Likewise. Also call src_info_free().
* src/ln.c: Call hash_free() in dev mode.
* src/tail.c: Call hash_free() even if about to exit, in dev mode.
Fixes https://bugs.gnu.org/48189
2021-05-06 Bernhard Voelker
maint: fix sc_space_before_open_paren failure
* src/copy.c (dest_info_init): Add space before parens.
(src_info_init): Likewise.
Syntax-check failure introduced in the previous commit.
2021-05-03 Pádraig Brady
copy: exit immediately upon failure to allocate hash memory
* src/copy.c (dest_info_init, src_info_init): Terminate immediately
upon memory exhaustion.
2021-05-02 Pádraig Brady
copy: ensure we enforce --reflink=never
* src/copy.c (sparse_copy): Don't use copy_file_range()
with --reflink=never as copy_file_range() may implicitly
use acceleration techniques like reflinking.
(extent_copy): Pass through whether we allow reflinking.
(lseek_copy): Likewise.
Fixes https://bugs.gnu.org/48164
wc: add --debug to diagnose which implementation used
* src/wc.c: (main): Handle the new --debug option.
Only call avx2_supported if needed.
(avx2_supported): Diagnose various failures and attempts.
* NEWS: Mention the new wc improvement and --debug option.
2021-05-02 Kristoffer Brånemyr
wc: use avx2 optimization when counting only lines
Use cpuid to detect CPU support for avx2 instructions.
Performance was seen to improve by 5x for a file with only newlines,
while the performance for a file with no such characters is unchanged.
* configure.ac [USE_AVX2_WC_LINECOUNT]: A new conditional,
set when __get_cpuid_count() and avx2 compiler intrinsics are supported.
* src/wc.c (avx2_supported): A new function using __get_cpuid_count()
to determine if avx2 instructions are supported.
(wc_lines): A new function refactored from wc(),
which implements the standard line counting logic,
and provides the fallback implementation for when avx2 is not supported.
* src/wc_avx2.c: A new module to implement using avx2 intrinsics.
* src/local.mk: Reference the new module. Note we build as a separate
lib so that it can be portably built with separate -mavx2 etc. flags.
2021-05-01 Paul Eggert
touch: fix wrong diagnostic (Bug#48106)
Problem reported by Roland (Bug#48106).
* src/touch.c (touch): Take more care when deciding whether
to use open_errno or utime_errno in the diagnostic.
Stop worrying about SunOS 4 (which as part of the problem),
as it’s long obsolete. For Solaris 10, verify that EINVAL
really means the file was a directory.
2021-04-27 Paul Eggert
maint: port to Autoconf 2.71
* configure.ac: Use AC_PROG_CC, not AC_PROG_CC_STDC.
* gl/modules/smack (configure.ac):
* m4/jm-macros.m4 (coreutils_MACROS):
* m4/xattr.m4 (gl_FUNC_XATTR):
Use AS_HELP_STRING, not AC_HELP_STRING.
* m4/check-decl.m4 (gl_CHECK_DECLS):
Do not require AC_HEADER_TIME; we no longer care about it directly.
* m4/jm-macros.m4 (coreutils_MACROS):
Do not require AC_ISC_POSIX, which became obsolete in 2006.
Use AC_LINK_IFELSE instead of AC_TRY_LINK.
csplit: size_t overflow check
* src/csplit.c (get_new_buffer): Fix unlikely size_t overflow.
build: update gnulib submodule to latest
* src/csplit.c (load_buffer):
* src/pinky.c (create_fullname):
Use intprops-based checks rather than xalloc_oversized,
since Gnulib xalloc.h no longer includes xalloc-oversized.h.
2021-04-27 Zorro Lang
copy: do not refuse to copy a swap file
* src/copy.c (sparse_copy): Fallback to read() if copy_file_range()
fails with ETXTBSY. Otherwise it would be impossible to copy files
that are being used as swap. This used to work before introducing
the support for copy_file_range() in coreutils. (Bug#48036)
2021-04-22 Bernhard Voelker
tests: fix FP in ls/stat-free-color.sh
On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls
newfstatat(STDOUT_FILENO, ...), but only when there is something to
output.
* tests/ls/stat-free-color.sh: Add -a option to the reference invocation
of ls, thus enforcing something gets output.
2021-04-11 Pádraig Brady
doc: clarify that ln --relative requires --symbolic to be specified
* doc/coreutils.texi (ln invocation): State --symbolic is required.
* src/ln.c (usage): Explicitly state -s is not implied.
Fixes https://bugs.gnu.org/47703
doc: clarify what's counted by wc
* src/wc.c (usage): State that only printable characters are considered
when counting words. This also disambiguates wether we're talking
about bytes or characters in this context.
* doc/coreutils.texi (wc invocation): Likewise. Also clarify
that --characters counts valid locale aware characters,
and that --lines does not count a trailing "line" unless
it ends with a newline character.
Fixes https://bugs.gnu.org/47702
maint: use "char const *" rather than "const char *"
* cfg.mk (sc_prohibit-const-char): Add a new syntax-check to
enforce this style.
* *.[ch]: sed -i 's/const char \*/char const */g'
2021-04-11 Pádraig Brady
ls: cache name width determination
This is especially important now for --sort=width,
as that can greatly increase how often this
expensive quote_name_width() function is called per file.
This also helps the default invocation of ls,
or specifically the --format={across,vertical} cases
(when --width is not set to 0),
to avoid two calls to this function per file.
Note the only case where we later compute the width,
is for --format=commas. That's only done once though,
so we leave the computation close to use to
maximize hardware caching.
* src/ls.c (struct fileinfo): Add a WIDTH member to cache
the screen width of the file name.
(update_current_files_info): Set the WIDTH members for cases
they're needed multiple times. Note we do this explicitly here,
rather than caching at use, so that the fileinfo
structures can remain const in the sorting and presentation functions.
(sort_files): Call the new update_current_files_info() in this
initialization function.
(fileinfo_name_width): Renamed from fileinfo_width,
and adjusted to return the cached value if available.
2021-04-11 Carl Edquist
ls: add --sort=width option to sort by file name width
This helps identify the outliers for long filenames, and also produces
a more compact display of columns when listing a directory with many
entries of various widths.
* src/ls.c (sort_type, sort_types, sort_width): New sort_width sort
type.
(sort_args): Add "width" sort arg.
(cmp_width, fileinfo_width): New sort function and helper for file name
width.
(quote_name_width): Add function prototype declaration.
(usage): Document --sort=width option.
* doc/coreutils.texi: Document --sort=width option.
* tests/ls/sort-width-option.sh: New test for --sort=width option.
* tests/local.mk: Reference new test.
* NEWS: Mention the new feature.
2021-03-30 Paul Eggert
env: simplify --split-string memory management
* bootstrap.conf (gnulib_modules): Add idx.
* src/env.c: Include idx.h, minmax.h.
Prefer idx_t to ptrdiff_t when values are nonnegative.
(valid_escape_sequence, escape_char, validate_split_str)
(CHECK_START_NEW_ARG):
Remove; no longer needed now that we validate as we go.
(struct splitbuf): New type.
(splitbuf_grow, splitbuf_append_byte, check_start_new_arg)
(splitbuf_finishup): New functions.
(build_argv): New arg ARGC. Validate and process in one go, using
the new functions; this is simpler and more reliable than the old
approach (as witness the recent bug). Avoid integer overflow in
the unlikely case where the string contains more than INT_MAX
arguments.
(parse_split_string): Simplify by exploiting the new build_argv.
build: update gnulib submodule to latest
2021-03-29 Pádraig Brady
tests: add a test case for recent env fix
* tests/misc/env-S.pl: Add a test case for recent commit ec6904f0.
maint: ignore all .a files in .gitignore
* .gitignore: Rather than add the new src/libcksum_pclmul.a,
just ignore any such libs.
* src/.gitignore: Likewise.
Reported by Kristoffer Brånemyr.
2021-03-26 Paul Eggert
env: prefer ptrdiff_t
* src/env.c (usvars_used, vnlen, unset_envvars, expansion)
(build_argv): Prefer ptrdiff_t to size_t when either will do.
env: improve whitespace warning
* src/env.c (main): Issue -S warning for any whitespace,
not just space.
env: use GNU coding style
* src/env.c: Use GNU coding style for recentish changes.
env: remove asserts
The assertions didn’t help catch the most recent bug which
was in their area, and kind of get in the way.
* src/env.c: Do not include , and remove all assertions.
These seem to have been put in to pacify gcov, but surely there’s
a better way.
(escape_char): Pacify GCC with 'assume' instead.
doc: document env fix
* NEWS, doc/coreutils.texi (env invocation): Document recent change.
env: fix address violation with '\v' in -S
Problem reported by Frank Busse (Bug#47412).
* src/env.c (C_ISSPACE_CHARS): New macro.
(shortopts, build_argv, main): Treate all C-locale space
characters like space and tab, for compatibility with FreeBSD.
(validate_split_str, build_argv, parse_split_string):
Use the C locale, not the current locale, to determine whether a
byte is a space character.
2021-03-25 Paul Eggert
hostname: pacify valgrind
* src/hostname.c (main) [IF_LINT]: Free hostname (Bug#47384).
hostname: use puts
* src/hostname.c (main): Prefer puts to printf "%s\n".
maint: indenting
* src/ln.c: Fix indenting.
2021-03-25 Kamil Dudka
ln: fix memory leaks in do_link
* src/ln.c (do_link): Free memory allocated by convert_abs_rel
on all code paths (Bug#47373).
2021-03-25 Paul Eggert
stdbuf: port lib to macOS
* src/libstdbuf.c (fprintf, free, strtoumax): Undef these too,
since Gnulib might replace them.
2021-03-24 Paul Eggert
cksum: port recent changes to macOS
* src/cksum.c (cksum_slice8): Fix bug on little-endian
platforms lacking __bswap_32: the SWAP macro evaluates
its argument multiple times, but the macro has a side effect.
2021-03-22 Bernhard Voelker
maint: update bootstrap from gnulib
* bootstrap: Sync from gnulib/build-aux/bootstrap; the previous gnulib
update (commit 1a3eb6c30) missed to update that file.
2021-03-21 Paul Eggert
ptx: remove use of diacrit module
The diacrit module is obsolete, and ptx’s use of it is obsolete
too; it assumes an 8-bit locale (not that common these days) and
that TeX cannot process the 8-bit characters (nowadays, it can).
* NEWS, doc/coreutils.texi (Charset selection in ptx): Document this.
* bootstrap.conf (gnulib_modules): Remove diacrit.
* src/ptx.c: Do not include diacrit.h.
(print_field, fix_output_parameters): Remove obsolete support
for 8-bit diacritics.
build: update gnulib submodule to latest
2021-03-15 Pádraig Brady
cksum: don't exit immediately if a single file overflows
This behavior was introduced in commit FILEUTILS-4_0_44-4-g519b707b4.
* src/cksum.c (cksum_slice8): Only report the overflow, and continue.
* src/cksum_pclmul.c (cksum_pclmul): Likewise.
2021-03-15 Pádraig Brady
cksum: add --debug to diagnose which implementation used
* src/cksum.c: (main): Use getopt_long to parse options,
and handle the new --debug option.
(pclmul_supported): Diagnose various failures and attempts.
* NEWS: Mention the new option.
2021-03-15 Kristoffer Brånemyr
cksum: use pclmul hardware instruction for CRC32 calculation
Use cpuid to detect CPU support for hardware instruction.
Fall back to slice by 8 algorithm if not supported.
A 500MiB file improves from 1.40s to 0.67s on an i3-2310M
* configure.ac [USE_PCLMUL_CRC32]: A new conditional,
set when __get_cpuid() and clmul compiler intrinsics are supported.
* src/cksum.c (pclmul_supported): A new function using __get_cpuid()
to determine if pclmul instructions are supported.
(cksum): A new function refactored from cksum_slice8(),
which calls pclmul_supported() and then cksum_slice8()
or cksum_pclmul() as appropriate.
* src/cksum.h: Export the crctab array for use in the new module.
* src/cksum_pclmul.c: A new module to implement using pclmul intrinsics.
* po/POTFILES.in: Reference the new cksum_pclmul module.
* src/local.mk: Likewise. Note we build it as a separate library
so that it can be portably built with separate -mavx etc. flags.
* tests/misc/cksum.sh: Add new test modes for pertinent buffer sizes.
2021-03-14 Pádraig Brady
maint: propagate DEPENDENCIES to libs in single binary mode
build-aux/gen-single-binary.sh (override_single): A new function
to refactor the existing mappings for dir, vdir, and arch.
This function now also sets the DEPENDENCIES variable so that these
dependencies can be maintained later in the script, where
we now propagate the automake generated $(src_$cmd_DEPENDENCIES)
to our equivalent src_libsinglebin_$cmd_a_DEPENDENCIES.
This will ensure that any required libs are built,
which we require in a following change to cksum that
builds part of it as a separate library.
2021-02-19 Pádraig Brady
rmdir: diagnose non following of symlinks with trailing slash
GNU/Linux is unusual here in that rmdir("symlink/") returns ENOTDIR,
whereas Solaris and FreeBSD at least, will follow the symlink
and remove the target directory. We don't make the behavior
on Linux kernels consistent, but at least clarify
the confusing error message.
* src/rmdir (main): Output a specific error message for the above case.
(remove_parents): In the error message, don't assume intermediate paths
are directories, as they could be symlinks.
* tests/rmdir/symlink-errors.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the improvement.
2021-02-18 Kamil Dudka
stat,tail: add support for the exfat file system
Bug: https://bugzilla.redhat.com/1921427
* src/stat.c (human_fstype): Add case for the 'exfat' file system type.
* NEWS: Mention the Improvement.
Fixes https://bugs.gnu.org/46613
2021-02-15 Erik Auerswald
pr: fix alignment of input tabs to multiple columns
This regression was introduced in commit COREUTILS-6_8-58-g553d347d3
* src/pr.c (init_parameters): Process tabs for multiple columns.
* tests/pr/pr-tests.pl: Add test cases.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/46422
2021-02-10 Pádraig Brady
cat: extend --show-ends to show \r\n as ^M$
- \r\n is common a line end combination
- catting such a file without options causes it to display normally
- overwriting the first char with $, loses info
* src/cat.c (cat): Convert \r preceeding a \n to ^M.
* tests/misc/cat-E.sh: New test.
* tests/local.mk: Reference new test.
* tests/misc/cat-proc.sh: Fix typo.
* doc/coreutils.texi (cat invocation): Mention the new behavior.
* NEWS: Mention the improvement.
2021-01-26 Paul Eggert
expr: fix bug with unmatched \(...\)
Problem reported by Qiuhao Li.
* NEWS: Mention this.
* doc/coreutils.texi (String expressions):
Document the correct behavior, which POSIX requires.
* src/expr.c (docolon): Treat unmatched \(...\) as empty.
* tests/misc/expr.pl: New test.
2021-01-25 Pádraig Brady
split: fix --number=K/N to output correct part of file
This functionality regressed with the adjustments
in commit v8.25-4-g62e7af032
* src/split.c (bytes_chunk_extract): Account for already read data
when seeking into the file.
* tests/split/b-chunk.sh: Use the hidden ---io-blksize option,
to test this functionality.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/46048
2021-01-19 Paul Eggert
doc: rmdir --recursive substitutes
* doc/coreutils.texi (rmdir invocation): Add note on how to remove
empty subdirectories recursively.
2021-01-15 Paul Eggert
mkdir: fix bug when -m's more generous than umask
Problem reported by David McCall (Bug#45886).
I introduced this problem when fixing Bug#14371.
* NEWS: Mention the fix.
* src/mkdir.c (struct mkdir_options): New members umask_ancestor,
umask_self, replacing umask_value.
(make_ancestor): Use them when temporarily adjusting umask.
(main): Set them, and set the umask to umask_self instead
of leaving it alone.
* tests/mkdir/perm.sh (tests): Add test case for bug.
2021-01-09 Paul Eggert
doc: modernize and fix regexp xref
* doc/coreutils.texi: Fix regexp cross-reference that had become
out-of-date (Bug#45749). Also, fix some obsolete references to
SunOS and to /usr/dict/words, and change “Linux” to “GNU/Linux”
where appropriate. Unfortunately the pipeline example gets more
complicated since /usr/share/dict/words is not sorted the way that
‘comm’ wants.
2021-01-03 Bernhard Voelker
doc: make formatting of SEE ALSO in cat.1 and tac.1 consistent
None of the coreutils man pages - but the two above - are using bold
setting for the references to other man pages in the SEE ALSO section.
* man/cat.x (SEE ALSO): Remove '\fB...\fP' setting.
* man/tac.x: Likewise, and add a reference to cat(1).
2021-01-02 Bernhard Voelker
maint: exempt 'doc/fdl.texi' from 'make update-copyright'
This file is a copy from gnulib and therefore should not get changed
by the yearly update.
* .x-update-copyright: Add pattern for the above file.
* doc/fdl.texi: Revert the previous change.
2021-01-01 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.
2020-12-28 Pádraig Brady
tests: add a test for cksum
* tests/misc/cksum.sh: Test basic operation.
* tests/local.mk: Reference the new test.
2020-12-28 Kristoffer Brånemyr
cksum: use more efficient slice by 8 algorithm
A 100MB file improves from 2.50s to 1.80s on a Sparc T5220
A 100MB file improves from 0.54s to 0.13s on an i3-2310M
* bootstrap.conf: Explicitly depend on byteswap,
since now used directly by coreutils.
* src/cksum.c (cksum): Process in multiples of 8 bytes.
(main): Adjust for generation of expanded crctab.
* src/cksum.h: Split now larger crctab to separate header.
* src/local.mk: Reference the new header.
* NEWS: Mention the improvement.
2020-12-25 Paul Eggert
build: update gnulib submodule to latest
* src/make-prime-list.c (free): Undef, since Gnulib's free-posix
module now defines this to rpl_free on some platforms.
2020-12-18 Pádraig Brady
doc: remove extraneous ./src/ prefix from examples
* doc/coreutils.texi (numfmt invocation): s|./src/numfmt|numfmt|
doc: add `seq inf` and `sleep inf` examples to texinfo
* doc/coreutils.texi (seq invocation): Mention "inf" is supported,
and describe that it's handled specially to generate infinite
whole integer sequences. Also mention that such infinite generation
is supported for integer steps up to 200.
(sleep invocation): Give `sleep inf` as an example to sleep forever.
* src/seq.c: Add a comment on SEQ_FAST_STEP_LIMIT, to say it's
reflected in the texinfo description.
2020-12-15 Paul Eggert
doc: document mkdir -m -p better
Chris Colohan wrote that the man page did not do enough to dispel
a common misunderstanding that “contributed to one of the scariest
outages Google has ever seen” (Bug#45258).
* doc/coreutils.texi (mkdir invocation):
* src/mkdir.c (usage): Document -m vs -p better.
2020-12-15 KOBAYASHI Takashi
nl: fix --section-delimiter handling of single characters
* src/nl.c (main): Enforce the POSIX specified
behavior of assuming ':' is specified after a single
character argument to -d.
* tests/misc/nl.sh: Add a test case.
* NEWS: Mention the bug fix.
2020-12-15 Pádraig Brady
doc: mention the GNU extensions to nl --section-delimiter
* doc/coreutils.texi (nl invocation): Mention the GNU extensions
of allowing arbitrary length and empty delimiter strings.
* src/nl.c (usage): Likewise.
* tests/misc/nl.sh: Add test cases for the GNU extensions.
maint: refactor nl section delimiter handling
* src/nl.c (main): Update the default delimiter characters
when passed two characters with --section-delimiter.
Avoid redundant copies for the body and footer delimiter strings,
and instead, just offset into the header string.
(check_section): Avoid redundant comparing of 2 bytes of memory
for an empty delimiter.
2020-12-12 Paul Eggert
build: update gnulib submodule to latest
2020-12-08 Arman Absalan
chroot,comm,join: fix usage options style
* src/chroot.c (usage): Fix indentation of options.
* src/comm.c: Likewise.
* src/join.c: Likewise.
2020-12-01 Pádraig Brady
date: with --debug, show the output format
The format can be determined from --options or the locale,
so it's useful to output the format string being used.
* src/date.c (show_date): Show the output format
along with the date being shown.
* tests/misc/date-debug.sh: Adjust accordingly.
Addresses https://bugs.gnu.org/44960
2020-11-27 Tim Gates
maint: fix typo, characteres -> characters
* src/expr.c: Fix typo in comment.
2020-11-26 Nishant Nayan
rm: do not skip files upon failure to remove an empty dir
When removing a directory fails for some reason, and that directory
is empty, the rm_fts code gets the return value of the excise call
confused with the return value of its earlier call to prompt,
causing fts_skip_tree to be called again and the next file
that rm would otherwise have deleted to survive.
* src/remove.c (rm_fts): Ensure we only skip a single fts entry,
when processing empty dirs. I.e. only skip the entry
having successfully removed it.
* tests/rm/empty-immutable-skip.sh: New root-only test.
* tests/local.mk: Add it.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/44883
2020-11-26 Pádraig Brady
maint: mention in NEWS about new df remote fs types
* NEWS: Mention new remote file system types
recognized since gnulib commit dd1fc46b.
2020-11-23 Pádraig Brady
maint: remove no longer needed se_const helper
This was needed before libselinux-2.3 (May 2014),
but modern releases have the correct const declarations.
* src/chcon.c: Remove se_const() wrapper.
* src/cp.c: Likewise.
* src/install.c: Likewise.
* src/mkdir.c: Likewise.
* src/mkfifo.c: Likewise.
* src/mknod.c: Likewise.
* src/system.h: Likewise.
* gnulib: update to pick up const correctness fixes in selinux stubs.
2020-11-23 Pádraig Brady
maint: fix syntax-check failure
* po/POTFILES.in (src/selinux.c): Remove entry as this source doesn't
contain any translatable strings anymore; avoids a sc_po_check failure.
2020-11-23 Paul Eggert
install: suppress "Operation not supported" false alarms
At least, I *think* they are false alarms. An SELinux expert eye
would be welcome.
* src/install.c (setdefaultfilecon): If selabel_lookup fails
due to either ENOTSUP or ENODATA, don’t diagnose the issue.
Problem reported by Kamil Dudka in:
https://lists.gnu.org/r/coreutils/2020-11/msg00050.html
maint: propagate errno better in selinux.c
* src/selinux.c: Don’t include die.h; no longer needed.
(computecon, defaultcon, restorecon): Propagate errno.
(defaultcon, restorecon): Don’t diagnose errors or exit, as that’s
the caller’s responsibility.
2020-11-23 Pádraig Brady
maint: use absolute paths with selabel_lookup
* src/selinux.c: selabel_lookup requires absolute paths
(while only older matchpathcon before libselinux < 2.1.5 2011-0826 did).
* po/POTFILES.in: Readd src/selinux.c since we now have
a translatable error message.
2020-11-22 Bernhard Voelker
maint: minor cleanup
The previous commit introduced a couple of syntax-check failures.
* .gitignore (/lib/se-label.h): Add entry to silence the
sc_gitignore_missing check. Sort entries in C locale.
* po/POTFILES.in (src/selinux.c): Remove entry as this source doesn't
contain any translatable strings anymore; avoids a sc_po_check failure.
* src/mv.c: Replace tabs by spaces to avoid complaints by
sc_prohibit_tab_based_indentation.
2020-11-22 Paul Eggert
build: update gnulib submodule to latest
maint: port from matchpathcon to selabel_lookup
Ubuntu 20.10 is using a newer version of libselinux that
complains that matchpathcon is obsolete. Rewrite the code
that it uses the recommended selabel_lookup instead.
* m4/jm-macros.m4 (coreutils_MACROS): Do not check for
matchpathcon_init_prefix, as it is no longer used.
* src/copy.c (set_file_security_ctx): Omit process_local arg,
as it is equivalent to !x->set_security_context. All callers changed.
* src/copy.h (struct cp_options): set_security_context is now of
type struct selabel_handle *, not bool. All uses changed.
* src/cp.c, src/install.c, src/mkdir.c, src/mkfifo.c, src/mknod.c:
* src/mv.c: Include selinux/label.h.
(main): Use selabel_open for set_security context.
* src/install.c (matchpathcon_init_prefix): Remove; now unused.
(get_labeling_handle): New static function.
(setdefaultfilecon, main): Use it.
(setdefaultfilecon): Do something regardless of
ENABLE_MATCHPATHCON, which seems to be a revenant macro.
(setdefaultfilecon): Use selabel_lookup instead of the obsolescent
matchpathcon. Report an error unless it fails due to ENOENT.
* src/local.mk (src_ginstall_CPPFLAGS): Remove.
* src/selinux.c: Include selinux/label.h
Do not include die.h, error.h, canonicalize.h.
(defaultcon, restorecon_private, restorecon):
New arg HANDLE. All callers changed.
Use selabel_lookup rather than matchpathcon.
(restorecon_private, restorecon): Don’t lose track of errno.
* src/selinux.c, src/selinux.h:
(restorecon): Don’t call ‘error’; that’s the caller’s job.
Use HAVE_SELINUX_LABEL_H, not HAVE_SELINUX_SELINUX_H,
in case there is some weird system with the former but not the latter.
* src/selinux.h (struct selinux_handle): Add forward decl.
build: port to Solaris 10
* src/local.mk (src_ln_LDADD, src_mktemp_LDADD, src_tac_LDADD):
Add $(LIB_CLOCK_GETTIME), since these use tempname which uses
clock_gettime if getrandom fails. On platforms like Solaris 10,
clock_gettime is not in the standard C library.
build: update gnulib submodule to latest
2020-11-18 Pádraig Brady
doc: mention that sort -g supports hex numbers
* doc/coreutils.texi (sort invocation): Mention explicitly
that --general-numeric-sort supports arbitrary format hex numbers,
but also mention that consistent case/width hex numbers can
be sorted faster with a standard sort.
2020-11-14 Pádraig Brady
tr: fix crash validating -c with some case char classes
This crash was identified by Cyber Independent Testing Lab:
https://cyber-itl.org/2020/10/28/citl-7000-defects.html
and was introduced with commit v8.5-163-g3f48829c2
* src/tr.c (validate_case_classes): Don't apply these
extra case alignment checks in the --complement case,
which is even more restrictive as to the contents of SET2.
* tests/misc/tr-case-class.sh: Add a test case,
for a large SET1, which caused the length adjustment
in validate_case_classes to underflow and trigger the assert.
* NEWS: Mention the bug fix.
2020-11-12 Ben Pfaff
doc: clarify in texinfo that `test == ...` is non portable
* doc/coreutils.texi (test invocation): Mention non portability
of the double equals form.
2020-11-11 Pádraig Brady
ls: fix crash printing SELinux context for unstatable files
This crash was identified by Cyber Independent Testing Lab:
https://cyber-itl.org/2020/10/28/citl-7000-defects.html
and was introduced with commit v6.9.90-11-g4245876e2
* src/ls.c (gobble_file): Ensure scontext is initialized
in the case where files are not statable.
* tests/ls/selinux-segfault.sh: Renamed from proc-selinux-segfault.sh,
and added test case for broken symlinks.
* tests/local.mk: Adjust for the renamed test.
* NEWS: Mention the bug fix.
2020-11-07 Pádraig Brady
timeout: support sub-second timeouts on macOS
* m4/jm-macros.m4: Check for setitimer.
* src/timeout.c: Use setitimer if timer_settime is not available.
* NEWS: Mention the improvement.
2020-11-07 Pádraig Brady
maint: avoid strncat warning on GCC
GCC 10.1.1 without optimization gives:
error: ‘strncat’ argument 2 declared attribute ‘nonstring’
[-Werror=stringop-overflow=]
strncat (comment, UT_ID (utmp_ent), utmpsize);
Note the strncat man page says that:
"src does not need to be null-terminated
if it contains n or more bytes."
And the POSIX spec says that the second (source) parameter
is an array not a string.
So I think it's incorrect for strncat to require src be a string type.
This constraint seems to be being added to the gcc builtin strncat,
as specifiying -fno-builtin also avoids the warning.
Note specifying any optimization level also avoids the warning.
* src/who.c (make_id_equals_comment): Avoid the issue by using
stpcpy + stzncpy, instead of strcpy + strncat.
This pattern is used elsewhere in who.c
2020-10-28 Pádraig Brady
stat,tail: sync file system constants from the linux kernel
* src/stat.c: Add magic constants for "devmem", and
"zonefs" file systems.
* NEWS: Mention the improvement.
maint: cleanup operation of fs-magic-compare
* src/local.mk: Ensure we map 2 hex digits to 4,
so that we don't output already handled Z3FOLD file system (0x33).
Also hide the generation command for src/fs.h.
2020-10-27 Pádraig Brady
doc: make blank lines before --help consistent
* src/basenc.c (usage): Remove extraneous blank line,
to be consistent with other utilities that have options.
* src/realpath.c: Likewise.
* src/runcon.c: Likewise.
Addresses https://bugs.gnu.org/44248
2020-10-26 Jim Meyering
maint: avoid new sort.c warning from upcoming GCC11
gcc version 11.0.0 20201025 (experimental) warns that
src/sort.c:1655:1: warning: function might be candidate for attribute \
'pure' if it is known to return normally [-Wsuggest-attribute=pure]
* src/sort.c (limfield): Mark as pure.
2020-10-26 Kamil Dudka
dd: drop old workaround for lseek() bug in Linux kernel
The workaround triggers warnings from newer kernel versions in case
a user does not have sufficient privileges for the MTIOCGET ioctl.
* src/dd.c (skip_via_lseek): Drop wrapper function no longer needed.
(skip): Use lseek() directly.
(advance_input_after_read_error): Likewise.
Reported-by: Nir Soffer at https://bugzilla.redhat.com/1876840
Fixes https://bugs.gnu.org/44235
2020-10-26 KOBAYASHI Takashi
nl: support a negative --line-increment
* src/nl.c (main): Allow -i to accept down to INTMAX_MIN.
* tests/misc/nl.sh: Add test cases.
* NEWS: Mention the new feature.
2020-10-25 Pádraig Brady
nl: only fail if need to output overflowed numbers
Previously we would have failed immediately upon internal overflow,
which didn't output the full line being processed, and assumed
there would be another numbered line.
* src/nl.c (line_no_overflow): A new global to track overflow.
(print_lineno): Only fail if about to output an overflowed number.
(reset_lineno): A new function to refactor resetting of the number,
and which also clears line_no_overflow.
* tests/misc/nl.sh: Add a test case.
2020-10-25 Pádraig Brady
maint: add lib/parse-datetime-gen.h to .gitignore
* .gitignore: update to ignore new file
generated by the latest gnulib update.
maint: sync help2man to latest version
* man/help2man: sync to changes from version 1.47.16.
Note this doesn't materially change the generated man pages.
Addresses https://bugs.gnu.org/44105
2020-10-19 Paul Eggert
build: update gnulib submodule to latest
* gl/lib/randperm.c, src/cp-hash.c, src/ls.c, src/sort.c, src/tail.c:
Change all instaces of hash_delete to hash_remove to accommodate
change to Gnulib API.
2020-10-17 Grigorii Sokolik
maint: remove already handled FIXME in tail.c
* src/tail.c: Remove FIXME to follow a file name in a recreated
directory. The comment was added in commit v8.5-191-g61b77891c
while the fix (albeit not using inotify) was added in
commit v8.27-21-gba5fe2d4b
maint: update docs for build prerequisites
* README-prereq: Explicitly pull tags,
and update the xz git repo url.
2020-09-29 Benno Schulenberg
doc: fix punctuation in stat --help
* src/stat.c (usage): Replace a mistaken semicolon with a colon,
and replace mistaken backticks with single quotes. Also reorder
some words, for clarity.
Fixes https://bugs.gnu.org/43707
2020-08-12 Pádraig Brady
doc: clarify timeout --foreground description
* doc/coreutils.texi (timeout invocation): Avoid any implication
that `timeout --foreground` could be used to retroactively
timeout commands not already invoked by timeout(1).
Fixes bug https://bugs.gnu.org/42831
2020-08-08 Emanuele Giacomelli
csplit: fix regex suppression with specific match count
* src/csplit.c (process_regexp): Process the line suppression
in all invocations so that the last match is suppressed.
Previously with a non infinite match count,
the last regex pattern was not suppressed.
* NEWS: Mention the bug fix.
* tests/misc/csplit-suppress-matched.pl: Add a test case.
Fixes https://bugs.gnu.org/42764
2020-07-31 Bernhard Voelker
tests: skip some parts of 'tests/rmdir/ignore.sh' if run as root
Parts of this test expect that the rmdir syscall returns with EPERM,
but the root user does not see that.
* tests/rmdir/ignore.sh: Add uid_is_privileged_ guards around parts
of the test which expect rmdir() to fail with EPERM.
Reported by Nick Alcock in
https://bugs.gnu.org/42633
2020-07-28 Bernhard Voelker
doc: show version in title of HTML manual
* doc/coreutils.texi (@include version.texi): Move before ...
(@settitle): ... this. Add the version after the package name.
Suggested by Jonny Grant in
https://lists.gnu.org/r/bug-coreutils/2020-07/msg00021.html
2020-07-28 Paul Eggert
build: update gnulib submodule to latest
* src/local.mk (src_expr_LDADD, src_factor_LDADD):
Adjust to Gnulib renaming of LIB_GMP to LIBGMP.
2020-07-27 Pádraig Brady
doc: fix typo in env --split-string documentation
* doc/coreutils.texi: Fix grammar.
2020-07-24 Paul Eggert
date: clarify the Epoch
* src/date.c (usage): Mention the Epoch under %s for clarity,
and capitalize.
doc: modernize date examples
* doc/coreutils.texi: Use more-modern date examples.
Capitalize “Epoch” to be consistent with POSIX.
build: update gnulib submodule to latest
* bootstrap.conf (gnulib_modules): Add hash-triple.
2020-07-20 Bernhard Voelker
doc: clarify 'timeout -k' behavior
* doc/coreutils.texi (timeout invocation): Document that the the
duration of --kill-after=DURATION begins when sending the initial
signal. Also mention that -k does not have any effect if timeout's
duration is 0.
Suggested by Jonny Grant .
2020-07-19 Paul Eggert
factor: port to --without-libgmp
* src/factor.c (mp_factor_using_division): Use mpz_fdiv_q_2exp
instead of its no-longer-documented mpz_div_2exp alias.
(print_factors): Use mpz_out_str instead of gmp_printf.
2020-07-11 Paul Eggert
build: be less aggressive about -fanalyzer
* configure.ac: Don’t enable -fanalyzer unless configured with the
new --enable-gcc-warnings=expensive option. See thread at:
https://lists.gnu.org/r/coreutils/2020-07/msg00011.html
2020-07-09 Paul Eggert
factor: explain why non-GMP code (Bug#42269)
* doc/coreutils.texi (factor invocation):
* src/factor.c: Explain why the two-word algorithm is useful.
2020-07-08 Paul Eggert
doc: mention expr and factor bignums
* NEWS:
* doc/coreutils.texi (expr invocation, factor invocation):
Mention bignum support on all platforms. Modernize timings.
factor: treat ' +bignum' like non-bignum
* src/factor.c (strto2uintmax): Instead of here ...
(print_factors): ... skip spaces and '+' here, so that
bignums are treated like non-bignums.
* tests/misc/factor.pl (bug-gmp-plus_2_sup_128_plus_1): New test.
tests: simplify since expr now works on bignums
* cfg.mk (sc_prohibit_expr_unsigned): Remove.
* tests/dd/skip-seek-past-dev.sh (DEV_OFLOW):
* tests/id/setgid.sh (gp1):
* tests/misc/cut-huge-range.sh (CUT_MAX):
* tests/misc/expr.pl:
* tests/misc/sort-discrim.sh:
Assume expr works on bignums.
* tests/misc/cut-huge-range.sh (subtract_one):
Remove; no longer needed.
factor: simplify tests by assuming libgmp
* tests/misc/factor.pl: Test bignums even if !HAVE_GMP.
2020-07-07 Paul Eggert
maint: use Gnulib libgmp module
This lets use assume multiple-precision arithmetic on all
platforms, simplifying the code.
* bootstrap.conf (gnulib_modules): Add libgmp.
* configure.ac: Don’t call cu_GMP, as this is now done by Gnulib.
* m4/gmp.m4: Remove.
* src/expr.c, src/factor.c: Use gmp.h unconditionally.
* src/factor.c: Use the simpler ‘#ifndef mpz_inits’ to
determine whether there is an mpz_inits macro.
build: update gnulib submodule to latest
2020-07-03 Bernhard Voelker
doc: add timeout examples
* doc/coreutils.texi (timeout invocation): Add examples.
Suggested by Jonny Grant in
https://lists.gnu.org/r/bug-coreutils/2020-06/msg00018.html
2020-06-30 Andreas Schwab
tests: avoid spurious testsuite failure
* tests/dd/stats.sh: Increase timeout.
Fixes https://bugs.gnu.org/42135
2020-06-26 Pádraig Brady
tests: fix false failure with valgrind and reflink
* tests/cp/fiemap-FMR.sh: Avoid FICLONE ioctl,
which would avoid the point of the test (fiemap testing).
Also it avoids a valgrind bug with this ioctl:
https://bugs.kde.org/show_bug.cgi?id=397605
2020-06-26 Paul Eggert
cp: use copy_file_range if available
* NEWS: Mention this.
* bootstrap.conf (gnulib_modules): Add copy-file-range.
* src/copy.c (sparse_copy): Try copy_file_range if not
looking for holes.
cp: use SEEK_DATA/SEEK_HOLE if available
If it works, prefer lseek with SEEK_DATA and SEEK_HOLE to FIEMAP,
as lseek is simpler and more portable (will be in next POSIX).
Problem reported in 2011 by Jeff Liu (Bug#8061).
* NEWS: Mention this.
* src/copy.c (lseek_copy) [SEEK_HOLE]: New function.
(enum scantype): New constants ERROR_SCANTYPE, LSEEK_SCANTYPE.
(union scan_inference): New type.
(infer_scantype): Last arg is now union scan_inference *,
not struct extent_scan *. All callers changed.
Prefer SEEK_HOLE to FIEMAP if both work, since
SEEK_HOLE is simpler and more portable.
(copy_reg): Do the fdadvise after initial scan, in case the scan
fails. Report an error if the initial scan fails.
(copy_reg) [SEEK_HOLE]: Use lseek_copy if scantype says so.
cp: avoid copy_reg goto
* src/copy.c (copy_reg): Redo to avoid label and goto.
cp: refactor extent_copy
* src/copy.c (extent_copy): New arg SCAN, replacing
REQUIRE_NORMAL_COPY. All callers changed.
(enum scantype): New type.
(infer_scantype): Rename from is_probably_sparse and return
the new type. Add args FD and SCAN. All callers changed.
maint: typo fix
* NEWS: Fix typo.
2020-06-23 Paul Eggert
chmod: man page fixes
* man/chmod.x: Mention -6000 too. Use .BR to fix trailing period.
2020-06-21 Pádraig Brady
doc: fix punctuation in man pages
* man/chmod.x: Add missing punctuation.
* src/expand-common.c: Likewise.
* src/numfmt.c: Likewise.
* src/rm.c: Likewise.
Fixes https://bugs.gnu.org/41962
2020-06-20 Bernhard Voelker
stat,tail: add support for the VBOXSF file system
* src/stat.c (human_fstype): Add case for the 'vboxsf' file system type
which is used for VirtualBox Shared Folders mounted in VirtualBox guest
VMs.
* NEWS: Mention the Improvement.
Fixes https://bugs.gnu.org/41935
2020-06-19 Paul Eggert
cp: default to COW
Likewise for ‘install’. Proposed in Bug#24400, and long past due.
* NEWS:
* doc/coreutils.texi (cp invocation):
* src/copy.h (enum Reflink_type): Document this.
* src/cp.c (cp_option_init):
* src/install.c (cp_option_init): Implement this.
2020-06-15 Tobias Stoeckmann
maint: avoid signed integer overflows
Since -LONG_MIN results in LONG_MIN again, the operation itself is
a signed integer overflow.
This can be observed with the following calls (best if compiled
with -ftrapv or -fsanitize=undefined):
$ numfmt --padding=-9223372036854775808
$ seq 1e-9223372036854775808
Technically, the change in seq "reduces" the precision, but a double
or long double that small would be represented as 0 anyway.
* src/numfmt.c: Explicitly disallow --padding=LONG_MIN.
* src/seq.c: Treat 1e$LONG_MIN as 1e-$LONG_MAX.
* tests/misc/numfmt.pl: Add a test case.
* tests/misc/seq-precision.sh: Likewise.
Fixes https://bugs.gnu.org/41850
2020-06-07 Bernhard Voelker
doc: timeout: improve documentation of the exit status
* doc/coreutils.texi (timeout invocation): Document that the exit
status is 137 when the KILL signal is used, regardless of whether that
signal is sent to COMMAND or timeout.
* src/timeout.c (usage): Likewise. Also split out and expand
on the possible exit status values to a separate table.
Discussed at https://bugs.gnu.org/41634
2020-06-01 Paul Eggert
maint: use getrandom, not getentropy
This makes for one Gnulib module less, and at runtime there’s
typically just one getrandom syscall instead of several for large
nonces.
* gl/lib/randread.c: Include sys/random.h instead of sys/time.h
and unistd.h.
(get_nonce): Use getrandom, not getentropy.
* gl/modules/randread (Depends-on):
Depend on getrandom, not getentropy.
* src/shred.c (main):
* src/shuf.c (main):
* src/sort.c (random_md5_state_init):
Say "getrandom" rather than "getentropy" in (unlikely) diagnostic.
maint: use getentropy and new tempname modules
Update gnulib submodule to latest and use its new features.
Gnulib’s new getentropy module means coreutils can now assume
getentropy instead of approximating it, badly in some cases.
Gnulib’s improvements to the tempname module mean coreutils no
longer needs to maintain private patches.
* bootstrap.conf (gnulib_modules): Remove gettimeofday.
* gl/lib/randread.c (NAME_OF_NONCE_DEVICE): Remove.
(get_nonce): Return success indicator. Remove bytes_bound arg.
All callers changed. Rewrite by using getentropy instead of
reading the nonce device and falling back on gettimeofday.
Fail if getentropy fails.
(randread_new): Return NULL (setting errno) if get_nonce fails.
All callers changed.
* gl/lib/tempname.c.diff, gl/lib/tempname.h.diff:
* gl/modules/tempname.diff: Remove.
* gl/modules/randread (Depends-on):
Depend on getentropy, not gettimeofday.
* src/ptx.c (swallow_file_in_memory):
* src/shuf.c (read_input):
Adjust to read_file changes in Gnulib.
* src/shred.c (main):
* src/shuf.c (main):
* src/sort.c (random_md5_state_init):
Diagnose the new form of randread_new failures: randread_new can
fail now when !random_source, meaning getentropy failed.
echo: pacify Oracle Studio 12.6
* src/echo.c (main): Don’t assign pointer to bool.
This is well-defined in C99, but is arguably bad style
and Oracle Studio 12.6 complains.
2020-05-25 Bernhard Voelker
maint: copy FDL from gnulib instead of using it as module
Since the previous gnulib update, bootstrap outputs this warning:
Notice from module fdl:
Don't use this module! Instead, copy the referenced license file \
into your version control repository.
See gnulib commit:
https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=88fc5afbccc9
* bootstrap.conf (gnulib_modules): Remove 'fdl'.
* doc/fdl.texi: Add file as a copy of 'gnulib/doc/fdl.texi'.
* doc/.gitignore (/fdl.texi): Remove entry.
* cfg.mk (FILTER_LONG_LINES): Add pattern for the 'fdl.texi' file.
2020-05-23 Bernhard Voelker
maint: fix syntax-check failure from recent adjustment
* cfg.mk (old_NEWS_hash): Regenerate after commit v8.32-15-g6d0107a37
2020-05-23 Bernhard Voelker
tests: fix removed-directory test
The previous attempt to skip that test on NFS (commit 4181fc518362)
made the test fail; it introduced two problems:
a) In the good case, i.e., when the subshell returns with exit status 0,
the test ran into framework_failure_.
b) As the subshell also runs with 'set -x', the later comparison of
/dev/null with 'err' would fail.
* tests/ls/removed-directory.sh: Revert to the style without subshell,
and add 'test -d .' to verify that 'ls' can read the removed dir.
2020-05-21 Paul Eggert
date: document +%-N change
Suggested by Kamil Dudka in:
https://lists.gnu.org/r/bug-gnulib/2020-05/msg00205.html
* NEWS: Mention the change for coreutils 8.23.
* doc/coreutils.texi (Padding and other flags):
Document it.
ls: port removed-directory test to NFS
* tests/ls/removed-directory.sh:
Port test to NFS, where one gets a stale file handle
when looking at a removed directory.
dd: omit unnecessary vars when !lint
* src/dd.c (real_ibuf, real_obuf) [!lint]:
Remove, as they're needed only when lint checking.
All uses removed when 'lint' is not defined.
maint: omit unnecessary pragmas and fix tsort.c
* src/chown-core.c, src/comm.c:
* src/tsort.c (record_relation):
Remove GCC 10 pragmas that are not needed in GCC 10.1.0 (the first
public GCC 10 release) and that in some cases cause diagnostics
with GCC 10.1.0. The tsort.c change fixes a bug that was
inadvertantly introduced when these pragmas were added.
build: update gnulib submodule to latest
2020-05-11 Pádraig Brady
maint: avoid warnings from GCC's -fanalyzer
* src/env.c (build_argv): Add an assert() to avoid:
warning: use of NULL 'n' where non-null expected
[CWE-690] [-Wanalyzer-null-argument]
note: argument 1 of 'getenv' must be non-null
* src/dd.c (alloc_ibuf): Don't discard the allocated pointer, to avoid:
[CWE-401] [-Wanalyzer-malloc-leak]
(alloc_obuf): Likewise.
(cleanup): Deallocate the now tracked buffers which
also avoids "possibly lost" warnings from valgrind.
* src/tsort.c (search_item): Add asserts to avoid:
[CWE-690] [-Wanalyzer-null-dereference]
(record_relation): An assert doesn't suffice here,
so disable the warning for this function.
* src/comm.c: Suppress the following false positive for the whole file:
[CWE-457] [-Wanalyzer-use-of-uninitialized-value]
* src/chown-core.c: Suppress the following false positive for the file:
[CWE-415] [-Wanalyzer-double-free]
2020-04-27 Jason Kim
ls: allow --classify to be ignored for non tty output
Have the `ls` `--classify` option take an optional argument for when to
classify ("always", "auto", "never"), just like the optional argument
for `--color`. When the optional argument is not specified, default to
"always" for backwards compatibility.
* src/ls.c (usage): Update help text.
(decode_switches): Support an optional argument for --classify.
* tests/ls/classify.sh: Add a new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the new feature.
2020-04-22 Bernhard Voelker
build: update gnulib to latest - to avoid du(1) crash on XFS
Pull in a fix for FTS to avoid a crash when traversing a heavily
changed XFS file system:
> fts: remove NOSTAT_LEAF_OPTIMIZATION
* NEWS (Bug fixes): Mention the fix.
* gnulib: Update to latest.
* bootstrap: Sync from gnulib/build-aux/bootstrap.
Discussed at:
2020-04-02 Pádraig Brady
maint: clean up recently added test
* tests/misc/uniq-collate.sh: Remove logic that
was already refactored into gen_input().
cp: ensure --attributes-only doesn't remove files
* src/copy.c (copy_internal): Ensure we don't unlink the destination
unless explicitly requested.
* tests/cp/attr-existing.sh: Add test cases.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/40352
2020-03-28 Paul Eggert
build: update gnulib submodule to latest
* src/selinux.c: Do not include dosname.h; not needed, since
system.h does that for us via dirname.h.
2020-03-15 Bernhard Voelker
maint: add texi2dvi build directory to doc/.gitignore
* doc/.gitignore (/coreutils.t2p/): Add entry for the build directory
left behind after 'make pdf'.
While at it, sort the file.
2020-03-07 Paul Eggert
ls: improve removed-directory test
* tests/ls/removed-directory.sh: Remove host_triplet test.
Skip this test if one cannot remove the working directory.
From a suggestion by Bernhard Voelker (Bug#39929).
ls: restore 8.31 behavior on removed directories
* NEWS: Mention this.
* src/ls.c: Do not include
(print_dir): Don't worry about whether the directory is removed.
* tests/ls/removed-directory.sh: Adjust to match new (i.e., old)
behavior.
2020-03-05 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 8.32
* NEWS: Record release date.
2020-03-04 Pádraig Brady
tests: don't rely on system env(1) being present
* tests/misc/env-S.pl: `env -i env` will call the system env
due to the path being cleared, so pass the absolute path
of our env binary under test to avoid that. This was seen
to be an issue on Guix where /usr/bin/env was not available.
basenc: avoid undefined behaviour in z85 processing
* src/basenc.c (z85_decode_ctx_init): Ensure we're working
with unsigned, as otherwise ubsan triggers with:
src/basenc.c:767:18: runtime error: signed integer overflow:
43 * 52200625 cannot be represented in type 'int'
(z85_encode): Likewise to avoid the usban error:
src/basenc.c:630:26: runtime error:
left shift of 134 by 24 places cannot be represented in type 'int'
2020-03-01 Pádraig Brady
tests: avoid a false failure on OpenIndiana 11
* tests/misc/timeout-parameters.sh: Split the large timeout
handling to ...
* tests/misc/timeout-large-parameters.sh: ... here, so that
the 3 second delay is contained in its own test, and if
the test is skipped due invalid handling within timeout(1),
it will be more apparent.
Also adjust the check so we skip whenever the kernel timer
fires immediately, to handle the buggy OpenIndiana 11 kernel also.
Reported by Bruno Haible.
tests: avoid a hang on GNU/Hurd from 2019
* tests/du/8gb.sh: Add a timeout around:
`dd bs=1 seek=8G of=big < /dev/null`
tests: use bash in some scripts to avoid false failures
* init.cfg (require_bash_as_SHELL_): A new function to replace
SHELL for the current test, with bash if available.
This is useful on OpenIndiana 11 where /bin/sh was seen
to have races in handling of SIGPIPE.
* tests/misc/seq-epipe.sh: Use the new function to enforce bash.
* tests/misc/env-signal-handler.sh: Likewise.
Reported by Bruno Haible
tests: improve test coverage for ls stat checks
* tests/ls/stat-free-color.sh: Check for the availability
of various stat calls individually, and add statx() and fstatat64()
to the list to check. Fix the stat counting logic to
ignore lines like "+++ exited with 0 +++".
* tests/ls/stat-free-symlinks.sh: Check syscalls other than stat().
2020-03-01 Bruno Haible
tests: enable 4 more tests to be executed on FreeBSD
* init.cfg (gcc_shared_libs_): New variable.
(gcc_shared_): Use it, instead of hardcoding -ldl.
(require_gcc_shared_): Determine the suitable value
for gcc_shared_libs_.
2020-02-29 Pádraig Brady
tests: fix incorrect `|| fail` pattern in tests
* tests/ls/stat-free-symlinks.sh: s/|| fail/|| fail=1/.
* tests/misc/tee.sh: Likewise.
* tests/touch/relative.sh: Likewise.
* cfg.mk (sc_prohibit_or_fail): A new syntax-check to avoid this.
2020-02-29 Pádraig Brady
tests: avoid false failures on darwin 19.2.0
With these adjustments, all tests pass on macOS Catalina.
* tests/dd/sparse.sh: Adjust so that systems like apfs that
don't create holes < 16 MiB do not fail erroneously.
* tests/touch/trailing-slash.sh: Darwin was seen to dereference
symlinks to files when given a trailing slash, so avoid
that particular case.
2020-02-29 Bruno Haible
tests: fix test failure on FreeBSD 12
* tests/misc/csplit-io-err.sh: Limit the effect of the fwrite
override to streams != stderr, as fwrite is in the error() path there.
2020-02-27 Jan Nieuwenhuizen
build: once again distribute .tar.gz files
* configure.ac: Reenable distribution of gzip-compressed
tarballs, for Guix bootstrapping reasons as discussed at:
https://lists.gnu.org/r/coreutils/2020-02/msg00042.html
* THANKS.in: Remove me, as now a committer.
* NEWS (Build-related): Mention this.
2020-02-27 Pádraig Brady
maint: ensure .deps/ in the project root is ignored by git
* .gitignore: s|*/.deps/|.deps|
doc: remove older ChangeLog items
* Makefile.am: Update the oldest documented version
to 8.23 which is now about 5 years old.
2020-02-27 Colin Watson
ls: issue error message on removed directory
If the current directory has been removed, then "ls" confusingly
produced no output and no error message, indistinguishable from
running on an empty directory.
* src/ls.c (print_dir): Report ENOENT on GNU/Linux if readdir
finds no directory entries at all, not even "." or "..",
and a recheck with the getdents syscall returns ENOENT.
We recheck with getdents() as POSIX states that
"The directory entries for dot and dot-dot are optional".
* tests/ls/removed-directory.sh: New file.
* tests/local.mk (all_tests): Add new test.
* NEWS: Mention the change in behavior.
Reported by Owen Thomas.
2020-02-25 Pádraig Brady
build: update to latest gnulib
* bootstrap.conf: Adjust for changes to fchmodat and fchownat,
which are now separated from chmodat and chownat respectively.
b2sum: sync better with upstream
* src/blake2/blake2-impl.h: Sync load16() implementation,
which doesn't change code generation.
Also leverage (builtin) memcpy to more efficiently
move data on little endian systems,
giving a 2% win with GCC 9.2.1 on an i3-2310M.
factor: sync longlong.h adjustments from upstream
* src/longlong.h: Sync changes from:
https://gmplib.org/repo/gmp/log/tip/longlong.h
mips64: Provide r6 asm code as default expression yields.
arm32: Define sub_ddmmss separately for non-thumb (no rsc instruction).
powerpc: Add "CLOBBER" descriptions for some registers.
x86: Fix criterion for when to use mulx in umul_ppmm.
stat,tail: sync file system constants from the linux kernel
* src/stat.c: Add magic constants for "binderfs", "dma-buf-fs",
"erofs", "ppc-cmm-fs", and "z3fold".
* NEWS: Mention the improvement.
2020-02-24 Pádraig Brady
uniq: avoid strcoll() to improve performance and consistency
strcoll() is only significant to uniq(1) if it returns 0,
and it generally only does so with buggy locales or mismatched
locales and data. Some systems may have strcoll()
return 0 for equivalent normalized unicode forms,
but for consistency across platforms strcoll() is avoided.
The various cases are defined in the new test.
This is consistent with newer POSIX standards as discussed at:
https://www.austingroupbugs.net/view.php?id=963
* src/uniq.c: s/xstrcoll/memcmp/.
* tests/local.mk: Reference the new test.
* tests/misc/uniq-collate.sh: Add a new test.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/38627
2020-02-15 Pádraig Brady
doc: clarify that '%a' stat format outputs mode bits
* src/stat.c (usage): Mention permission bits rather than
"access" so there is no confusion with ACLs etc.
Also indicate we output the file type with '%A'.
* doc/coreutils.texi (stat invocation): Likewise.
Also indicate '%A' is similar to `ls -ld` output.
Addresses https://bugs.gnu.org/39613
2020-02-10 Pádraig Brady
tests: fix test for symlink
* tests/cp/preserve-gid.sh: s/-l/-L/.
Reported by Kamil Dudka
2020-02-09 Kamil Dudka
tests: ensure tests/cp/preserve-gid.sh works with single binary
* tests/cp/preserve-gid.sh: If configured with --enable-single-binary
copy the coreutils single binary, instead of the cp one-line launcher.
Discussed at https://bugzilla.redhat.com/1800597
Fixes https://bugs.gnu.org/39485
2020-02-09 Pádraig Brady
maint: avoid syntax-check failure in previous commit
* configure.ac: Restrict lines to 80 chars.
2020-02-09 Jim Meyering
build: suppress new FP warning from gcc-10.0.1
* configure.ac (GNULIB_WARN_CFLAGS): Add -Wno-return-local-addr
to avoid FP warning about careadlinkat.c. Discussed starting in
https://lists.gnu.org/r/coreutils/2020-02/msg00006.html
2020-02-04 Pádraig Brady
build: update to latest gnulib
Pick up recent build fixes to avoid sysctl.h inclusion on glibc systems,
restrict the max file size supported by read-file to PTRDIFF_MAX,
and to avoid a -Werror=unused failure in test-canonicalize.
tests: avoid false failure due to varying /proc/kallsyms
* tests/cp/proc-short-read.sh: Switch to using /proc/cpuinfo,
rather than /proc/kallsyms which was seen to vary in some cases.
Fixes https://bugs.gnu.org/39357
2020-02-04 Pádraig Brady
rmdir: fix --ignore-fail-on-non-empty with permissions errors
Since v6.10-21-ged5c4e7 `rmdir --ignore-fail-on-non-empty`
had reversed the failure status for directories that failed
to be removed for permissions reasons. I.E. it would have
returned a failure status for such non empty dirs, and vice versa.
* src/rmdir.c (errno_may_be_non_empty): Rename from the
more confusing errno_may_be_empty(), and remove the EEXIST
case (specific to Solaris), which is moot here since
handled in errno_rmdir_non_empty().
(ignorable_failure): Fix the logic error so that
_non_ empty dirs are deemed to have ignorable failures.
(main): Fix clobbering of errno by is_empty_dir().
(remove_parents): Likewise.
* tests/rmdir/ignore.sh: Add a test case.
* THANKS.in: Add reporter who fixed the errno handling.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/39364
2020-02-03 Pádraig Brady
build: avoid vector performance warnings in randperm
* configure.ac: Add -Wno-vector-operation-performance to suppress the
following gcc-9.2 error in gl/lib/randperm.c:
error: vector operation will be expanded piecewise
build: avoid including sysctl.h on glibc
* src/uname.c: Avoid unneeded header with GLIBC,
which has been deprecated since glibc-2.30.
* src/uptime.c: Likewise.
ls: support --time=creation to show/sort birth time
* src/ls.c (usage): Reorganize help for --time,
and add description for --time=birth.
(do_statx): Store btime in mtime if available.
(get_stat_btime): A new function to read the creation time
from the appropriate stat structure member.
(cmp_btime): A new function to compare birth time.
(print_long_format): Output '?' when birth time unavailable.
* doc/coreutils.texi: Document --time={birth,creation}.
* tests/local.mk: Reference the new test.
* tests/ls/birthtime.sh: Add a new test.
* NEWS: Mention the new feature.
2020-01-30 Chris Meyering
build: rearrange yes(1) code to prevent GCC 10 warning
* src/yes.c (main): Convert for loop to do-while in order to indicate
that the loop will be run at least once.
This avoids the following warning after the second loop:
src/yes.c:110:20: error: writing 1 byte into a region of size 0
2020-01-01 Emil Engler
maint: add lib/iconv_open-zos.h to .gitignore
* .gitignore: Add file newly generated by gnulib commit 49e78fc
2020-01-01 Pádraig Brady
build: auto enable use of openssl with >= version 3
* configure.ac: Set --with-openssl=auto-gpl-compat as the default,
so that openssl is used for md5sum etc., with openssl >= 3,
which is newly licensed under ASL v2.
* gnulib: Update to include "auto-gpl-compat" support.
maint: adjust to split out xstrtol-error gnulib module
* bootstrap.conf: Depend on the new module split from xstrtol.
* src/df.c: Include "xstrtol-error.h" for xstrtol_fatal.
* src/du.c: Likewise.
* src/ls.c: Likewise.
* src/od.c: Likewise.
* src/pr.c: Likewise.
* src/sort.c: Likewise.
2020-01-01 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.
2019-12-08 Bernhard Voelker
doc: add example to demonstrate sub-second sleep times
* doc/coreutils.texi (sleep invocation): Add an example to demonstrate
how to use the floating-point and the scientific notation to sleep
for sub-second times, e.g. milli-, micro- and nanoseconds.
Inspired by Stephane Chazelas in:
https://lists.gnu.org/r/coreutils/2019-12/msg00005.html
2019-12-02 Pádraig Brady
maint: fix syntax-check failure from recent adjustment
* cfg.mk (old_NEWS_hash): Regenerate after commit v8.31-56-gc1e1965.
2019-12-02 Kamil Dudka
chcon: do not validate security context if SELinux is disabled
* src/chcon.c (main): Skip call of security_check_context()
in case SELinux is disabled to avoid unnecessary failure.
Bug: https://bugzilla.redhat.com/1777831
2019-11-12 Paul Eggert
doc: remove colon from node name
* doc/sort-version.texi (Minus/Hyphen and Colon characters):
Rename from “Minus/Hyphen @samp{-} and Colon @samp{:} characters”,
as texi2any 6.6 complains about colons in node names.
shred: modernize documentation
* doc/coreutils.texi (shred invocation):
Modernize discussion to today’s technology (Bug#38168).
* src/shred.c (usage): Omit lengthy duplication of the manual’s
discussion of file systems and storage devices, as that became out
of sync with the manual. Instead, just cite the manual.
2019-10-22 Paul Eggert
all: improve parsing of numeric arguments
This addresses a longstanding "update all callers" FIXME in
lib/xstrtol.c, by having programs check that numbers do not
have unknown suffixes. The problem was also reported for
'shuf' by my student Maggie Huang while reimplementing a shuf
subset in Python as an exercise in UCLA Computer Science 35L:
https://web.cs.ucla.edu/classes/fall19/cs35L/assign/assign3.html
This patch also improves the portability of the code to unusual
platforms where ULONG_MAX < SIZE_MAX.
* NEWS: Mention user-visible changes.
* src/chgrp.c (parse_group):
* src/chroot.c (parse_additional_groups):
* src/du.c (main):
* src/install.c (get_ids):
* src/join.c (string_to_join_field):
* src/ls.c (decode_switches):
* src/md5sum.c (split_3):
* src/shuf.c (main):
* src/sort.c (specify_nthreads):
* src/uniq.c (size_opt, main):
Use uintmax_t instead of unsigned long, for portability
to oddball platforms where unsigned long is not wide enough.
* src/du.c (main):
* src/expr.c (mpz_init_set_str) [!HAVE_GMP]:
* src/install.c (get_ids):
* src/ls.c (decode_switches):
* src/mknod.c (main):
* src/ptx.c (main):
* src/shuf.c (main):
* src/sort.c (specify_nmerge, specify_nthreads):
Reject numbers with suffixes.
* src/md5sum.c (split_3): Simplify.
stdbuf: improve size checking
* bootstrap.conf (gnulib_modules): Add minmax.
* src/libstdbuf.c: Include stdint.h, minmax.h.
(apply_mode): Don’t assume SIZE_MAX <= ULONG_MAX.
Improve checking for invalid sizes.
shuf: improve randperm overflow checking
* gl/lib/randperm.c: Include randperm.h first, since it’s the API.
Include stdint.h, count-leading-zeros.h, verify.h.
(floor_lg): Rename from ceil_log (which was not actually
implementing the ceiling!) and implement the floor using
count_leading_zeros.
(randperm_bound): Use floor_lg, not ceil_log. Use uintmax_t
instead of size_t in case the size gets large on a 32-bit host.
* gl/modules/randperm (Depends-on): Add count-leading-zeros, stdint.
build: don’t worry about logical-op checking
* configure.ac: Remove code tailoring --enable-gcc-warnings
to GCC 4.7 and earlier, as developers no longer need to worry
about GCCs that old.
build: re-enable type-limits checking
* configure.ac: When --enable-gcc-warnings is used, omit
-Wno-type-limits. The need for -Wno-type-limits has passed, now
that intprops.h uses builtin primitives for GCC 5 and later, given
that recent GCCs issue type-limits warnings only for non-constant
expressions. --enable-gcc-warnings is not intended for use with
old compilers, so we can drop -Wno-type-limits now.
2019-10-21 Paul Eggert
shuf: fix bug with ‘-r -n 0’
‘shuf -r -n 0 file’ would mistakenly read from standard input.
Problem reported by my student Jingnong Qu while reimplementing a
shuf subset in Python as an exercise in UCLA Computer Science 35L:
https://web.cs.ucla.edu/classes/fall19/cs35L/assign/assign3.html
* NEWS: Mention the fix. Also, ASCIIfy a previous item.
* src/shuf.c (main): Fix bug.
* tests/misc/shuf.sh: Add a test case for the bug.
2019-10-09 Jeff Layton
ls: use statx instead of stat when available
statx allows ls to indicate interest in only certain inode metadata.
This is potentially a win on networked/clustered/distributed
file systems. In cases where we'd have to do a full, heavyweight stat()
call we can now do a much lighter statx() call.
As a real-world example, consider a file system like CephFS where one
client is actively writing to a file and another client does an
ls --color in the same directory. --color means that we need to fetch
the mode of the file.
Doing that with a stat() call means that we have to fetch the size and
mtime in addition to the mode. The MDS in that situation will have to
revoke caps in order to ensure that it has up-to-date values to report,
which disrupts the writer.
This has a measurable affect on performance. I ran a fio sequential
write test on one cephfs client and had a second client do "ls --color"
in a tight loop on the directory that held the file:
Baseline -- no activity on the second client:
WRITE: bw=76.7MiB/s (80.4MB/s), 76.7MiB/s-76.7MiB/s (80.4MB/s-80.4MB/s),
io=4600MiB (4824MB), run=60016-60016msec
Without this patch series, we see a noticable performance hit:
WRITE: bw=70.4MiB/s (73.9MB/s), 70.4MiB/s-70.4MiB/s (73.9MB/s-73.9MB/s),
io=4228MiB (4433MB), run=60012-60012msec
With this patch series, we gain most of that ground back:
WRITE: bw=75.9MiB/s (79.6MB/s), 75.9MiB/s-75.9MiB/s (79.6MB/s-79.6MB/s),
io=4555MiB (4776MB), run=60019-60019msec
* src/stat.c: move statx to stat struct conversion to new header...
* src/statx.h: ...here.
* src/ls.c: Add wrapper functions for stat/lstat/fstat calls,
and add variants for when we are only interested in specific info.
Add statx-enabled functions and set the request mask based on the
output format and what values are needed.
* NEWS: Mention the Improvement.
2019-10-03 Paul Eggert
truncate: avoid integer-overflow assumptions
* src/truncate.c (do_ftruncate): Simplify overflow checking,
and don’t rely on theoretically-nonportable assumptions
like assuming that OFF_MAX < UINTMAX_MAX.
numfmt: avoid unlikely integer overflow
* src/numfmt.c (parse_format_string): Report overflow if
pad < -LONG_MAX, since that can’t be negated.
nl: fix integer-overflow bug
Problem reported by Roland Illig (Bug#37585)
* src/nl.c (print_lineno): Don’t rely on undefined behavior when
checking for integer overflow.
cp: simplify integer overflow checking
* src/copy.c (sparse_copy): Use INT_ADD_WRAPV instead
of doing overflow checking by hand.
2019-09-08 Pádraig Brady
seq: use faster processing for integer steps from 2 to 200
* src/seq.c: (seq_fast): Accept STEP as a parameter and use that
to skip the output of generated numbers.
(main): Relax to using seq_fast for integer steps between 1 and 200.
For larger steps the throughput was faster using the standard
incrementing procedure.
(cmp): Use the equivalent but faster memcmp for equal len strings.
* tests/misc/seq.pl: Update fast path cases.
Addresses https://bugs.gnu.org/37241
2019-09-08 Pádraig Brady
maint: use consistent header ordering and spacing in NEWS
* NEWS: Move "Changes in behavior" before "New features",
and ensure there is only a single blank line between sections.
2019-08-15 Paul Eggert
build: update gnulib submodule to latest
2019-08-15 Assaf Gordon
scripts: document how to build older versions on newer systems
Based on https://lists.gnu.org/r/coreutils/2019-08/msg00011.html .
* scripts/build-older-versions/README.older-versions: Documentation
* scripts/build-older-versions/build-older-versions.sh: Helper script.
* scripts/build-older-versions/.gitignore: Ignore build directory.
* scripts/build-older-versions/coreutils-5.0-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-5.97-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-6.10-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-6.11-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-6.12-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-7.2-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-8.13-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-8.17-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-8.18-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-8.24-on-glibc-2.28.diff,
scripts/build-older-versions/coreutils-8.4-on-glibc-2.28.diff: Patches.
2019-08-12 Bruno Haible
build: adjust for recent gnulib pthread changes
Discussed in https://lists.gnu.org/r/coreutils/2019-08/msg00030.html .
* bootstrap.conf (gnulib_modules): Replace 'pthread' with
pthread-* modules.
* src/sort.c: Remove GNULIB_defined_pthread_functions conditional.
2019-08-11 Assaf Gordon
date: mention military timezone changes from gnulib
Gnulib commits f1f10d47be8762e4ca17c8957a0520b08d28abfb and
0673d8ab42c9bb0cf618a21b537cdd8fb976fb73 negated the meaning of
military timezones parsed in gnu date.
See https://lists.gnu.org/r/bug-gnulib/2019-08/msg00005.html and
https://lists.gnu.org/r/coreutils/2019-08/msg00021.html
* NEWS: Mention this user-visible change.
* tests/misc/date.pl: Add tests for the new behavior.
2019-08-11 Bernhard Voelker
maint: add lib/argmatch.h to po/POTFILES.in
* po/POTFILES.in (lib/argmatch.h): Add to avoid sc_po_check error:
"maint.mk: you have changed the set of files with translatable \
diagnostics;"
2019-08-11 Assaf Gordon