public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/15346] New: getdate() doesn't ignore trailing whitespaces
@ 2013-04-08 12:28 siddhesh at redhat dot com
2013-04-10 6:03 ` [Bug libc/15346] " siddhesh at redhat dot com
2014-06-13 18:30 ` fweimer at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-08 12:28 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15346
Bug #: 15346
Summary: getdate() doesn't ignore trailing whitespaces
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: siddhesh@redhat.com
ReportedBy: siddhesh@redhat.com
CC: drepper.fsp@gmail.com
Classification: Unclassified
The POSIX description of getdate says that:
"Extra whitespace in either the template file or in string shall be ignored."
but it does not.
Steps to Reproduce:
$ cat > tfile
%M
^D
$ cat > date.c
#define _GNU_SOURCE 500
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
struct tm *tmp;
int j;
for (j = 1; j < argc; j++)
{
tmp = getdate (argv[j]);
if (tmp == NULL)
{
printf ("Call %d failed; getdate_err = %d\n", j, getdate_err);
continue;
}
printf ("Call %d (\"%s\") succeeded:\n", j, argv[j]);
printf (" tm_sec = %d\n", tmp->tm_sec);
printf (" tm_min = %d\n", tmp->tm_min);
printf (" tm_hour = %d\n", tmp->tm_hour);
printf (" tm_mday = %d\n", tmp->tm_mday);
printf (" tm_mon = %d\n", tmp->tm_mon);
printf (" tm_year = %d\n", tmp->tm_year);
printf (" tm_wday = %d\n", tmp->tm_wday);
printf (" tm_yday = %d\n", tmp->tm_yday);
printf (" tm_isdst = %d\n", tmp->tm_isdst);
}
exit (EXIT_SUCCESS);
}
^D
$ gcc date.c
$ DATEMSK=tfile ./a.out '1 '
Actual Result:
Call 1 failed; getdate_err = 7
Expected Result:
Call 1 ("1 ") succeeded:
tm_sec = 0
tm_min = 1
tm_hour = 0
tm_mday = 9
tm_mon = 3
tm_year = 113
tm_wday = 2
tm_yday = 98
tm_isdst = 0
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/15346] getdate() doesn't ignore trailing whitespaces
2013-04-08 12:28 [Bug libc/15346] New: getdate() doesn't ignore trailing whitespaces siddhesh at redhat dot com
@ 2013-04-10 6:03 ` siddhesh at redhat dot com
2014-06-13 18:30 ` fweimer at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-10 6:03 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15346
Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #1 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-04-10 06:03:53 UTC ---
Fixed in master:
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.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/15346] getdate() doesn't ignore trailing whitespaces
2013-04-08 12:28 [Bug libc/15346] New: getdate() doesn't ignore trailing whitespaces siddhesh at redhat dot com
2013-04-10 6:03 ` [Bug libc/15346] " siddhesh at redhat dot com
@ 2014-06-13 18:30 ` fweimer at redhat dot com
1 sibling, 0 replies; 3+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 18:30 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=15346
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-13 18:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-08 12:28 [Bug libc/15346] New: getdate() doesn't ignore trailing whitespaces siddhesh at redhat dot com
2013-04-10 6:03 ` [Bug libc/15346] " siddhesh at redhat dot com
2014-06-13 18:30 ` fweimer at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).