summaryrefslogtreecommitdiff
path: root/tests/misc
AgeCommit message (Collapse)Author
2016-08-09maint: refactor common expand(1) and unexpand(1) codeAssaf Gordon
* src/expand.c, src/unexpand.c: Move global variables from here... * src/expand-common.h, src/expand-common.c: ... to here. * src/expand.c, src/unexpand.c: (parse_tab_stops, validate_tab_stops, next_file): Move identical functions to new module. (add_tab_stop): Move to new module, including additional code from 'unexpand' (keeping max_column_width) which will have no effect in when used in 'expand'. Refactor common next-column calculation code into a new function 'get_next_tab_column'. * src/local.mk: (src_expand_SOURCES, src_unexpand_SOURCES): Add 'expand-common.c'; (noinst_HEADERS): Add 'expand-common.h'. * po/POTFILES.in: Add 'expand-common.c'. * tests/misc/expand.pl: Add more tests. * tests/misc/unexpand.pl: Likewise. * TODO: Move conclusions to above test after investigation.
2016-07-18sort: with -h, disallow thousands separator between number and unitKamil Dudka
* src/sort.c (traverse_raw_number): Accept thousands separator only if it is immediately followed by a digit. * tests/misc/sort-h-thousands-sep.sh: Cover the fix for this bug. Suggested by Pádraig Brady in http://bugs.gnu.org/24015
2016-07-18sort: make -h work with -k and blank used as thousands separatorKamil Dudka
* src/sort.c (traverse_raw_number): Allow to skip only one occurrence of thousands_sep to avoid finding the unit in the next column in case thousands_sep matches as blank and is used as column delimiter. * tests/misc/sort-h-thousands-sep.sh: Add regression test for this bug. * tests/local.mk: Reference the test. * NEWS: Mention the bug fix. Reported at https://bugzilla.redhat.com/1355780 Fixes http://bugs.gnu.org/24015
2016-07-02tests: improve recent seq EPIPE testAssaf Gordon
Follow-up to commit c92585b1: improve epipe test script, with suggestions from Bernhard Voelker and Pádraig Brady. see: http://lists.gnu.org/archive/html/coreutils/2016-04/msg00067.html . * tests/misc/seq-epipe.sh: Avoid too many subshells, stricter validation of errors and output from seq, skip if trapping SIGPIPE is not supported.
2016-06-24yes: fix copy and paste issue with previous commitPádraig Brady
* src/yes.c (main): Output 'y' not '-'. * tests/misc/yes.sh: Add a test for default output.
2016-05-31sort: modify 'leading spaces' debug warning scenariosAssaf Gordon
Print warning regardless of locale, avoid warning if key is zero width. Problem reported by Karl Berry in http://bugs.gnu.org/23665 . * src/sort.c: (key_warnings): change conditions for 'leading spaces' warning. * tests/misc/sort-debug-warn.sh: adjust tests accordingly.
2016-05-31tests: sort-debug-warn: add progress information linesAssaf Gordon
Easier troubleshooting of individual 'sort --debug' messages. Discussed in http://bugs.gnu.org/23665 . * tests/misc/sort-debug-warn.sh: add progress number before each sort invocation.
2016-05-14nl: reset numbering for each sectionKOBAYASHI Takashi
* NEWS: Mention the bug fix. * src/nl.c (proc_body, proc_footer): Reset numbering here too. * doc/coreutils.texi (nl invocation): Adjust for behavior change. * tests/misc/nl.sh: Add a test case.
2016-04-24seq: detect and report I/O errors immediatelyAssaf Gordon
Ensure I/O errors are detected (and terminate seq), preventing seq from infloop (or running for long time with a large range) upon write errors or ignored SIGPIPE. Examples: seq 1 inf > /dev/full (seq_fast) seq 1.1 0.1 inf >/dev/full (print_numbers) * src/seq.c (io_error): A new function to diagnose appropriate stdio errors and exit the program with failure status. (seq_fast, print_numbers): Explicitly check for write errors and terminate the program with diagnostic. * tests/misc/seq-io-errors.sh: Test error detection with /dev/full. * tests/misc/seq-epipe.sh: Test error detection with broken pipes. * tests/local.mk: Add new tests. * NEWS: Mention the fix.
2016-04-21yes: avoid redundant diagnostics on write errorPádraig Brady
* src/yes.c (main): For large inputs only write a single diagnostic for write errors. * tests/misc/yes.sh: Test when /dev/full is available.
2016-04-21sleep,timeout: support overflowing floating point valuesPádraig Brady
* src/sleep.c (main): Allow ERANGE since we allow "inf" values. * src/timeout.c (parse_duration): Likewise. * tests/misc/sleep.sh: New file. Tests for sleep(1). * tests/misc/timeout-parameters.sh: Add case for newly allowed $LDBL_MAX. Also use returns_ throughout the file. Also avoid small timeout values which might give false failures under load.
2016-04-21tests: avoid potential overflows with `expr`Pádraig Brady
* cfg.mk (sc_prohibit_expr_unsigned): expr uses intmax_t internally when GMP is not available, so flag any uses of unsigned limits. * tests/misc/timeout-parameters.sh: Remove the overflow related to UINT_MAX as it's handled by the following case. Change the following case from 99... to $TIME_T_OFLOW to be more expressive in what it's actually testing. Directly check that commands succeed, rather than inspecting $? afterwards. * tests/dd/skip-seek-past-dev.sh: Guard against large device sizes. * tests/id/setgid.sh: Protect: Guard against large group IDs. * tests/misc/cut-huge-range.sh: Tweak comment to avoid syntax check. It's tempting to simplify to just skip the test if expr fails, but SIZE_MAX > INTMAX_MAX is the common case.
2016-04-14seq: do not allow NaN argumentsBernhard Voelker
* src/seq.c (isnan): Define macro. (scan_arg): Add check if the given argument is NaN, and exit with a proper error diagnostic in such a case. (usage): Document it. * tests/misc/seq.pl: Add tests. * doc/coreutils.texi (seq invocation): Document the change. * NEWS (Changes in behavior): Mention the change.
2016-04-14seq: do not allow 0 as increment valueBernhard Voelker
* src/seq.c (main): Exit with an error diagnostic when the given step value is Zero. (usage): Document it. * doc/coreutils.texi (seq invocation): Likewise. * tests/misc/seq.pl: Add tests. * NEWS (Changes in behavior): Mention the change. Reported by Маренков Евгений in: http://bugs.gnu.org/23110
2016-03-17date ls pr: fix time zone abbrs on SysV platformsPaul Eggert
The problematic code computed a struct tm in one time zone, and then printed it or converted it to a string in another. To be portable the same time zone needs to be used for both operations. On GNU platforms this is not an issue, but incorrect output can be generated on System V style platforms like AIX where time zone abbreviations are available only in the 'tzname' global variable. Problem reported by Assaf Gordon in: http://bugs.gnu.org/23035 * NEWS: Document the bug. * src/date.c (show_date): * src/ls.c (long_time_expected_width, print_long_format): * src/pr.c (init_header): * src/stat.c (human_time): Use localtime_rz instead of localtime, so that the time zone information is consistent for both localtime and time-formatting functions like fprintftime and nstrftime. For 'stat' this change is mostly just a code cleanup but it also causes stat to also print nanoseconds when printing time stamps that are out of localtime range, as this is more consistent with what other programs do. For programs other than 'stat' this fixes bugs with time zone formats that use %Z. * src/du.c, src/pr.c (localtz): New static var. (main): Initialize it. * src/du.c (show_date): New time zone argument, so that localtime and fprintftime use the same time zone information. All callers changed. * tests/misc/time-style.sh: New file. * tests/local.mk (all_tests): Add it. * tests/misc/date.pl: Test alphabetic time zone abbreviations.
2016-02-23all: be less strict about usage if POSIX 2008Paul Eggert
sort, tail, and uniq now support traditional usage like 'sort +2' and 'tail +10' on systems conforming to POSIX 1003.1-2008 and later. * NEWS: Document this. * doc/coreutils.texi (Standards conformance, tail invocation) (sort invocation, uniq invocation, touch invocation): Document new behavior, or behavior's dependence on POSIX 1003.1-2001. * src/sort.c (struct keyfield.traditional_used): Rename from obsolete_used, since implementations are now allowed to support it. All uses changed. (main): Allow traditional usage if _POSIX2_VERSION is 200809. * src/tail.c (parse_obsolete_option): Distinguish between traditional usage (which POSIX 2008 and later allows) and obsolete (which it still does not). * src/uniq.c (strict_posix2): New function. (main): Allow traditional usage if _POSIX2_VERSION is 200809. * tests/misc/tail.pl: Test for new behavior.
2016-01-19tests: avoid false failure in shred-passes.shPádraig Brady
* tests/misc/shred-passes.sh: Specify an exact amount to shred, to avoid running out of simulated random data on file systems with a large st_blksize like GPFS for example. Reported by Assaf Gordon.
2016-01-18tests: adjust memory limits in head-c.shAssaf Gordon
* tests/misc/head-c.sh: Further increase the limit to 8MB over the base test command. 5.1MB was seen as minimum extra needed on FreeBSD 9.3 x86_64.
2016-01-15tests: remove a non portable localtime testPádraig Brady
* tests/misc/date.pl: This test was dependent on perl unconditionally calling the system localtime() as date(1) does. However perl has its own configure checks in place to avoid buggy localtime implementations. Therefore comment out this test as a FIXME for now. This test was seen to fail on FreeBSD 10 where localtime() returns nonsense values instead of failing for arguments >= 2^56.
2016-01-15tests: adjust memory limits in head-c.shPádraig Brady
* tests/misc/head-c.sh: Further increase the limit, to account for the fact that head(1) needs at least 1.576MB over the base test command on FreeBSD 10. 4MB should be enough headroom while still providing over allocation protection. Reported by Assaf Gordon.
2016-01-15tests: simplify invalid signal determination for kill -lPádraig Brady
* src/operand2sig.c (operand2sig): Add a detailed comment explaining why we validate even very large shell exit status values. * tests/misc/kill.sh: Add a test case for the ksh scheme. Simplify the INVALID signal number determination which also avoids a false failure on systems like FreeBSD 10 with incomplete signal list (caused by inaccurate NSIG).
2016-01-13tests: include part of wc-files0.sh skipped by mistakePádraig Brady
* tests/misc/wc-files0.sh: $fail is always set to 0, so correct the test to include that part of the test case.
2016-01-13wc: avoid ambiguous output with '\n' in file namesPádraig Brady
* src/wc.c (write_counts): Shell escape the file name if it contains '\n' so only a single line per file is output. * tests/misc/wc-files0.sh: Add a test case. * NEWS: Mention the improvement.
2016-01-13numfmt: add the -z,--zero-terminated optionAssaf Gordon
* doc/coreutils.texi (numfmt invocation): Reference the description. * src/numfmt.c: Parameterize '\n' references. * tests/misc/numfmt.pl: Add tests for character and field processing. * NEWS: Mention the new feature.
2016-01-13paste: add the -z,--zero-terminated optionPádraig Brady
* doc/coreutils.texi (paste invocation): Reference -z description. * src/paste.c (main): Parameterize the use of '\n'. * tests/misc/paste.pl: Add test cases. * NEWS: Mention the new feature.
2016-01-13comm: support NUL --output-delimiter for consistencyPádraig Brady
* src/comm.c (main): Track the output delimiter length, so that it can be adjusted to 1 for the NUL delimiter. Also rename the global variable from "delimiter" to "col_sep" so its use is more obvious, and to distinguish from the recently added "delim" global variable. * tests/misc/comm.pl: Adjust accordingly.
2016-01-13comm: add the -z,--zero-terminated optionPádraig Brady
* doc/coreutils.texi (comm invocation): Reference option description. * src/comm.c (main): Use readlinebuffer_delim() to support a parameterized delimiter. * tests/misc/comm.pl: Add test cases. * NEWS: Mention the new feature.
2016-01-13tac: support an empty (NUL) --separatorPádraig Brady
* doc/coreutils.texi (tac invocation): Mention the NUL delineation with an empty --separator. * src/tac.c (main): Allow an empty separator when -r not specified. * tests/misc/tac.pl: Add test cases. * NEWS: Mention the new feature. Fixes http://bugs.gnu.org/8103
2016-01-13cut: add the -z,--zero-terminated optionPádraig Brady
* doc/coreutils.texi (cut invocation): Reference the description. * src/cut.c: Parameterize '\n' references. * tests/misc/cut.pl: Add tests for character and field processing. * NEWS: Mention the new feature.
2016-01-13head,tail: add the -z,--zero-terminated optionRichard Russon
* doc/coreutils.texi: Reference the option description. * src/head.c: Parameterize the delimiter character. * src/tail.c: Likewise. * tests/misc/head.pl: Add test case. * tests/misc/tail.pl: Likewise. * NEWS: Mention the new feature.
2016-01-13join,sort,uniq: with -z, treat '\n' as a field separatorPádraig Brady
* NEWS: Mention the change in behavior. * doc/coreutils.texi (newlineFieldSeparator): A new description, referenced from ({join,sort,uniq} invocation). * src/system.h (field_sep): A new inline function to determine if a character is a field separator. * src/join.c (usage): s/whitespace/blank/ to be more accurate wrt which characters are field separators. (xfields): s/isblank/field_sep/. * src/sort.c (inittables): Likewise. * src/uniq.c (find_field): Likewise. * tests/misc/join.pl: Adjust -z test, and add a test/example for processing the whole record with field processing. * tests/misc/sort.pl: Add -z test cases, including case with '\n'. * tests/misc/uniq.pl: Add -z -f test case with \n.
2016-01-10tests: fix races wrt output files of background processesBernhard Voelker
At least the false positive in tail-2/follow-stdin.sh could be seen on a 4-core i5 system with -j8. Fix similar cases. too. * tests/tail-2/follow-stdin.sh: Empty the 'out' file in each iteration. Otherwise, under heavy system load, 'check_tail_output' would see the expected output from the previous round before tail would have the chance to come up in the background. While at it, move the creation of the 'exp' file out of the loop. * tests/dd/stats.sh: Empty the output file of the background process here, too. * tests/misc/cat-buf.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/tail-2/wait.sh: Likewise.
2016-01-06stty: support [-]drain setting to control waiting for pending TxPádraig Brady
Instead of commit v8.24-132-g5171bef which only provides control to disable this behavior (with -I), provide the symmetrical "[-]drain" special setting. * src/stty.c (main): Parse the [-]drain setting instead of -I, and treat like a global option. (usage): Adjust accordingly. * tests/misc/stty.sh: Test "drain" with and without options. * NEWS: Mention the new feature.
2016-01-04stty: support -I, --immediate to not wait for pending transmissionPádraig Brady
In some cases an initial drain may block indefinitely as discussed at: http://lists.gnu.org/archive/html/coreutils/2016-01/msg00007.html * src/stty.c (main): Use TCSANOW rather than TCSADRAIN if -I specified. (usage): Document the new option. * doc/coreutils.texi (stty invocation): Likewise. * tests/misc/stty.sh: Ensure -I is supported. * NEWS: Mention the new feature.
2016-01-01maint: update all copyright year number rangesPádraig Brady
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.
2015-12-17tests: avoid intermittent ulimit -v failuresPádraig Brady
* init.cfg (get_min_ulimit_v_): Increase the determined virtual memory limit for the command by a page size to avoid alignment issues causing false failures for subsequent runs. * tests/misc/cut-huge-range.sh: Be defensive and match the cut invocations under test, more closely with the form used to determine the VM memory limit. This was noticed on i686 linux at: http://hydra.nixos.org/build/28990456
2015-12-15maint: include 'env' commands in returns_ syntax checkPádraig Brady
* cfg.mk (sc_prohibit_and_fail_1): Remove 'env' from the exclusion list. * tests/misc/env.sh: Adjust accordingly. * tests/misc/help-version.sh: Likewise.
2015-12-15tests: improve kill testsPádraig Brady
* tests/misc/kill.sh: - verify kill -[lt] support multiple parameters. - verify kill -[lt] fail with (some) invalid parameters. - Use returns_1 ... || fail=1, rather than ... && fail=1.
2015-12-14sort: fix --debug marking for -b -k1.xPádraig Brady
We were erroneously skipping blanks in the marked comparison _after_ the key start offset was applied. * src/sort.c (debug_keys): Don't skip starting blanks if already handled by begfield(). * tests/misc/sort-debug-keys.sh: Add a test case. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/22155
2015-12-14kill: add undocumented -L for compatibilityPádraig Brady
procps, bash >= 4.4, and util-linux >= 2.23 all have the -L option to output a table. * src/kill.c (main): Have -L synonymous with -t. Luckily there is no signal that begins with 'L'. * tests/misc/kill.sh: Update the test.
2015-12-14tests: add tests for the kill commandPádraig Brady
* tests/misc/kill.sh: Add first tests for kill. * tests/local.mk: Reference the new test.
2015-12-14maint: fix incorrect spellings etcPádraig Brady
* NEWS: Use a standard version specification. * doc/coreutils.texi: Fix incorrect grammar. * src/df.c: Update a stale comment. * src/copy.c: Fix incorrect spellings. * src/factor.c: Likewise. * src/ls.c: Likewise. * src/pr.c: Likewise. * src/relpath.c: Likewise. * src/shred.c: Likewise. * src/sort.c: Likewise. * src/split.c: Likewise. * src/stdbuf.c: Likewise. * tests/misc/seq-precision.sh: Likewise.
2015-11-23md5sum,sha*sum: ensure --ignore-missing fails when no file verifiedPádraig Brady
* src/md5sum.c (digest_check): Update a matched_checksums bool upon matched checksum, and fail (loudly unless --status is specified) if there were no matches. Also change properly_formatted_lines to a bool while at it since we don't need to track the plurality. * tests/misc/md5sum.pl: Add a test case. Suggested by Jim Meyering.
2015-11-23md5sum,sha*sum: add --ignore-missing for checking a subset of filesLuther Thompson
* doc/coreutils.texi (md5sum invocation): Document the new option. * src/md5sum.c (digest_file): Return an empty digest to indicate a missing file. (digest_check): Don't fail or output status given an empty checksum. (usage): Document the new option. (main): Process and validate the new option. * tests/misc/md5sum.pl: Add new test cases. * NEWS: Mention the new feature. Fixes http://bugs.gnu.org/15604
2015-11-12csplit: check and report fwrite errors with errnoAssaf Gordon
discussed in: http://lists.gnu.org/archive/html/coreutils/2015-10/msg00091.html * src/csplit.c: (save_line_to_file): check fwrite failures, report and exit immediately instead of deferring to 'close_output'. * tests/misc/csplit-io-err.sh: test fwrite failure using LD_PRELOAD. * tests/local.mk: add new test.
2015-11-10tests: ensure programs are built before testingPádraig Brady
programs may not be built due to missing system dependencies, or any program can be excluded at configure time with --enable-no-install-program. So ensure we're not testing the system versions in these cases. * init.cfg (print_ver_): Call require_built_ first. * tests/misc/tty-eof.pl: Skip programs not built. * tests/Coreutils.pm (run_tests): Likewise. * tests/misc/ls-misc.pl: Use 'env test' rather than abs path. * tests/misc/test-diag.pl: Likewise. * tests/local.mk: Adjust include order for dependencies. * tests/misc/arch.sh: Remove redundant calls to require_built_. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/groups-dash.sh: Likewise. * tests/misc/groups-version.sh: Likewise. * tests/misc/stdbuf.sh: Likewise. * tests/cp/acl.sh: Remove problematic call to print_ver_ [gs]etfacl. * tests/mv/acl.sh: Likewise. * cfg.mk (sc_env_test_dependencies): A new syntax check to enforce specifying dependencies with print_ver_ for programs specified through the env command. * du/bigtime.sh: Add new print_ver_ dependencies. * du/max-depth.sh: Likewise. * dd/ascii.sh: Likewise. * tests/ls/capability.sh: Likewise. * tests/ls/root-rel-symlink-color.sh: Likewise. * tests/misc/chroot-fail.sh: Likewise. * tests/misc/readlink-fp-loop.sh: Likewise. * tests/misc/sort-debug-keys.sh: Likewise. * tests/readlink/can-e.sh: Likewise. * tests/readlink/can-f.sh: Likewise. * tests/readlink/can-m.sh: Likewise. * tests/tail-2/inotify-race.sh: Likewise. * tests/tail-2/inotify-race2.sh: Likewise. * tests/touch/no-create-missing.sh: Likewise. * tests/touch/no-dereference.sh: Likewise. * tests/misc/printenv.sh: Tweak to avoid syntax check trigger. * tests/misc/help-version.sh: Likewise. * tests/misc/yes.sh: Likewise. * tests/misc/printf-quote.sh: Use previously unused $prog. * configure.ac (EXTRA_MANS): Add $gl_no_install_prog to the list so that check-x-vs-1 syntax check is satisfied.
2015-11-10maint: use standard spacing in shebang line in testsPádraig Brady
It's better to be consistent even though spacing is insignificant: http://www.in-ulm.de/~mascheck/various/shebang/#blankrequired
2015-11-10tests: cleanup trapping of signal namesPádraig Brady
A side effect of this cleanup is we no longer depend on our own kill command being built. * init.cfg (require_trap_signame_): A new function to verify that the shell supports specifying traps by signal name. (require_kill_group_): A new function to ensure the shell supports sending a signal to a group. * tests/du/move-dir-while-traversing.sh: Ensure trap supports signal names. * tests/misc/stty-invalid.sh: Likewise. * tests/misc/stty-pairs.sh: Likewise. * tests/misc/stty-row-col.sh: Likewise. * tests/misc/stty.sh: Likewise. * tests/misc/sort-compress.sh: Likewise. Also simplify trap call. * tests/install/trap.sh: Likewise. * tests/misc/timeout.sh: Likewise. * tests/dd/stats.sh: Likewise. Also use default kill command. * tests/misc/timeout-group.sh: Likewise.
2015-11-04paste: avoid confusing backslash quoting in diagnosticPádraig Brady
* src/paste.c (main): Setting the quoting style to "escape" went against the intent of the comment about presenting doubled backslashes to the user. Instead use "c-maybe" which is the only mode which avoids doubled backslashes, and provides protection against arbitrary control characters. * tests/misc/paste.pl: Adjust accordingly.
2015-11-04printf: support the %q format to quote for shellPádraig Brady
* src/printf.c (usage): Mention the new format. (print_formatted): Handle the quoting by calling out to the quotearg module with "shell-escape" mode. * doc/coreutils.texi (printf invocation): Document %q. * tests/misc/printf-quote.sh: New test. * tests/local.mk: Reference new test. * NEWS: Mention the new feature.