Actions
Bug #14405
openksh93 builtin test for printf %T now always fails
Status:
New
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
Due date:
% Done:
0%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
While trying to test something, I was running through the ksh93 test suite and noticed the following failure from it:
test builtins begins at 2022-01-15+19:28:11 builtins.sh[320]: printf "%T" now test builtins failed at 2022-01-15+19:28:19 with exit code 1 [ 161 tests 1 error ] test builtins(C.UTF-8) begins at 2022-01-15+19:28:19 builtins.sh[320]: printf "%T" now test builtins(C.UTF-8) failed at 2022-01-15+19:28:28 with exit code 1 [ 161 tests 1 error ] test builtins(shcomp) begins at 2022-01-15+19:28:28 shcomp-builtins.ksh[320]: printf "%T" now test builtins(shcomp) failed at 2022-01-15+19:28:36 with exit code 1 [ 161 tests 1 error ]
If we look at the test, it has the following line in and of itself:
318 [[ $(printf '%T\n' now) == "$(date)" ]] || 319 [[ $(printf '%T\n' now) == "$(date)" ]] || 320 err_exit 'printf "%T" now'
However, if we look at the output of these two things, we'll see that they can never equal, no matter how fast we are:
u@h:w$ printf '%T\n' now; date Sat Jan 15 19:40:36 GMT 2022 Sat Jan 15 19:40:36 UTC 2022
While in the there's both LANG=C.UTF-8
and TZ=UTC
, it appears that ksh93 printf builtin prefers to think of it as GMT instead of UTC, leading to this always failing, even if you get within the same second.
No data to display
Actions