bug#78934: test failure after recent 'od' changes

Pádraig Brady <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
On 30/06/2025 20:47, Bruno Haible via GNU coreutils Bug Reports wrote:
> After this week's changes in 'od', the CI reports a test failure on OpenBSD
> and Solaris:
> 
> 
> FAIL: tests/od/od
Ah right, strerror(ERANGE) varies by platform.
I'll push the attached later to address this.

Marking this as done.

thanks,
Padraig
od-test-erange.patch (text/x-patch, 1.6 KB)
From ee22d706e31430a1f729ca55c56e18ed566ba0c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
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 e4e328ad6..40cc4289a 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.49.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.