Bug 977875 - getdate() doesn't ignore trailing whitespaces
getdate() doesn't ignore trailing whitespaces
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
Unspecified Unspecified
high Severity medium
: ---
: ---
Assigned To: Siddhesh Poyarekar
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-06-25 09:55 EDT by Siddhesh Poyarekar
Modified: 2016-11-24 07:14 EST (History)
10 users (show)

See Also:
Fixed In Version: glibc-2.17-11.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 947350
Last Closed: 2013-06-29 14:06:05 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Siddhesh Poyarekar 2013-06-25 09:55:09 EDT
+++ 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@redhat.com>
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 13:31:30 EDT
glibc-2.17-11.fc19 has been submitted as an update for Fedora 19.
Comment 2 Fedora Update System 2013-06-26 13:09:57 EDT
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:
then log in and leave karma (feedback).
Comment 3 Fedora Update System 2013-06-29 14:06:05 EDT
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.

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