journalctl -o short-iso[-precise]: timezone as +02:00 instead of +0200#29134
journalctl -o short-iso[-precise]: timezone as +02:00 instead of +0200#29134bluca merged 2 commits intosystemd:mainfrom
Conversation
|
hmm is the old syntax incorrect? |
|
We don't parse it, and it's not part of the RFC3339 profile of ISO8601. I guess it is an ISO8601, sure. But it's extremely anti-user to have a format that, for no good reason, cannot be fed back to |
|
ok make sense. |
b91d3ed to
9705b89
Compare
|
@nabijaczleweli this just needs a rebase to fix merge conflicts (and re-test just in case) then looks ready |
9705b89 to
ce49e60
Compare
|
rebased |
ce49e60 to
0693e6b
Compare
| xsprintf(usec, "%06"PRI_USEC, display_ts->realtime % USEC_PER_SEC); | ||
| memcpy(buf + 20, usec, 6); | ||
| int8_t h = tm.tm_gmtoff / 60 / 60; | ||
| int8_t m = labs((tm.tm_gmtoff / 60) % 60); |
There was a problem hiding this comment.
hmm, where does the int8_t type come from? this is so weird, a signed byte? we have never used such a type, as when put in registers or in the stack is upgraded to int anyway.
moreover tm_gmtoff actually uses long as type, hence the artificially shorter width is just weird and smeels a lot like accidental loss of precision.
Quite frankly the compiler should warn assigning the result of a funciton like labs() that operates on long ints onto an int8_t...
There was a problem hiding this comment.
From stdint.h, like all the others. If I had a type that went [0, 60) I would've used it, but this uses int8_t because it's derived from voreutils vore-time which carries a generic version of date(1) %z, but there it's
std::int8_t hms[3];
hms[2] = std::abs(tm_gmtoff_for(tm, ts) % 60);
hms[1] = std::abs((tm_gmtoff_for(tm, ts) / 60) % 60);
hms[0] = tm_gmtoff_for(tm, ts) / 60 / 60;| /* No usec in strftime, need to append */ | ||
| if (mode == OUTPUT_SHORT_ISO_PRECISE) { | ||
| snprintf(buf + tail, ELEMENTSOF(buf) - tail, ".%06"PRI_USEC, display_ts->realtime % USEC_PER_SEC); | ||
| tail += 7; |
There was a problem hiding this comment.
hmm, this is a bit icky, if the buffer was too short, then you just jump into the void here...
should at least have an assert(ELEMENTS(buf) - tail >= 7) first
There was a problem hiding this comment.
yes and in the original if buf was smaller than 28 you also jumped into the void so
| memcpy(buf + 20, usec, 6); | ||
| int8_t h = tm.tm_gmtoff / 60 / 60; | ||
| int8_t m = labs((tm.tm_gmtoff / 60) % 60); | ||
| snprintf(buf + tail, ELEMENTSOF(buf) - tail, "%+03"PRId8":%02"PRId8, h, m); |
There was a problem hiding this comment.
so, this is going to be one character longer than before. This must be reflected in the definition of FORMAT_TIMESTAMP_MAX
There was a problem hiding this comment.
FORMAT_TIMESTAMP_MAX is
66 /* We assume a maximum timezone length of 6. TZNAME_MAX is not defined on Linux, but glibc internally initializes this
67 * to 6. Let's rely on that. */
68 #define FORMAT_TIMESTAMP_MAX (3U+1U+10U+1U+8U+1U+6U+1U+6U+1U)
69 #define FORMAT_TIMESTAMP_RELATIVE_MAX 256U
70 #define FORMAT_TIMESPAN_MAX 64U
which very helpfully both references some glibc-private macro and doesn't say which format it's describing, but that works out to 38 and "2023-09-08T17:20:47.560211+0200" is 31, so no it doesn't
|
this really should have a test |
|
|
When testing openshift/release#66397 - the pivot for the nodeimage to cs10 from cs9 seemed to work pretty well except one test which failed in the e2e with: ``` [sig-node] Managed cluster should verify that nodes have no unexpected reboots [Late] [Suite:openshift/conformance/parallel] ``` This test failed because the timestamp has changed to be more compliant with RFC339 (there was a PR in systemd about this a while back: systemd/systemd#29134). This PR fixes that test to also support this layout.
When testing openshift/release#66397 - the pivot for the nodeimage to cs10 from cs9 seemed to work pretty well except one test which failed in the e2e with: ``` [sig-node] Managed cluster should verify that nodes have no unexpected reboots [Late] [Suite:openshift/conformance/parallel] ``` This test failed because the timestamp has changed to be more compliant with RFC339 (there was a PR in systemd about this a while back: systemd/systemd#29134). This PR fixes that test to also support this layout.
Related to: systemd/systemd#26639 Related to: systemd/systemd#29134 Signed-off-by: Volker Theile <[email protected]>
When testing openshift/release#66397 - the pivot for the nodeimage to cs10 from cs9 seemed to work pretty well except one test which failed in the e2e with: ``` [sig-node] Managed cluster should verify that nodes have no unexpected reboots [Late] [Suite:openshift/conformance/parallel] ``` This test failed because the timestamp has changed to be more compliant with RFC339 (there was a PR in systemd about this a while back: systemd/systemd#29134). This PR fixes that test to also support this layout.
Before:
After:
Since now
Also, idk how --truncate-newline made it there, but it shouldn't have. Moved it out, but there's a better place in the list for it probably.