From: Collin Funk Date: Mon, 3 Nov 2025 06:36:31 +0000 (-0800) Subject: tests: date: check that write errors are promptly diagnosed X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08308386097c95cfe30c4218b0e54936a2e4d891;p=thirdparty%2Fcoreutils.git tests: date: check that write errors are promptly diagnosed 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. --- diff --git a/NEWS b/NEWS index fa14e7a2cd..0a81cf7b50 100644 --- a/NEWS +++ b/NEWS @@ -66,8 +66,8 @@ GNU coreutils NEWS -*- outline -*- ** Improvements - 'fmt', 'nl', and 'pr' will now exit promptly upon receiving a write error, - which is significant when reading large / unbounded inputs. + 'fmt', 'date', 'nl', and 'pr' will now exit promptly upon receiving a write + error, which is significant when reading large / unbounded inputs. install, sort, and split now use posix_spawn() to invoke child programs more efficiently and more independently from their own memory usage. diff --git a/src/getlimits.c b/src/getlimits.c index 1cd10a6e98..db44967e76 100644 --- a/src/getlimits.c +++ b/src/getlimits.c @@ -46,6 +46,14 @@ # define PID_T_MIN TYPE_MINIMUM (pid_t) #endif +#ifndef OFF64_T_MAX +# define OFF64_T_MAX TYPE_MAXIMUM (off64_t) +#endif + +#ifndef OFF64_T_MIN +# define OFF64_T_MIN TYPE_MINIMUM (off64_t) +#endif + /* These are not interesting to print. * Instead of these defines it would be nice to be able to do * #ifdef (TYPE##_MIN) in function macro below. */ @@ -161,6 +169,7 @@ main (int argc, char **argv) print_int (GID_T); print_int (PID_T); print_int (OFF_T); + print_int (OFF64_T); print_int (INTMAX); print_int (UINTMAX); diff --git a/tests/misc/write-errors.sh b/tests/misc/write-errors.sh index 612658c6a6..47220584a9 100755 --- a/tests/misc/write-errors.sh +++ b/tests/misc/write-errors.sh @@ -18,6 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ timeout env +getlimits_ if ! test -w /dev/full || ! test -c /dev/full; then skip_ '/dev/full is required' @@ -30,6 +31,7 @@ cat /dev/zero comm -z /dev/zero /dev/zero cut -z -c1- /dev/zero cut -z -f1- /dev/zero +date +%${OFF64_T_MAX}c date --version; yes 0 | date -f- dd if=/dev/zero expand /dev/zero