Bug 1503452 - timedatectl crashes if the length of the day name in the current locale is long
Summary: timedatectl crashes if the length of the day name in the current locale is long
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1503942
TreeView+ depends on / blocked
 
Reported: 2017-10-18 07:27 UTC by Hedayat Vatankhah
Modified: 2018-01-11 10:05 UTC (History)
11 users (show)

Fixed In Version: systemd-236-1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1503942 (view as bug list)
Environment:
Last Closed: 2018-01-11 10:05:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Hedayat Vatankhah 2017-10-18 07:27:23 UTC
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

Comment 1 Jan Synacek 2017-10-18 07:41:44 UTC
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.

Comment 2 Zbigniew Jędrzejewski-Szmek 2017-10-18 14:32:23 UTC
https://github.com/systemd/systemd/pull/7123

Comment 3 Jan Synacek 2017-10-19 06:59:27 UTC
Nice, thanks for the fast fix!


Note You need to log in before you can comment on or make changes to this bug.