aboutsummaryrefslogtreecommitdiffstats
path: root/tests/misc/write-errors.sh (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-11-03tests: date: check that write errors are promptly diagnosedCollin Funk1-0/+2
This improvement is due to changes to Gnulib's fprintftime module. * NEWS: Mention the improvement. * src/getlimits.c (OFF64_T_MAX, OFF64_T_MIN): New macros. (main): Print them. * tests/misc/write-errors.sh: Call getlimits_. Add a date invocation.
2025-11-03date: promptly diagnose write errors with --filePádraig Brady1-0/+1
* src/date.c (batch_convert): Check error state of stdout after each date is processed. * tests/misc/write-errors.sh: Add a test case.
2025-10-22pr: promptly diagnose write errorsPádraig Brady1-1/+2
* src/pr.c (print_page): Exit promptly for `yes | pr`. (print_clump): Exit promptly for `pr < /dev/zero`. * tests/misc/write-errors.sh: Enable test cases. * NEWS: Mention the improvement.
2025-10-22nl: promptly diagnose write errorsPádraig Brady1-1/+1
* NEWS: Mention the improvement. * src/nl.c (process_file): Exit if error outputting line. * tests/misc/write-errors.sh: Enable the test case.
2025-10-22fmt: promptly diagnose write errorsPádraig Brady1-1/+2
* NEWS: Mention the improvement. * src/fmt.c (put_line): Exit if any error writing line. (flush_paragraph): Exit if any error writing buffer. * tests/misc/write-errors.sh: Enable the (flush_paragraph) test case, and add another to check the put_line() case.
2025-10-22numfmt: promptly diagnose write errorsPádraig Brady1-1/+1
* src/numfmt.c (process line): Inspect the stdio error state when outputting each line so that we don't have to check each output function but do eventually exit upon write error, while also remaining buffered. (main): Also check when outputting a header for the edge case of very long headers. * tests/misc/write-errors.sh: Enable the numfmt test case. * NEWS: Mention the improvement, and reorganize all numfmt improvements.
2025-09-17tests: write-errors.sh: avoid portability issue with dashPádraig Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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 Brady1-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.