Bug 2058964

Summary: glibc: strptime fails to parse date with %z suffix
Product: Red Hat Enterprise Linux 7 Reporter: Spongman <piersh>
Component: glibcAssignee: glibc team <glibc-bugzilla>
Status: CLOSED WONTFIX QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.9CC: ashankar, codonell, dj, fweimer, mnewsome, pfrankli, sipoyare
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---Flags: fweimer: needinfo? (piersh)
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-04 14:27:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Spongman 2022-02-27 09:29:02 UTC
$ cat a.c
#define _XOPEN_SOURCE
#include <stdio.h>
#include <time.h>

int main() {
    struct tm tm_ = {0};
    puts(strptime("20010203T040506Z", "%Y%m%dT%H%M%S%z", &tm_) ? "ok" : "error");
}

$ gcc a.c
$ ldd a.out
        linux-vdso.so.1 =>  (0x00007ffd09585000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fb67529a000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb675667000)
$ ls -l /lib64/libc.so.6
lrwxrwxrwx. 1 root root 12 Jun 21  2019 /lib64/libc.so.6 -> libc-2.17.so
$ ./a.out
error

this works on Debian 10.11 and Ubuntu 20.04

Comment 3 Florian Weimer 2022-02-27 14:34:49 UTC
Have you filed a customer support ticket for this issue?

  https://access.redhat.com/support/cases/

Thanks.

Red Hat Enterprise Linux 7 is in Maintenance Support 2 Phase:

  https://access.redhat.com/support/policy/updates/errata#Maintenance_Support_2_Phase

During this phase, only “Critical and Importantix impact Security Advisories (RHSAs) and selected (at Red Hat discretion) Urgent Priority Bug Fix Advisories (RHBAs)” are expected to be released, and this request for enhancement does not seem to fall under either category.


For context, this was fixed upstream in this commit:

commit 900f33e23eaa20c0587f5a191b632a606e7fba5d
Author: Vincent Bernat <Vincent.Bernat>
Date:   Thu Sep 17 09:55:04 2015 +0200

    time: in strptime(), make %z accept Z as a time zone [BZ #17886]
    
    In ISO 8601, the timezone can be 'Z' instead of using
    digits. 2014-08-17T12:33:12+0000 is often expressed as
    2014-08-17T12:33:12Z.

It made it into glibc 2.23, so it's not included in Red Hat Enterprise Linux 7, which is based on glibc 2.17.

Comment 5 Carlos O'Donell 2022-03-04 14:27:13 UTC
Red Hat Enterprise Linux 7 is in Maintenance Support 2 Phase and as such we are not considering moderate priority fixes.

Please consider Red Hat Enterprise Linux 8 since the bug is fixed in that release.

I'm marking this CLOSED/WONTFIX.