aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/git-hooks/commit-msg (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2021-12-20maint: commit-msg: compute UTF-8-aware line-lengthJim Meyering1-3/+6
* 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-19id: improve doc for when USER is omittedPaul Eggert1-1/+1
* src/id.c (usage): “current user” → “current process” (Bug#52656).
2021-12-18maint: use GNU style for spacingPaul Eggert39-96/+96
2021-12-16build: non-recursive Automake in a less hacky wayBruno Haible1-5/+1
* 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-16build: update bootstrap to latestPaul Eggert1-110/+110
2021-12-16build: update gnulib submodule to latestPaul Eggert1-0/+0
2021-12-14maint: factor.c: avoid new GCC 12 warningJim Meyering1-1/+1
* src/factor.c (millerrabin2): Mark as ATTRIBUTE_PURE, per advice from GCC 12.
2021-12-14build: update gnulib submodule to latestPaul Eggert2-0/+4
* NEWS: Mention the bugfix.
2021-12-10mv: Bug#52410 fixPaul Eggert2-0/+9
The recent Gnulib update fixed this bug reported by Vincent Vermilya. * tests/mv/backup-dir.sh: Test for Bug#52410.
2021-12-10build: update gnulib submodule to latestPaul Eggert1-0/+0
2021-12-07uname: port to recent macOSPaul Eggert1-36/+39
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-21cp: clone on macOSPaul Eggert3-0/+20
* configure.ac: Check for fclonefileat. * src/copy.c [HAVE_FCLONEFILEAT && !USE_XATTR]: Include <sys/clonefile.h>. (copy_reg): If possible, use fclonefileat to clone.
2021-11-21cp: streamline cloning by skipping fstatPaul Eggert1-19/+18
* 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-20cp: fix --preserve=ownership permissions bugPaul Eggert3-24/+44
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-18maint: prefer MAYBE_UNUSEDPaul Eggert14-48/+51
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-18cp: fix security context racePaul Eggert2-29/+26
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-16maint: update NEWS for macOS fixPaul Eggert1-0/+4
2021-11-16cp: minor clarity tweakPaul Eggert1-1/+1
* src/copy.c (copy_reg): Use cached data_copy_required.
2021-11-16cp: fix ptrdiff_t/ssize_t theoretical glitchesPaul Eggert1-3/+2
* src/copy.c (sparse_copy): Use system.h’s SSIZE_MAX. Don’t assume SSIZE_MAX <= PTRDIFF_MAX.
2021-11-15build: update gnulib submodule to latestPaul Eggert1-0/+0
2021-11-15maint: fix nonnull declPaul Eggert1-2/+1
* gl/lib/randread.h (randread_new): Do not mark with _GL_ATTRIBUTE_RETURNS_NONNULL, since it can return NULL.
2021-11-15build: update gnulib submodule to latestPaul Eggert1-0/+0
2021-11-13tests: avoid false failure in env-signal-handler.shPádraig Brady1-43/+25
* 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-01maint: fix recent syntax-check failuresPádraig Brady4-4/+2
* 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-10-31maint: use minmax.h instead of rolling our ownPaul Eggert6-17/+6
* 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.
2021-10-31maint: add function attributes to .h filesPaul Eggert25-61/+116
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.
2021-10-31maint: enable -Wsuggest-attribute=formatPaul Eggert3-22/+31
* 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.
2021-10-31maint: modernize attribute usagePaul Eggert4-30/+26
* 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.
2021-10-31maint: remove unused __attribute__ defnPaul Eggert1-6/+0
* gl/lib/randread.c (__attribute__): Remove; no longer used after the recent _Noreturn change.
2021-10-31b2sum: simplify attribute usagePaul Eggert1-11/+5
* src/blake2/blake2.h (BLAKE2_PACKED): Simplify, and port better to older GCC, by using _GL_ATTRIBUTE_PACKED.
2021-10-31maint: prefer attribute.h in .c filesPaul Eggert29-70/+124
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-31sort: --debug: add warnings about sign, radix, and grouping charsPádraig Brady3-25/+159
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-30maint: modernize README-{hacking,prereq}Paul Eggert2-86/+70
2021-10-30cp: revert unnecessary FreeBSD workaroundPaul Eggert1-4/+3
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.
2021-10-29cp: defend better against FreeBSD 9.1 zfs bugPaul Eggert1-9/+6
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-22doc: say that printf(1) is preferred over echo(1)Pádraig Brady3-4/+19
* 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-12doc: timeout --kill-after: clarify disabled timeoutsPádraig Brady1-2/+3
* 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
2021-10-12timeout: ensure --foreground -k exits with status 137Pádraig Brady4-3/+15
* 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-11doc: timeout --foreground: add clarification on exit statusPádraig Brady1-1/+4
* 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-10sort: fix unlikely bug when '\377' < 0Paul Eggert3-13/+18
* 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-02build: update gnulib submodule to latestPaul Eggert1-0/+0
2021-10-02maint: switch to C11-style _NoreturnPaul Eggert10-30/+10
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.
2021-10-02ls: port to OpenBSDPaul Eggert1-2/+2
Problem reported by Brian Callahan (Bug#50972). * src/ls.c (decode_switches): Don’t assume __GNUC_PREREQ.
2021-09-26doc: adjust ls --zero option order in texinfoPádraig Brady1-8/+8
* 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-25tests: cp/sparse-perf: make more robust and add zfs commentsPádraig Brady2-17/+18
* 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-24chmod: fix exit status when ignoring symlinksPádraig Brady4-2/+40
* 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
2021-09-24maint: post-release administriviaPádraig Brady3-2/+5
* NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update.
2021-09-24version 9.0v9.0Pádraig Brady1-1/+1
* NEWS: Record release date.
2021-09-24tests: sparse-perf: avoid false failurePádraig Brady1-1/+10
* 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.
2021-09-24cksum: fix -a crc on 64 bit big endian systemsPádraig Brady1-1/+2
* 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