From 0512608a444507e6cc5444e62949962bc3d32d8d Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Mon, 30 Jun 2025 23:28:32 +0100 Subject: [PATCH] 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 --- tests/od/od.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 -- 2.47.3