aboutsummaryrefslogtreecommitdiffstats
path: root/gl (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-10-20maint: remove a redundant write after mcel_scan returns an errorCollin Funk1-1/+0
* gl/lib/mbbuf.h (mbbuf_get_char): Don't set G.len to 1, since mcel_err has already done it.
2025-09-30fold: move multi-byte character reading to a moduleCollin Funk4-0/+169
* gl/modules/mbbuf: New file. * gl/lib/mbbuf.c: Likewise. * gl/lib/mbbuf.h: Likewise. * gl/local.mk (EXTRA_DIST): Add the new files. * bootstrap.conf (gnulib_modules): Add mbbuf. * src/fold.c: Include mbbuf.h. (fold_file): Use the mbbuf functions instead of calling fread and handling the input buffer ourselves. * cfg.mk (exclude_file_name_regexp--sc_preprocessor_indentation) (exclude_file_name_regexp--sc_GPL_version): Match gl/lib/mbbuf.c and gl/lib/mbbuf.h.
2025-09-21maint: comment spelling fixesPaul Eggert1-1/+1
2025-09-17maint: prefer memeq to memcmpPaul Eggert2-1/+2
* gl/modules/randread-tests (Depends-on): Add stringeq. * gl/tests/test-rand-isaac.c (main): * src/copy.c (source_is_dst_backup): * src/digest.c (b64_equal): * src/install.c (have_same_content): * src/ls.c (main, parse_ls_color): * src/nl.c (check_section): * src/od.c (write_block): * src/seq.c (seq_fast): * src/stty.c (eq_mode): * src/system.h (is_nul): Prefer memeq to memcmp when either will do.
2025-09-17maint: STREQ → streqPaul Eggert1-1/+1
Use new Gnulib streq function instead of rolling our own macro. * bootstrap.conf (gnulib_modules): Add stringeq. * src/rm.c (main): Don’t assume streq is a macro that expands to (...), as it is now a function. * src/system.h: * tests/df/no-mtab-status.sh, tests/df/skip-duplicates.sh: (STREQ): Remove. All uses replaced by streq.
2025-09-14maint: randperm: remove stale dependencyPádraig Brady1-1/+0
* gl/modules/randperm: Remove assert-h dependency not required since commit v9.5-34-g26ba82015
2025-05-28maint: assume O_DIRECTORYPaul Eggert1-50/+8
Recent changes in Gnulib guarantee O_DIRECTORY != 0. * gl/lib/targetdir.c (target_directory_operand): * src/dd.c (usage): * src/ln.c (main): Simplify now that O_DIRECTORY must be nonzero.
2025-05-09maint: use MAYBE_UNUSED more consistentlyPaul Eggert1-2/+2
* src/basenc.c (no_required_padding): * gl/lib/smack.h (smack_new_label_from_self) (smack_set_label_for_self): * src/cksum.c (output_crc): * src/digest.c (md5_sum_stream, sha1_sum_stream) (sha224_sum_stream, sha256_sum_stream, sha384_sum_stream) (sha512_sum_stream, sm3_sum_stream, output_file): * src/stat.c (print_statfs, print_stat): * src/sum.c (output_bsd, output_sysv): * src/timeout.c (chld): Mark possibly-unused parameters with MAYBE_UNUSED.
2025-04-07maint: avoid syntax-check failures from recent commitPádraig Brady2-11/+14
* gl/lib/dtimespec-bound.h: Indent, Spellcheck. * gl/local.mk: Add new gl files.
2025-04-07timeout: don’t sleep less than requestedPaul Eggert3-0/+103
Also, change sleep and tail to not sleep less than requested. * bootstrap.conf (gnulib_modules): Add dtimespec-bound. * gl/lib/dtimespec-bound.c, gl/lib/dtimespec-bound.h: * gl/modules/dtimespec-bound: New files. * src/sleep.c, src/tail.c, src/timeout.c: Include dtimespec-bound.h. * src/sleep.c, src/tail.c: Don’t include xstrtod.h. * src/sleep.c (apply_suffix, main): * src/tail.c (parse_options): * src/timeout.c (apply_time_suffix): Don’t sleep less than the true number of seconds. * src/timeout.c: Don’t include ctype.h. (is_negative): Remove; no longer needed. (parse_duration): Use a slightly looser bound on the timeout, one that doesn’t need -lm on GNU/Linux. Clear errno before calling cl_strtod.
2025-01-01maint: update all copyright year number rangesPádraig Brady30-30/+30
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2024-12-30maint: adjust to Gnulib module renamingPaul Eggert7-9/+9
* bootstrap.conf, gl/modules/buffer-lcm, gl/modules/randperm: * gl/modules/randread, gl/modules/strnumcmp, gl/modules/targetdir: * gl/modules/xdectoint, gl/modules/xfts: Adjust to recent renaming of Gnulib modules, e.g., stdbool → bool, inttypes → inttypes-h.
2024-12-30maint: ISDIGIT → c_isdigitPaul Eggert2-30/+22
* gl/lib/strnumcmp-in.h (ISDIGIT): * src/system.h (ISDIGIT): Remove. All uses replaced by c_isdigit, with appropriate inclusions of c-ctype.h. This is more regular, and is more portable to existing (but unlikely) platforms where INT_MAX == UINT_MAX.
2024-11-08maint: expand heap a bit less aggressivelyPaul Eggert3-20/+22
* gl/lib/heap.c (struct heap, heap_alloc, heap_insert) (heapify_down, heapify_up): Prefer idx_t to size_t for sizes. (heap_insert): Use xpalloc instead of x2nrealloc. (heapify_down): Return void since no caller cares about value. * gl/modules/heap: Depend on idx.
2024-10-14maint: add syntax-check to ensure all gl/ files are distributedPádraig Brady1-6/+4
* cfg.mk (sc_gldist_missing): Add a new target to ensure we don't forget to distribute any new gl/ files. * gl/local.mk: Remove generation comment since it's now encapsulated in the syntax-check, which outputs a consumable diff to make any future adjustments. Also adjust ordering to that of the C locale used in the syntax check.
2024-10-14build: distribute the gl/ directory in the tarballsBruno Haible1-0/+80
Suggested by Michael Pratt in <https://mail.gnu.org/archive/html/coreutils/2024-10/msg00010.html>. * gl/local.mk: New file, based on gettext/gnulib-local/Makefile.am. * Makefile.am: Include it.
2024-08-28all: fix error checking in gl/lib/xdectoint.cPádraig Brady1-17/+20
This issue was noticed with -flto on GCC 14.2.1 * gl/lib/xdectoint.c (__xnumtoint): Only inspect the returned value if LONGINT_INVALID is not set, as the returned value is uninitialized in that case. Fixes https://bugs.gnu.org/72842
2024-08-11maint: fix syntax-check failurePádraig Brady1-4/+4
* gl/lib/xdectoint.h: Reinstate indentation enforced with cppi. * src/head.c: Remove now redundant inclusion of "quote.h".
2024-08-10maint: distinguish EOVERFLOW vs ERANGE betterPaul Eggert4-41/+63
Also, prepare for allowing some arguments to overflow without that being an error. * gl/lib/xdectoint.c: Do not include stddef.h, since we no longer use ‘unreachable’. (xnumtoimax, xnumtoumax, __xnumtoint): New arg FLAGS. All callers changed. Stop using __xdectoint_signed. All definers removed. * gl/lib/xdectoint.h (XTOINT_MIN_QUIET, XTOINT_MAX_QUIET) (XTOINT_MIN_RANGE, XTOINT_MAX_RANGE): New flag constants. * src/fmt.c (main): * src/fold.c (main): * src/nl.c (main): * src/pr.c (getoptnum): * src/split.c (main): Use XTOINT_MIN_RANGE and XTOINT_MAX_RANGE if appropriate. * src/pr.c (getoptnum): Return int rather than returning void and storing through int *. * src/stty.c (apply_settings): Use ckd_add to check for overflow instead of doing it by hand. (integer_arg): Accept and return uintmax_t, not unsigned long.
2024-08-03shuf: avoid integer overflow on huge inputsPaul Eggert1-4/+7
* gl/lib/randperm.c: Include <stdckdint.h>. (randperm_bound): Return SIZE_MAX if the multiplication overflows. Do not overflow when converting bit count to byte count.
2024-08-03shuf: fix randomness bugPaul Eggert1-1/+11
Problem reported by Daniel Carpenter <https://bugs.gnu.org/72445>. * gl/lib/randread.c (randread_new): Fill the ISAAC buffer instead of storing at most BYTES_BOUND bytes into it.
2024-05-16maint: prefer stdbit.h to count-leading-zeros.hPaul Eggert2-17/+3
<stdbit.h> is in C23 and should be more portable in the long run, now that Gnulib supports it. * bootstrap.conf (gnulib_modules): Remove count-leading-zeros. Add stdc_leading_zeros. * gl/lib/randperm.c, src/ioblksize.h: Include stdbit.h instead of count-leading-zeros.h. * gl/lib/randperm.c (floor_lg): Remove; no longer needed. (randperm_bound): Use stdc_bit_width instead of floor_lg; * gl/modules/randperm (Depends-on): Remove count-leading-zeros. Add stdc_bit_width. * src/ioblksize.h (io_blksize): Use stdc_leading_zeros_ull instead of count_leading_zeros_ll.
2024-02-18maint: remove unneeded suggest-attributes pragmasPaul Eggert1-6/+0
* gl/lib/fadvise.c: Remove pragma that works around GCC bug 83559 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83559>. This bug was fixed in GCC 9, and we needn’t worry about --enable-gcc-warnings for compilers that old. * src/test.c: Likewise.
2024-01-01maint: update all copyright year number rangesPádraig Brady29-29/+29
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2023-12-31maint: pacify clang -Winclude-next-absolute-pathPaul Eggert1-3/+3
* gl/lib/xdectoint.c: Use #include <...> instead of #include "...".
2023-12-29sort: fix thousands grouping handling on single byte localesPádraig Brady1-2/+2
* gl/lib/strnumcmp-in.h (numcompare): After commit v9.0-8-g6cafb122f, we need to treat characters as signed to avoid invalid comparisons between negative integers and unsigned characters. * NEWS: Mention the bug fix.
2023-11-11maint: port randread to FreeBSD 14Paul Eggert1-3/+3
* gl/lib/randread.c (POINTER_IS_ALIGNED): Rename from ALIGNED_POINTER to avoid a collision with <machine/param.h> on FreeBSD 14.
2023-10-30join,uniq: support multi-byte separatorsPaul Eggert6-62/+83
* NEWS: Mention this. * bootstrap.conf (gnulib_modules): Remove cu-ctype, as this module is now more trouble than it’s worth. All uses removed. Add skipchars. * gl/lib/cu-ctype.c, gl/lib/cu-ctype.h, gl/modules/cu-ctype: Remove. * gl/lib/skipchars.c, gl/lib/skipchars.h, gl/modules/skipchars: * tests/misc/join-utf8.sh: New files. * src/join.c: Include skipchars.h and mcel.h instead of cu-ctype.h. (tab): Now mcel_t, not int. All uses changed. (output_separator, output_seplen): New static vars. (eq_tab, newline_or_blank, comma_or_blank): New functions. (xfields, prfields, prjoin, add_field_list, main): Support multi-byte characters. * src/numfmt.c: Include ctype.h, skipchars.h. Do not include cu-ctype.h. (newline_or_blank): New function. (next_field): Support multi-byte characters. * src/sort.c: Include ctype.h instead of cu-ctype.h. (inittables): Open-code field_sep since it no longer exists. ‘sort’ is not multi-byte safe yet, but when it is this code will need revamping anyway. * src/uniq.c: Include mcel.h and skipchars.h instead of cu-ctype.h. (newline_or_blank): New function. (find_field): Support multi-byte characters. * tests/local.mk (all_tests): Add tests/misc/join-utf8.sh
2023-10-30maint: move field_sep into separate modulePaul Eggert3-0/+62
This is so that we don’t need to have every source file include ctype.h. * bootstrap.conf (gnulib_modules): Add cu-ctype. * gl/lib/cu-ctype.c, gl/lib/cu-ctype.h, gl/modules/cu-ctype: New files. * src/join.c, src/numfmt.c, src/sort.c, src/uniq.c: Include cu-ctype.h, for field_sep. * src/system.h (field_sep): Remove; now supplied by cu-ctype.
2023-09-13maint: use C99 int size specifiers rather than PRI.MAX definesPádraig Brady1-1/+1
Following on from commit v9.3-128-gf31229ebd replace all uses of the PRI.MAX portability defines with C99 size specifiers %z, %j, and %t.
2023-09-04maint: prefer psame_inode, PSAME_INODE, STP_*Paul Eggert1-1/+1
Prefer psame_inode, PSAME_INODE, STP_NBLOCKS, and STP_BLKSIZE, which take addresses of objects, to their counterparts that take the whole objects. In some cases the whole objects might not be initialized, which would be undefined behavior strictly speaking. * gl/lib/root-dev-ino.h (ROOT_DEV_INO_CHECK): * src/cp-hash.c (src_to_dest_compare): * src/ls.c (dev_ino_compare): * src/pwd.c (robust_getcwd): Prefer PSAME_INODE to SAME_INODE. * src/chown-core.c (restricted_chown): * src/copy.c (copy_reg, same_file_ok, source_is_dst_backup) (copy_internal): * src/ln.c (do_link): * src/pwd.c (logical_getcwd): * src/sort.c (avoid_trashing_input): * src/split.c (create): * src/stat.c (find_bind_mount): Prefer psame_inode to SAME_INODE. * src/copy.c (infer_scantype): * src/du.c (process_file): * src/ls.c (gobble_file, print_long_format) (print_file_name_and_frills, length_of_file_name_and_frills): * src/stat.c (print_stat): Prefer STP_NBLOCKS to ST_NBLOCKS. * src/copy.c (copy_reg): * src/head.c (elide_tail_bytes_file, elide_tail_lines_file): * src/ioblksize.h (io_blksize): * src/od.c (skip): * src/shred.c (do_wipefd): * src/stat.c (print_stat): * src/tail.c (tail_bytes): * src/truncate.c (do_ftruncate): * src/wc.c (wc): Prefer STP_BLKSIZE to ST_BLKSIZE. * src/ioblksize.h (io_blksize): Arg is now struct stat const *, not struct stat. All callers changed.
2023-08-29maint: remove need for mbsalignPaul Eggert5-524/+0
This simplifies memory allocation a bit, and removes an arbitrary limitation from numfmt, which formerly limited cell output to 127 bytes. * bootstrap.conf (gnulib_modules): Remove mbsalign, strncat. Add strnlen (the code already used strnlen directly, and we were saved only because Gnulib used the module indirectly) * gl/lib/mbsalign.c, gl/lib/mbsalign.h, gl/modules/mbsalign: * gl/modules/mbsalign-tests, gl/tests/test-mbsalign.c: Remove. * src/df.c, src/ls.c: Do not include mbsalign.h. (MBSWIDTH_FLAGS): New constant, now used for all mbswidth calls. All callers changed to check for -1 return. * src/df.c (struct field_data_t): ‘width’ is now int not size_t, since mbswidth can’t do widths greater than INT_MAX anyway. Replace ‘align’ with ‘align_right’. All uses changed. (print_table): Redo to avoid the need for ambsalign. (get_header, get_dev): mbswidth returns int, not size_t. * src/ls.c (MAX_MON_WIDTH): Remove; no longer used. (abmon_init): Use strnlen to cheaply discard too-long month names. Align by hand instead of using mbsalign. * src/numfmt.c: Include stdckdint.h, mbswidth.h. Do not include mbsalign.h. (padding_buffer_size): Now idx_t. All uses changed. (padding_width): Now intmax_t, since it’s no longer an object size. Its sign now records alignment. All uses changed. (zero_padding_width): Now int, since it’s given to sprintf. All uses changed. (padding_alignment): Remove; it’s now taken from padding_width’s sign. (double_to_human): Return string length. BUF_SIZE arg is now idx_t. Include suffix in output. All callers changed. Simplify by not calling strncat or stpcpy. Calculate fmt size bound more carefully. (setup_padding_buffer): Remove. All uses removed. (parse_format_string): Use intmax_t, not long, for pad. On overflow, set widths to large values that cause later code to do the right thing, rather than separately checking for overflow here. (prepare_padded_number): Return bool, not int 0/1. New arg PADDING. All uses changed. Do not limit padded output to 127 bytes; instead, use xpalloc to expand the output buffer. (print_padded_number): New arg PADDING. All uses changed. (process_suffixed_number): Simplify. (main): Take extremum if xstrtoimax overflows, as this does the right thing. * tests/misc/numfmt.pl: New test suf-20 to test for truncation bug. Remove tests pad-3.2, fmt-err-7, as they’re no longer invalid but are quite expensive.
2023-08-28tests: avoid test failure on AndroidBruno Haible1-4/+13
* gl/tests/test-mbsalign.c (main): Skip the unibyte truncation test on Android, when the "C" locale in fact is multibyte.
2023-08-23shred: fix operation on Solaris with 64 bit buildsPádraig Brady1-1/+7
* NEWS: Mention the bug fix. * gl/lib/randread.c (get_nonce): Limit getrandom() <= 1024 bytes.
2023-07-01maint: improve static and dynamic checkingPaul Eggert3-9/+9
This modernizes the source code somewhat, to take advantage of advances in GCC over the years, and Gnulib’s ‘assure’ module. Include assure.h in files that now need it. Do not include assert.h directly; it’s no longer needed. * bootstrap.conf (gnulib_modules): Add ‘assure’. * gl/lib/randread.c (randread_error): * src/chmod.c (describe_change): * src/chown-core.c (describe_change): * src/cp.c (decode_preserve_arg): * src/head.c (diagnose_copy_fd_failure): * src/ls.c (parse_ls_color): * src/od.c (decode_one_format): * src/split.c (main): * src/test.c (binary_operator, posixtest): Prefer affirm to abort, since it has better diagnostics in the normal case and better performance with -DNDEBUG. * gl/lib/xdectoint.c, src/die.h: Include stddef.h, for unreachable. * gl/lib/xdectoint.c: Do not include verify.h; no longer needed. * gl/lib/xdectoint.c (__xnumtoint): * src/die.h (die): Prefer C23 unreachable () to assume (false). * gl/lib/xfts.c (xfts_open): * src/basenc.c (base32hex_encode): * src/copy.c (abandon_move, copy_internal, valid_options): * src/cut.c (cut_fields): * src/df.c (alloc_field, decode_output_arg, get_dev): * src/du.c (process_file, main): * src/echo.c (usage): * src/factor.c (udiv_qrnnd, mod2, gcd2_odd, factor_insert_large) (mulredc2, factor_using_pollard_rho, isqrt2, div_smallq) (factor_using_squfof): * src/iopoll.c (iopoll_internal, fwrite_wait): * src/join.c (add_field): * src/ls.c (dev_ino_pop, main, gobble_file, sort_files): * src/mv.c (do_move): * src/od.c (decode_format_string, read_block, dump, main): * src/remove.c (rm): * src/rm.c (main): * src/sort.c (stream_open): * src/split.c (next_file_name, lines_chunk_split): * src/stdbuf.c (main): * src/stty.c (set_speed): * src/tac-pipe.c (line_ptr_decrement, line_ptr_increment): * src/touch.c (touch): * src/tr.c (find_bracketed_repeat, get_next) (validate_case_classes, get_spec_stats, string2_extend, main): * src/tsort.c (search_item, tsort): * src/wc.c (main): Prefer affirm to assert, as it allows for better static checking when compiling with -DNDEBUG. * src/chown-core.c (change_file_owner): * src/df.c (get_field_list): * src/expr.c (printv, null, tostring, toarith, eval2): * src/ls.c (time_type_to_statx, calc_req_mask, get_funky_string) (print_long_format): * src/numfmt.c (simple_strtod_fatal): * src/od.c (decode_one_format): * src/stty.c (mode_type_flag): * src/tail.c (xlseek): * src/tr.c (is_char_class_member, get_next, get_spec_stats) (string2_extend): Prefer unreachable () to abort () or assert (false) when merely pacifying the compiler, e.g., in a switch statement on an enum where all cases are covered. * src/copy.c (valid_options): Now returns void; the bool was useless. Caller no longer needs to assert. * src/csplit.c (find_line): * src/expand-common.c (next_file): * src/shred.c (incname): * src/sort.c (main): * src/tr.c (append_normal_char, append_range, append_char_class) (append_repeated_char, append_equiv_class): * src/tsort.c (search_item): Omit assert, since the hardware will check for us. * src/df.c (header_mode): Now the enum type it should have been. * src/du.c (process_file): * src/ls.c (assert_matching_dev_ino): * src/tail.c (valid_file_spec): * src/tr.c (validate_case_classes): Mark defns with MAYBE_UNUSED if they’re not used when -DNDEBUG. * src/factor.c (prime_p, prime2_p, mp_prime_p): Now ATTRIBUTE_PURE. Prefer affirm to error+abort. No need to translate this diagnostic. * src/fmt.c (get_paragraph): * src/stty.c (display_changed, display_all, sane_mode): * src/who.c (idle_string): Prefer assume to assert, since the goal is merely pacification and assert doesn’t pacify anyway if -DNDEBUG is used. * src/join.c (decode_field_spec): Omit unreachable abort. * src/ls.c (assert_matching_dev_ino, main): * src/tr.c (get_next): Prefer assure to assert, since the check is relatively expensive and won’t help static analysis. * src/ls.c (main): Prefer static_assert to assert of a constant expression. (format_inode): Redo to make it clear that buflen doesn’t matter, and that buf must have a certain number of bytes. All callers changed. This pacifies -Wformat-overflow. * src/od.c (decode_one_format): Omit an assert that tested for obviously undefined behavior, as the compiler could optimize it away anyway. * src/od.c (decode_one_format, decode_format_string): Prefer ATTRIBUTE_NONNULL to runtime checking. * src/stat.c: Do not include <stddef.h> since system.h does that now. * src/sync.c (sync_arg): Prefer unreachable () to assert (true), which was a typo. * src/system.h: Include stddef.h, for unreachable. * src/tail.c (xlseek): Simplify by relying on ‘error’ to exit.
2023-06-29maint: prefer C23-style nullptrPaul Eggert12-35/+35
* bootstrap.conf (gnulib_modules): Add nullptr. In code, prefer nullptr to NULL where either will do.
2023-02-04maint: use alignasof, not stdalignPaul Eggert1-1/+1
* .gitignore: Update accordingly. * bootstrap.conf (gnulib_modules): Replace obsolescent stdalign with alignasof. * gl/modules/randread (Depends-on): Depend on alignasof, not stdalign.
2023-01-01maint: update all copyright year number rangesPádraig Brady31-31/+31
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2022-09-18all: prefer HTTPS to HTTPStefan Kangas2-2/+2
* README-hacking: * README-prereq: * THANKS.in: * doc/sort-version.texi (Other version/natural sort implementations): * gl/lib/rand-isaac.c: * gl/tests/test-rand-isaac.c: * src/operand2sig.c (operand2sig): * src/remove.c (nonexistent_file_errno): * tests/misc/env-signal-handler.sh: * tests/misc/sort-debug-warn.sh (LC_ALL): Prefer HTTPS to HTTP. Addresses https://bugs.gnu.org/56512 Copyright-paperwork-exempt: yes
2022-09-15maint: prefer static_assert to verifyPaul Eggert2-2/+2
* bootstrap.conf: Add assert-h. * gl/lib/randperm.c: Do not include verify.h. * gl/lib/randperm.c, src/basenc.c, src/dd.c, src/digest.c: * src/dircolors.c, src/expr.c, src/factor.c, src/ls.c, src/numfmt.c: * src/od.c, src/seq.c, src/shred.c, src/sort.c, src/stat.c: Prefer C23’s static_assert to nonstandard verify. * gl/modules/randperm (Depends-on): Add assert-h.
2022-09-15maint: assume C23 alignofPaul Eggert1-1/+0
* gl/lib/randread.c, src/stat.c (print_statfs): No need to include stdalign.h, now that alignof is a keyword in C23 and Gnulib arranges for this.
2022-09-15maint: don’t include config.h twicePaul Eggert2-3/+0
* gl/lib/fadvise.h, gl/lib/smack.h, src/blake2/blake2-impl.h: Do not include config.h from a .h file. config.h is supposed to be included once, at the start of compilation and before any other file.
2022-09-12maint: adjust to Gnulib stdbool C23 changePaul Eggert6-6/+0
* gl/lib/mbsalign.c, gl/lib/randread.c, gl/lib/targetdir.h: * gl/lib/xdectoint.c, gl/lib/xfts.c, gl/lib/xfts.h: * src/blake2/b2sum.c, src/copy.h, src/die.h, src/system.h: Don’t include <stdbool.h>, since Gnulib now emulates C23.
2022-04-13maint: syntax-check: fix preprocessor indentationPádraig Brady1-1/+1
* gl/lib/targetdir.h: Keep '#' at start of line.
2022-04-12cp,mv,install: omit an ‘inline’Paul Eggert1-1/+1
* gl/lib/targetdir.c (target_directory_operand): Omit unnecessary ‘inline’.
2022-04-12cp,mv,install: improve EACCES targetdir messagesPaul Eggert1-16/+34
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.
2022-04-12cp,mv,install: avoid excess stat calls on non-GNUPaul Eggert2-7/+9
* 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.
2022-04-12cp,mv,install: modularize targetdirPaul Eggert3-0/+167
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-01-31maint: pacify gcc -flto -Wmaybe-uninitializedPaul Eggert2-0/+5
* gl/lib/xdectoint.c (__xnumtoint): Tell gcc that ‘error’ does not return here. * gl/modules/xdectoint (Depends-on): Add stdbool, verify.
2022-01-27shred: fix declaration typoPaul Eggert1-2/+1
* 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.