GNU bug report logs - #74427
tests/printf/printf-indexed failure on macOS

Previous Next

Package: coreutils;

Reported by: Grisha Levit <grishalevit <at> gmail.com>

Date: Tue, 19 Nov 2024 04:39:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pádraig Brady <P <at> draigBrady.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#74427: closed (tests/printf/printf-indexed failure on macOS)
Date: Tue, 19 Nov 2024 15:12:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 19 Nov 2024 15:10:37 +0000
with message-id <d6bac69a-b517-4d05-b4bc-80b4e4dc06d8 <at> draigBrady.com>
and subject line Re: bug#74427: tests/printf/printf-indexed failure on macOS
has caused the debbugs.gnu.org bug report #74427,
regarding tests/printf/printf-indexed failure on macOS
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
74427: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74427
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Grisha Levit <grishalevit <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: tests/printf/printf-indexed failure on macOS
Date: Mon, 18 Nov 2024 23:38:02 -0500
See the following two chunks from the test suite log on macOS 15:

+ printf_check '   0 1  ' '%100$*d %s %s %s\n' 4 1
+ cat
+ shift
+ env printf '%100$*d %s %s %s\n' 4 1
printf: '': Invalid argument
+ fail=1

+ printf_check_err 'printf: '\''A'\'': expected a numeric value' '%0x2$s %2$s\n' A B
+ cat
+ shift
+ returns_ 1 env printf '%0x2$s %2$s\n' A B
02$s B
+ compare exp out
+ compare_dev_null_ exp out
+ test 2 = 2
+ test xexp = x/dev/null
+ test xout = x/dev/null
+ return 2
+ case $? in
+ compare_ exp out
+ LC_ALL=C
+ diff -u exp out
--- exp	2024-11-18 23:32:01.486843241 -0500
+++ out	2024-11-18 23:32:01.492438694 -0500
@@ -1 +1 @@
-printf: 'A': expected a numeric value
+printf: 'A': Invalid argument
+ fail=1



[Message part 3 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Grisha Levit <grishalevit <at> gmail.com>, 74427-done <at> debbugs.gnu.org
Subject: Re: bug#74427: tests/printf/printf-indexed failure on macOS
Date: Tue, 19 Nov 2024 15:10:37 +0000
[Message part 4 (text/plain, inline)]
On 19/11/2024 04:38, Grisha Levit wrote:
> See the following two chunks from the test suite log on macOS 15:
> 
> + printf_check '   0 1  ' '%100$*d %s %s %s\n' 4 1
> + cat
> + shift
> + env printf '%100$*d %s %s %s\n' 4 1
> printf: '': Invalid argument
> + fail=1
> 
> + printf_check_err 'printf: '\''A'\'': expected a numeric value' '%0x2$s %2$s\n' A B
> + cat
> + shift
> + returns_ 1 env printf '%0x2$s %2$s\n' A B
> 02$s B
> + compare exp out
> + compare_dev_null_ exp out
> + test 2 = 2
> + test xexp = x/dev/null
> + test xout = x/dev/null
> + return 2
> + case $? in
> + compare_ exp out
> + LC_ALL=C
> + diff -u exp out
> --- exp	2024-11-18 23:32:01.486843241 -0500
> +++ out	2024-11-18 23:32:01.492438694 -0500
> @@ -1 +1 @@
> -printf: 'A': expected a numeric value
> +printf: 'A': Invalid argument
> + fail=1

This is due to inconsistency in how strtol and strtoimax operate on macos.
The man page for those on macos states:

  "If no conversion could be performed, 0 is returned and the global variable errno   is set to EINVAL (the last feature is not portable across all platforms)."

So in particular, we'll have to handle the NUL string in code,
to ensure it returns 0, and adjust the test to treat EINVAL
like "expected a numeric value".

I've not got access to a macos system to test currently,
but the attached should address this.

Marking this as done.

thanks,
Pádraig
[printf-indexed-macos.patch (text/x-patch, attachment)]

This bug report was last modified 239 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.