From: Pádraig Brady
Date: Mon, 30 Jun 2025 22:28:32 +0000 (+0100) Subject: tests: avoid false failure due to varied ERANGE errors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0512608a444507e6cc5444e62949962bc3d32d8d;p=thirdparty%2Fcoreutils.git tests: avoid false failure due to varied ERANGE errors * tests/od/od.pl: Use the system error string for ERANGE, rather than hardcoding a particular one. Fixes https://bugs.gnu.org/78934 --- diff --git a/tests/od/od.pl b/tests/od/od.pl index e4e328ad68..40cc4289ac 100755 --- a/tests/od/od.pl +++ b/tests/od/od.pl @@ -25,6 +25,9 @@ use strict; my $prog = 'od'; +use Errno qw(ERANGE); +my $ERANGE = do { local $! = ERANGE; "$!" }; + # Use a file in /proc whose size is not likely to # change between the wc and od invocations. my $proc_file = '/proc/version'; @@ -76,11 +79,11 @@ my @Tests = # Overflowing traditional offsets should be diagnosed. ['overflow-off-1', '-', '7' x 255, {IN_PIPE=>""}, {EXIT=>1}, - {ERR=>"od: ".('7' x 255).": Numerical result out of range\n"}], + {ERR=>"od: ".('7' x 255).": $ERANGE\n"}], ['overflow-off-2', '-', ('9' x 254).'.', {IN_PIPE=>""}, {EXIT=>1}, - {ERR=>"od: ".('9' x 254).".: Numerical result out of range\n"}], + {ERR=>"od: ".('9' x 254).".: $ERANGE\n"}], ['overflow-off-3', '-', '0x'.('f' x 253), {IN_PIPE=>""}, {EXIT=>1}, - {ERR=>"od: 0x".('f' x 253).": Numerical result out of range\n"}], + {ERR=>"od: 0x".('f' x 253).": $ERANGE\n"}], # Ensure that a large width does not cause trouble. # From coreutils-7.0 through coreutils-8.21, these would print