Red Hat Bugzilla – Bug 1503942
timedatectl crashes if the length of the day name in the current locale is long
Last modified: 2018-04-10 07:25:16 EDT
+++ This bug was initially created as a clone of Bug #1503452 +++ Description of problem: Crash in the last command: % export LANG=en_US.UTF-8 [hedayat@hv ~]% date Wed Oct 18 10:54:07 +0330 2017 [hedayat@hv ~]% timedatectl Local time: Wed 2017-10-18 11:24:10 +0400 Universal time: Wed 2017-10-18 07:24:10 UTC RTC time: Wed 2017-10-18 07:24:10 Time zone: Asia/Folan (+0400, +0400) Network time on: yes NTP synchronized: yes RTC in local TZ: no [hedayat@hv ~]% [hedayat@hv ~]% export LANG=fa_IR.UTF-8 [hedayat@hv ~]% date چهارشنبه ۱۸ اكتبر ۱۷، ساعت ۱۰:۵۴:۲۴ (+0330) [hedayat@hv ~]% timedatectl Assertion 'xstrftime: a[] must be big enough' failed at ../src/timedate/timedatectl.c:105, function print_status_info(). Aborting. zsh: abort (core dumped) timedatectl Version-Release number of selected component (if applicable): systemd-234-8.fc27.x86_64 How reproducible: Depends on the current day of week. Happens on Wednesdays & Thursdays in fa_IR locale --- Additional comment from Jan Synacek on 2017-10-18 09:41:44 CEST --- src/basic/time-util.h:75:#define FORMAT_TIMESTAMP_MAX (3+1+10+1+8+1+6+1+6+1) src/timedate/timedatectl.c:75: char a[FORMAT_TIMESTAMP_MAX]; src/timedate/timedatectl.c:105 xstrftime(a, "%a %Y-%m-%d %H:%M:%S %Z", localtime_r(&sec, &tm)); It seems that the maximum format length assumption only holds for non-wide/variable encoded characters. --- Additional comment from Zbigniew Jędrzejewski-Szmek on 2017-10-18 16:32:23 CEST --- https://github.com/systemd/systemd/pull/7123
Note that using the same reproducer as in the original bug report didn't reproduce the problem for me. It should be fixed anyway, as the assumption in the code is simply wrong.
https://github.com/lnykryn/systemd-rhel/pull/165
fix merged to staging branch -> https://github.com/lnykryn/systemd-rhel/pull/165 -> post
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:0711