summaryrefslogtreecommitdiff
path: root/tests/local.mk
Commit message (Collapse)AuthorAgeFilesLines
* tests: ensure all utilities that read input diagnose errorsPádraig Brady2023-04-241-2/+1
| | | | | | | * tests/misc/read-errors.sh: Add a new test. * tests/misc/date-f.sh: Remove unneeded test. * tests/misc/dircolors.sh: Likewise. * tests/local.mk: Reference new test, and dereference removed ones.
* dircolors: diagnose read errorsPádraig Brady2023-03-281-0/+1
| | | | | | | * NEWS: Mention the fix. * src/dircolors.c: Fail upon read error from getline(). * tests/misc/dircolors.sh: Add a new test. * tests/local.mk: Reference the new test.
* tests: add a test case for the previous date fixPádraig Brady2023-03-281-0/+1
| | | | | | * NEWS: Also mention this bug fix. * tests/misc/date-f.sh: Add a new test. * tests/local.mk: Reference the new test.
* maint: pacify ‘make syntax-check’Paul Eggert2023-03-061-1/+1
| | | | | | | | Problem reported by Pádraig Brady (Bug#61386#226). * src/split.c (parse_chunk): Use die instead of error. (main): Quote a string. * tests/local.mk (all_root_tests): Move du/apparent.sh from here ... (all_tests): ... to here.
* du: --apparent counts only symlinks and regularPaul Eggert2023-03-041-0/+1
| | | | | | | | Problem reported by Christoph Anton Mitterer (Bug#61884). * src/du.c (process_file): When counting apparent sizes, count only usable st_size members. * tests/du/apparent.sh: New file. * tests/local.mk (all_root_tests): Add it.
* cp,install,mv: add --debug to explain how a file is copiedPádraig Brady2023-02-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How a file is copied is dependent on the sparseness of the file, what file system it is on, what file system the destination is on, the attributes of the file, and whether they're being copied or not. Also the --reflink and --sparse options directly impact the operation. Given it's hard to reason about the combination of all of the above, the --debug option is useful for users to directly identify if copy offloading, reflinking, or sparse detection are being used. It will also be useful for tests to directly query if these operations are supported. The new output looks as follows: $ src/cp --debug src/cp file.sparse 'src/cp' -> 'file.sparse' copy offload: yes, reflink: unsupported, sparse detection: no $ truncate -s+1M file.sparse $ src/cp --debug file.sparse file.sparse.cp 'file.sparse' -> 'file.sparse.cp' copy offload: yes, reflink: unsupported, sparse detection: SEEK_HOLE $ src/cp --reflink=never --debug file.sparse file.sparse.cp 'file.sparse' -> 'file.sparse.cp' copy offload: avoided, reflink: no, sparse detection: SEEK_HOLE * doc/coreutils.texi (cp invocation): Describe the --debug option. (mv invocation): Likewise. (install invocation): Likewise. * src/copy.h: Add a new DEBUG member to cp_options, to control whether to output debug info or not. * src/copy.c (copy_debug): A new global structure to unconditionally store debug into from the last copy_reg operations. (copy_debug_string, emit_debug): New functions to print debug info. * src/cp.c: if ("--debug") x->debug=true; * src/install.c: Likewise. * src/mv.c: Likewise. * tests/cp/debug.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the new feature.
* cksum: add --raw option to output a binary digestPádraig Brady2023-02-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | --raw output is the most composable format, and also is a robust way to discard the file name without parsing (escaped) output. Examples: $ cksum --raw -a crc "$afile" | basenc --base16 4ACFC4F0 $ cksum --raw -a crc "$afile" | basenc --base2msbf 01001010110011111100010011110000 $ cksum --raw -a sha256 "$bfile" | basenc --base32 AAAAAAAADHLGRHAILLQWLAY6SNH7OY5OI2RKNQLSWPY3MCUM4JXQ==== * doc/coreutils.texi (cksum invocation): Describe the new feature. * src/digest.c (output_file): Inspect the new RAW_DIGEST global, and output the bytes directly if set. * src/cksum.c (output_crc): Likewise. * src/sum.c (output_bsd, output_sysv): Likewise. * tests/misc/cksum-raw.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the new feature.
* cksum: accept new option: --base64 (-b)Jim Meyering2023-01-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/digest.c [HASH_ALGO_CKSUM]: Include "base64.h" [HASH_ALGO_CKSUM] (base64_digest): New global. [HASH_ALGO_CKSUM] (enum BASE64_DIGEST_OPTION): New enum. [HASH_ALGO_CKSUM] (long_options): Add "base64". (valid_digits): Rename from hex_digits, now taking an input length argument. Adjust callers. (bsd_split_3): Rename arg from hex_digits to digest. Add new *d_len parameter for length of extracted digest. Move "i" declaration down to first use. (split_3): Rename arg from hex_digits to digest. Add new *d_len parameter for length of extracted digest. Instead of relying on "known" length of digest to find the following must-be-whitespace byte, search for the first whitespace byte. [HASH_ALGO_CKSUM] (output_file): Handle base64_digest. [HASH_ALGO_CKSUM] (main): Set base64_digest. [HASH_ALGO_CKSUM] (b64_equal): New function. (hex_equal): New function, factored out of digest_check. (digest_check) Factored part into b64_equal and hex_equal. Rename local hex_digest to digest. * tests/misc/cksum-base64.pl: Add tests. * tests/local.mk (all_tests): Add to the list. * cfg.mk (_cksum): Define. (exclude_file_name_regexp--sc_prohibit_test_backticks): Exempt new test. (exclude_file_name_regexp--sc_long_lines): Likewise. * doc/coreutils.texi (cksum invocation): Document it. (md5sum invocation) [--check]: Mention digest encoding auto-detect. * NEWS (New Features): Mention this.
* mv: new option --no-copyPaul Eggert2023-01-271-0/+1
| | | | | | | | | | | Wishlist item from Mike Frysinger (Bug#61050). * src/copy.c (copy_internal): Do not fall back on copying if x->no_copy. * src/copy.h (struct cp_options): New member no_copy. * src/mv.c (NO_COPY_OPTION): New constant. (long_options, usage, main): Support --no-copy. * tests/mv/no-copy.sh: New test. * tests/local.mk (all_tests): Add it.
* maint: update all copyright year number rangesPádraig Brady2023-01-011-1/+1
| | | | | | | | | | 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.
* wc: add --total={auto,never,always,only} optionPádraig Brady2022-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | without this option, control of when the total is output is quite awkward. Consider trying to suppress the total line, which could be achieved with something like: wc-no-total() { wc "$@" /dev/null | head -n-2; } As well as being non obvious, it's also non general. It would give a non failure, but zero count if passed a file on stdin. Also it doesn't work in conjunction with the --files0-from option, which would need to be handled differently with something like: { find files -print0; printf '%s\0' /dev/null; } | wc --files0-from=- | head -n2 Also getting just the total can be awkward as file names are only suppressed when processing stdin, and also a total line is only printed if processing more than one file. For completness this might be achieved currently with: wc-only-total() { wc "$@" | tail -n1 | sed 's/^ *//; s/ [^ 0-9]*$//' } * src/wc.c: Add new --total option. * tests/misc/wc-total.sh: New test suite for the new option. * tests/local.mk: Reference the new test. * doc/coreutils.texi (wc invocation): Document the new option. * THANKS.in: Add suggestor. * NEWS: Mention the new feature.
* runcon: ensure --compute runs the file it inspectsPádraig Brady2022-07-241-0/+1
| | | | | | | | | * src/runcon.c (main): With -c avoid searching the path to ensure the file specified to --compute is executed. * tests/misc/runcon-compute.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix. Reported in https://bugs.debian.org/1013924
* printf: support printing the numeric value of multi-byte charsPádraig Brady2022-03-191-0/+1
| | | | | | | | * 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
* fmt: fix invalid multi-byte splitting on macOSPádraig Brady2022-02-241-1/+2
| | | | | | | | | | | 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
* maint: update all copyright year number rangesPádraig Brady2022-01-021-1/+1
| | | | | | | | | 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.
* chmod: fix exit status when ignoring symlinksPádraig Brady2021-09-241-0/+1
| | | | | | | | | * 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
* cksum: support digest detection for tagged formatPádraig Brady2021-09-151-0/+1
| | | | | | | | | | | | | | | | | | 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.
* digest: add support for sm3Pádraig Brady2021-09-151-0/+1
| | | | | | | | | | | | | | 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 <tianjia.zhang@linux.alibaba.com>
* cksum: add --algorithm option to select digest modePádraig Brady2021-09-151-0/+1
| | | | | | | | | | | | | | | | | | * 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.
* ls: rename --null to --zero (Bug#49716)Paul Eggert2021-07-271-2/+2
| | | | | | | | | | | | | | | | | | * 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: add --null option (Bug#49716)Paul Eggert2021-07-261-0/+1
| | | | | | | | | | | | | | * 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.
* tests: ensure we test SEEK_DATA where usedPádraig Brady2021-05-121-6/+6
| | | | | | | | | | | | | | | | | | | 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.
* ls: add --sort=width option to sort by file name widthCarl Edquist2021-04-111-0/+1
| | | | | | | | | | | | | | | | | | 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.
* rmdir: diagnose non following of symlinks with trailing slashPádraig Brady2021-02-191-0/+1
| | | | | | | | | | | | | | | 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.
* cat: extend --show-ends to show \r\n as ^M$Pádraig Brady2021-02-101-0/+1
| | | | | | | | | | | | | - \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.
* maint: update all copyright year number rangesPádraig Brady2021-01-011-1/+1
| | | | | | | | | 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.
* tests: add a test for cksumPádraig Brady2020-12-281-0/+1
| | | | | * tests/misc/cksum.sh: Test basic operation. * tests/local.mk: Reference the new test.
* rm: do not skip files upon failure to remove an empty dirNishant Nayan2020-11-261-0/+1
| | | | | | | | | | | | | | | | 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
* ls: fix crash printing SELinux context for unstatable filesPádraig Brady2020-11-111-1/+1
| | | | | | | | | | | | | 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.
* ls: allow --classify to be ignored for non tty outputJason Kim2020-04-271-0/+1
| | | | | | | | | | | | | 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.
* tests: avoid a false failure on OpenIndiana 11Pádraig Brady2020-03-011-0/+1
| | | | | | | | | | | | * 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.
* ls: issue error message on removed directoryColin Watson2020-02-271-0/+1
| | | | | | | | | | | | | | | | 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.
* uniq: avoid strcoll() to improve performance and consistencyPádraig Brady2020-02-241-0/+1
| | | | | | | | | | | | | | | | | 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
* ls: support --time=creation to show/sort birth timePádraig Brady2020-02-031-0/+1
| | | | | | | | | | | | | | * 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.
* maint: update all copyright year number rangesPádraig Brady2020-01-011-1/+1
| | | | | | | | | 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.
* seq: fix superfluous output lineAssaf Gordon2019-08-021-0/+1
| | | | | | | | | | | | | | | | | | | | | Under certain circumstances seq prints an extra line when the output format has custom format with characters following the printed numbers: $ seq -f "%g " 1000000 1000000 1e+06 1e+06 This is due to the "print_extra_number" logic using strings to determine whether a 'extra number' is needed, but only one string was trimmed when using a custom printf format. Prompted by https://lists.gnu.org/r/coreutils/2019-08/msg00001.html * NEWS: Mention fix. * src/seq.c (print_numbers): Trim the 'x0_str' string before comparing it to the previous 'x_str' string. * tests/misc/seq-extra-number.sh: Add this scenario. * tests/local.mk (all_tests): Add new test.
* env: new options --{default,ignore,block}-signal[=SIG]Assaf Gordon2019-03-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New options to set signal handlers for the command being executed. --block-signal suggested by Paul Eggert in http://bugs.gnu.org/34488#71 --default-signal is useful to overcome the POSIX limitation that shell must not override inherited signal state, e.g. the second 'trap' here is a no-op: trap '' PIPE && sh -c 'trap - PIPE ; seq inf | head -n1' Instead use: trap '' PIPE && sh -c 'env --default-signal=PIPE seq inf | head -n1' Similarly, the following will prevent CTRL-C from terminating the program: env --ignore-signal=INT seq inf > /dev/null See https://bugs.gnu.org/34488#8 * NEWS: Mention new options. * doc/coreutils.texi (env invocation): Document new options. * man/env.x: Add example of --default-signal=SIG usage. (SEE ALSO): Mention sigprocmask. * src/env.c (signals): New global variable. (longopts): Add new options. (usage): Print new options. (parse_signal_params): Parse comma-separated list of signals, store in signals variable. (reset_signal_handlers): Set each signal to SIG_DFL/SIG_IGN. (parse_block_signal_params): Parse command-line options. (set_signal_proc_mask): Call sigprocmask to block/unblock signals. (main): Process new options. * src/local.mk (src_env_SOURCES): Add operand2sig.c. * tests/misc/env-signal-handler.sh: New test. * tests/local.mk (all_tests): Add new test.
* wc: treat non breaking space as a word separatorPádraig Brady2019-02-251-0/+1
| | | | | | | | | | | | | * src/wc.c (iswnbspace): A new function to match characters in this class. (isnbspace): Likewise for single byte charsets. (main): Initialize posixly_correct from the environment, to allow disabling honoring NBSP in non C locales. (wc): Call is[w]nbspace() along with is[w]space. * bootstrap.conf: Ensure btowc is available. * tests/misc/wc-nbsp.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the change in behavior.
* all: detect --help and --version more consistentlyBernhard Voelker2019-02-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For select programs which accept only --help and --version options (in addition to non-option arguments), process these options before any other options. Before: $ dd bs=1 --help dd: unrecognized option '--help' Try 'dd --help' for more information. $ yes me --help me --help me --help ... After: Any occurrence of '--help' in the arguments (prior to '--') will show the help screen. Discussed in https://bugs.gnu.org/33468 . * NEWS: Mention change. * src/cksum.c, src/dd.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c, src/nohup.c, src/sleep.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c, src/whoami.c, src/yes.c (main): Replace parse_long_options() + getopt_long() calls with parse_gnu_standard_options_only(); Remove <getopt.h> inclusion; Remove empty 'struct long_options' variable; * tests/misc/help-version-getopt.sh: Add test. * tests/local.mk (all_tests): Reference it.
* seq: output decimal points consistently with invalid localesPádraig Brady2019-02-031-0/+1
| | | | | | | | * src/seq.c (print_numbers): Only reset the locale if it was successfully set originally. * tests/misc/seq-locale.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the fix.
* ls: with --group-directories-first, also group symlinked dirsPádraig Brady2019-01-121-0/+1
| | | | | | | | | | | | | | | | * src/ls.c (is_linked_directory): A new function to also consider symlinked directories. (main): Rename check_symlink_color to check_symlink_mode, and enable that with --group-directories-first. (DIRFIRST_CHECK): Adjust to use is_linked_directory, rather than just is_directory. (gobble_file): Simplify to always update f->linkmode if the stat() succeeds. * tests/ls/group-dirs.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the change in behavior. Suggested by Amin Bandali in https://lists.gnu.org/r/coreutils/2018-12/msg00017.html
* maint: update all copyright year number rangesAssaf Gordon2019-01-011-1/+1
| | | | | | | | | 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.
* basenc: A new program complementary to base64/base32Assaf Gordon2018-12-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Encodes/decodes data in various common formats: base64,base64url,base32,base32,base16,base2,z85. Discussed here: https://lists.gnu.org/r/coreutils/2018-11/msg00014.html https://lists.gnu.org/r/coreutils/2018-12/msg00019.html * AUTHORS: Add basenc. * README: Reference the new program. * NEWS: Mention the new program. * build-aux/gen-lists-of-programs.sh: Add basenc. * doc/coreutils.texi: (basenc invocation): Document the new command. * man/.gitignore: Ignore the generated man page. * man/basenc.x: A new template, with few examples. * man/local.mk: Reference the new man page. * scripts/git-hooks/commit-msg: Allow basenc as program prefix. * src/.gitignore: Ignore the new binary. * src/basenc.c: (usage): Mention new options. (main): Handle new options. (isbase*, base*_length, base*_encode, base*_decode_ctx): Implement new encoding/decoding formats. * src/local.mk: Add new program. * tests/local.mk: Add new test. * tests/misc/basenc.pl: New tests. * tests/misc/help-version.sh (basenc_setup): use '--version' for default invocation (basenc errors with no parameters).
* echo: always process escapes when POSIXLY_CORRECT is setPádraig Brady2018-10-271-0/+1
| | | | | | | | | | | | | * src/echo.c (main): Always enable backslash processing if POSIXLY_CORRECT is set. * tests/misc/echo.sh: Add (the first) test for the echo command. * tests/local.mk: Reference the new test. * tests/misc/printf.sh: Update a stale comment. * doc/coreutils.texi (echo invocation). Mention that POSIXLY_CORRECT now always enables backslash processing. * NEWS: Mention the change in behavior. Fixes https://bugs.gnu.org/32703 Issue identified by Eric Blake.
* test: add -N unary operatorBernhard Voelker2018-10-261-0/+1
| | | | | | | | | | | Bash knows 'test -N FILE'. Add it to GNU 'test' as well. * src/test.c (unary_operator): Add a case for 'N'. (usage): Document it. * doc/coreutils.texi (node File characteristic tests): Likewise. * NEWS (New features): Likewise. * tests/misc/test-N.sh: Add a test. * tests/local.mk (all_tests): Reference it.
* tests: fix false failures when perl not availablePádraig Brady2018-06-271-1/+1
| | | | | * tests/local.mk: Reference the stub that skips perl tests, with the correct path.
* tests: initialize fail=0 to avoid "unary operator expected" errorsBernhard Voelker2018-06-231-0/+1
| | | | | | | | | | | | | | | | With an uninitialized variable 'fail', the unquoted use like test $fail = 1 lead to the shell error "unary operator expected". The uninitialized 'fail' variable was a side effect of https://git.sv.gnu.org/cgit/gnulib.git/commit/?id=e91c0d4f9 which was pulled into coreutils-v8.26 with https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=ef9650170 Coreutils test code relied and relies on 'fail' to be initialized, so initialize that variable here. * tests/local.mk (TESTS_ENVIRONMENT): Initialize fail=0.
* env: add -S/--split-string optionAssaf Gordon2018-06-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Adopted from FreeBSD's env(1), useful for specifing multiple parameters on a shebang (#!) script line, e.g: #!/usr/bin/env -S perl -w -T Discussed in https://lists.gnu.org/r/coreutils/2018-04/msg00011.html * src/env.c (valid_escape_sequence,escape_char,scan_varname, extract_varname,validate_split_str,build_argv, parse_split_string): New functions. (main): Process new option and call parse_split_string. (usage): Mention new option. * tests/misc/env-S.pl: Test new option from the command line. * tests/misc/env-S-script.sh: Test new option from shebang scripts. * tests/local.mk (all_tests): Add new tests. * man/env.x (OPTIONS): Show a brief example of -S usage and point to the full documentation for more information. * doc/coreutils.texi (env invocation): Detail usage of -S/--split-string option. * NEWS: Mention new option.
* ls: ignore case when coloring file extensionsKaxandra Labat2018-06-201-0/+1
| | | | | | | | * src/ls.c (get_color_indicator): s/STREQ_LEN/c_strncasecmp/ * src/dircolors.hin: Remove a now redundant entry. * tests/ls/color-ext.sh: Add a new test. * tests/local.mk: Reference the new test. * NEWS: Mention the change in behavior.
* cp: fix symlink checks when overwriting filesPádraig Brady2018-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Ensure this _does_ recreate the symlink Given "path1" and "path2" are on different devices. $ touch "path1/file" $ cd path2/; ln -s path1/file $ cp -dsf path1/file . Ensure this does _not_ overwrite file $ touch file $ ln -s file l1 $ cp -sf l1 file * src/copy.c (same_file_ok): Remove device ids from consideration, instead deferring to future EXDEV with --link or allowing the first case above to work. Also ensure that we do not exist this function too early, when the destination file is not a symlink, which protects against the second case. * tests/cp/cross-dev-symlink.sh: Add a test for the first case. * tests/cp/same-file.sh: Add a test for the second case above. * NEWS: Mention the bug fixes. * THANKS.in: Mention the reporters who also analyzed the code. Fixes https://bugs.gnu.org/31364