Bug 977875

Summary: getdate() doesn't ignore trailing whitespaces
Product: [Fedora] Fedora Reporter: Siddhesh Poyarekar <spoyarek>
Component: glibcAssignee: Siddhesh Poyarekar <spoyarek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: high    
Version: 19CC: codonell, fweimer, jakub, ksrot, law, mfranc, mnewsome, pfrankli, schwab, spoyarek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.17-11.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 947350 Environment:
Last Closed: 2013-06-29 18:06:05 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 Siddhesh Poyarekar 2013-06-25 13:55:09 UTC
+++ This bug was initially created as a clone of Bug #947350 +++

The requirement claims: "Extra whitespace in either the template file or in string shall be ignored."

Also, from the getdate manpage:

       The  matching  is done case insensitively.  Superfluous whitespace, 
       either in the pattern or in the string to be converted, is ignored.


But the getdate() exits with a failure when there is a trailing whitespace.

This is causing failure in LSB test suite.

The failing test case is using
  str = '       12          AM     '
with the pattern '%I %p' in the $DATEMSK file.

Can be reproduced easily when using example from 'man 3 getdate' and using data mentioned above.

I am curious whether there is a upstream bug report for that. The bug seems to be in glibc for ages, I have just tested it glibc-2.3.2 and the bug is there.

--- Additional comment from Siddhesh Poyarekar on 2013-05-15 09:31:56 EDT ---

Fixed upstream:

commit abe7f530bf5c741fe6f0658da7be59d8db168f7f
Author: Siddhesh Poyarekar <siddhesh>
Date:   Wed Apr 10 11:31:46 2013 +0530

    Accept leading and trailing spaces in getdate input string
    
    Fixes #15346.
    
    The POSIX description of getdate allows for extra spaces in the
    getdate input string.  __getdate_r uses strptime internally, which
    works fine with extra spaces between format strings (and hence within
    an input string) but not with leading and trailing spaces.  So we trim
    off the leading and trailing spaces before we pass it on to strptime.

Comment 1 Fedora Update System 2013-06-25 17:31:30 UTC
glibc-2.17-11.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/glibc-2.17-11.fc19

Comment 2 Fedora Update System 2013-06-26 17:09:57 UTC
Package glibc-2.17-11.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing glibc-2.17-11.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-11737/glibc-2.17-11.fc19
then log in and leave karma (feedback).

Comment 3 Fedora Update System 2013-06-29 18:06:05 UTC
glibc-2.17-11.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.