summaryrefslogtreecommitdiffstats
path: root/tests/misc/write-errors.sh
AgeCommit message (Collapse)AuthorLines
2025-09-17tests: write-errors.sh: avoid portability issue with dashPádraig Brady-1/+1
* tests/misc/write-errors.sh: Use printf rather than echo since the echo builtin in dash will interpret backslashes. * tests/misc/read-errors.sh: Likewise for consistency.
2025-09-17tests: fix issues with fold-characters.sh testPádraig Brady-0/+1
This was noticed with: trap '' PIPE && # Ignore SIGPIPE make check TESTS=tests/fold/fold-characters.sh SUBDIRS=. * tests/fold/fold-characters.sh: Move memory limit test to ... * tests/misc/write-errors.sh: ... which avoids "write error" messages on stderr due to the ignored SIGPIPE. It also protects the fold invocation with a timeout(1) so that fold implementations that don't exit promptly upon write error don't hang the test suite (Like we would have done before commit v9.7-311-gc95c7ee76).
2025-09-16fold: exit promptly upon write errorsPádraig Brady-1/+3
* NEWS: Mention the improvement. * src/fold.c (fold_file): Check for write errors after each buffer read from stdin. * tests/misc/write-errors.sh: Add test cases.
2025-01-15tests: misc/write-errors.sh: increase memory limitPádraig Brady-1/+1
* tests/head/head-c.sh: Use a larger VM limit to avoid mem allocation failures, which were seen on CheriBSD.
2025-01-15tests: avoid slow ulimit -v behaviorPádraig Brady-1/+1
* init.cfg (ulimit_supported_): skip_ if the ulimit -v takes too long, which was seen with bash 5.2 on Solaris 11, where fork() returned EAGAIN under memory constraints, and bash retried for about 16 seconds. (get_min_ulimit_v_): Break early if skipped. * tests/misc/write-errors.sh: Be more conservative and skip on failure to determine min ulimit.
2025-01-12tests: make misc/write-errors.sh immune to default signal dispositionPádraig Brady-3/+5
* tests/misc/write-errors.sh: Reset SIGPIPE to the default (terminate) disposition, so that the test doesn't erroneously fail due to an ignored SIGPIPE in the test environment.
2025-01-01maint: update all copyright year number rangesPádraig Brady-1/+1
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-08-04tests: limit mem usage on potentially expensive testPádraig Brady-3/+13
* tests/misc/write-errors.sh: Limit mem usage if possible, as some implementations may use unbounded memory for the tests cases used here.
2024-08-04tests: ensure utils support writing to a closed pipePádraig Brady-0/+5
* tests/misc/write-errors.sh: A closed pipe is a common scenario, and should not induce an error. The general case is discussed at: https://www.pixelbeat.org/programming/sigpipe_handling.html
2024-01-01maint: update all copyright year number rangesPádraig Brady-1/+1
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-07-17join: promptly diagnose write errorsPádraig Brady-1/+1
* src/join.c (prjoin): Check for write errors after each line. * tests/misc/write-errors.sh: enable the test for join. * NEWS: Mention the improvement.
2023-07-17comm: promptly diagnose write errorsPádraig Brady-1/+1
* src/comm.c (writeline): Simplify by removing the unneeded STREAM parameter. Call write_error() upon ferror(). (compare_files): Adjust to simplified writeline(). * tests/misc/write-errors.sh: Enable comm test. * NEWS: Mention the improvement.
2023-07-17cut: promptly diagnose write errorsPádraig Brady-1/+2
* src/cut.c (cut_bytes): Diagnose errors from fwrite() and putchar(). (cut_fields): Likewise. * tests/misc/write-errors.sh: Enable the test for cut, and augment to cover both cut_bytes() and cut_fields(). * NEWS: Mention the improvement.
2023-07-17uniq: promptly diagnose write errorsPádraig Brady-1/+1
* src/uniq.c (write_line): Check the output from fwrite() immediately. (check_file): Likewise. * tests/misc/write-errors.sh: Enable the test case. * NEWS: Mention the improvement.
2023-07-17od: promptly diagnose write errorsPádraig Brady-1/+1
* src/od.c (dump): Check for write errors after each block written, to exit early even with large / unbounded inputs. * tests/misc/write-errors.sh: enable od check. * NEWS: Mention the improvement. Fixes https://bugs.gnu.org/64540
2023-07-17all: avoid repeated diagnostic upon write errorPádraig Brady-6/+0
* cfg.mk (sc_some_programs_must_avoid_exit_failure): Adjust to avoid false positive. (sc_prohibit_exit_write_error): A new syntax check to prohibit open coding error(..., "write error"); instead directing to use... * src/system.h (write_error): ... a new function to clear stdout errors before we explicitly diagnose a write error and exit. * src/basenc.c: Use write_error() to ensure no repeated diagnostics. * src/cat.c: Likewise. * src/expand.c: Likewise. * src/factor.c: Likewise. * src/paste.c: Likewise. * src/seq.c: Likewise. * src/shuf.c: Likewise. * src/split.c: Likewise. * src/tail.c: Likewise. * src/tr.c: Likewise. * src/unexpand.c: Likewise. * tests/misc/write-errors.sh: Remove TODOs for the fixed utilities: expand, factor, paste, shuf, tr, unexpand.
2023-07-17tests: ensure utilties exit promptly upon write errorPádraig Brady-0/+70
* tests/local.mk: Reference the new test. * tests/misc/write-errors.sh: A new test to ensure utilities exit promptly upon writing to /dev/full.