]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: date: avoid test failure on NetBSD
authorCollin Funk <collin.funk1@gmail.com>
Sat, 1 Nov 2025 04:14:54 +0000 (21:14 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Sat, 1 Nov 2025 17:49:05 +0000 (10:49 -0700)
* tests/date/date-tz.sh: Allow date to fail with large values for TZ
since NetBSD's tzalloc function limits them to 256 bytes.

tests/date/date-tz.sh

index 5390cf56806e8826257da0e82cf1412b004d47b1..05736f90dc6451a7784b481a7e111a5371cf4671 100755 (executable)
@@ -21,6 +21,12 @@ print_ver_ date
 
 # coreutils-8.27 would overwrite the heap with large TZ values
 tz_long=$(printf '%2000s' | tr ' ' a)
-date -d "TZ=\"${tz_long}0\" 2017" || fail=1
+date -d "TZ=\"${tz_long}0\" 2017" 2> err
+
+# Gnulib's tzalloc handles arbitrarily long TZ values, but NetBSD's does not.
+case $? in
+  0) ;;
+  *) grep '^date: invalid date' err || fail=1 ;;
+esac
 
 Exit $fail