Red Hat Bugzilla – Bug 977875
getdate() doesn't ignore trailing whitespaces
Last modified: 2016-11-24 07:14:04 EST
+++ 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 ---
Author: Siddhesh Poyarekar <firstname.lastname@example.org>
Date: Wed Apr 10 11:31:46 2013 +0530
Accept leading and trailing spaces in getdate input string
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.
glibc-2.17-11.fc19 has been submitted as an update for Fedora 19.
* 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).
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.