Re: date-debug test failure with musl

Submitted by Assaf Gordon on May 13, 2019, 10:49 p.m.


Message ID
State New
Series "Re: date-debug test failure with musl"
Headers show

Commit Message

Assaf Gordon May 13, 2019, 10:49 p.m.

On 2019-05-13 12:23 p.m., Rich Felker wrote:
> On Mon, May 13, 2019 at 05:02:48AM +0200, Niklas Hambüchen wrote:
>> Dear coreutils maintainers,
>> when compiling coreutils commit 6e97d36 against musl v1.1.22 on Ubuntu, I get a test failure and differing output than when using glibc.

Thank you for the report,


> As long as coreutils' date is producing the desired "invalid" error
> either way, which it seems to be, I think it's a mistake that the
> debug output for "normalized time" is being compared as part of the
> test assertion. Only the result should matter, not the path by which
> it's reached.

And thank you Rich for the quick analysis.

The attached patch implements your suggestion.

It works on glibc, please give it a test on your Ubuntu/musl-1.1.22 system.

  - assaf

Patch hide | download patch | download mbox

From 402c3646e19c199130e7a6db5238cf5908e51fb8 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <>
Date: Mon, 13 May 2019 16:37:40 -0600
Subject: [PATCH] tests: avoid false-positive in date-debug test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When debugging an invalid date due to DST switching, the intermediate
'normalized time' should not be checked - its value can differ between
systems (e.g. glibc vs musl).

Reported by Niklas Hambüchen in
Analyzed by Rich Felker in

* tests/misc/ Replace the exact normalized time
with 'XX:XX:XX' so different values would not trigger test failure.
 tests/misc/ | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/misc/ b/tests/misc/
index aa47f1abb..2ce6f4ce8 100755
--- a/tests/misc/
+++ b/tests/misc/
@@ -71,7 +71,7 @@  date: input timezone: TZ="America/Edmonton" in date string
 date: using specified time as starting value: '02:30:00'
 date: error: invalid date/time value:
 date:     user provided time: '(Y-M-D) 2006-04-02 02:30:00'
-date:        normalized time: '(Y-M-D) 2006-04-02 03:30:00'
+date:        normalized time: '(Y-M-D) 2006-04-02 XX:XX:XX'
 date:                                             --
 date:      possible reasons:
 date:        non-existing due to daylight-saving time;
@@ -81,7 +81,14 @@  date: invalid date 'TZ="America/Edmonton" 2006-04-02 02:30:00'
 # date should return 1 (error) for invalid date
-returns_ 1 date --debug -d "$in2" >out2 2>&1 || fail=1
+returns_ 1 date --debug -d "$in2" >out2-t 2>&1 || fail=1
+# The output line of "normalized time" can differ between systems
+# (e.g. glibc vs musl) and should not be checked.
+# See:
+sed '/normalized time:/s/ [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/ XX:XX:XX/' \
+    out2-t > out2 || framework_failure_
 compare exp2 out2 || fail=1


Niklas Hambüchen May 14, 2019, 1:38 p.m.
Hello Assaf,

thank you, your patch works well for me.

I've tested it on Ubuntu and NixOS, with both glibc and musl.

Niklas Hambüchen May 16, 2019, 5:52 p.m.
Hey Assaf,

will you submit your patch for inclusion, given that it works well?

Assaf Gordon June 13, 2019, 3:35 a.m.

On 2019-05-16 11:52 a.m., Niklas Hambüchen wrote:
> will you submit your patch for inclusion, given that it works well?

pushed here:

Niklas Hambüchen June 13, 2019, 12:58 p.m.
On 13/06/2019 5:35 AM, Assaf Gordon wrote:
> pushed here:

Awesome, thanks!