diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-06-20 15:00:07 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-06-20 15:18:58 +0200 |
commit | 7dad6de158cbc280988efa9e52e6d2b9c840ea9f (patch) | |
tree | 20e674bbcb2df3f87aef716a0af7fb5bead87fb7 /test | |
parent | rules: drop weird spaces (diff) | |
download | systemd-7dad6de158cbc280988efa9e52e6d2b9c840ea9f.tar.xz systemd-7dad6de158cbc280988efa9e52e6d2b9c840ea9f.zip |
hostnamed: when parsing day/month of firmware date, force decimal parsing
safe_atou() by default determines the base from the prefix 0x, 0b, 0o
and for compat with just 0 for octal. This is not what we want here,
since the date components are padded with zeroes yet still decimal.
Hence force decimal parsing (and while we are at it, prohibit a couple
of unexpected decorations).
WIthout this we'd fail to parse any the 8th and 9th day of each months, as
well aus aug and september of every year, because these look like octal
numbers but cannot actually parsed as such.
Let's change the testcase to check for a date that exposes this
bheaviour.
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-71.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/units/testsuite-71.sh b/test/units/testsuite-71.sh index 6f99ecadd8..9d84dd89ed 100755 --- a/test/units/testsuite-71.sh +++ b/test/units/testsuite-71.sh @@ -119,9 +119,9 @@ EOF mount -t tmpfs none /sys/class/dmi/id echo '1' >/sys/class/dmi/id/uevent - echo '01/01/2000' >/sys/class/dmi/id/bios_date + echo '09/08/2000' >/sys/class/dmi/id/bios_date systemctl stop systemd-hostnamed - assert_in '2000-01-01' "$(hostnamectl)" + assert_in '2000-09-08' "$(hostnamectl)" echo '2022' >/sys/class/dmi/id/bios_date systemctl stop systemd-hostnamed |