This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/15346] New: getdate() doesn't ignore trailing whitespaces
- From: "siddhesh at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 08 Apr 2013 12:28:21 +0000
- Subject: [Bug libc/15346] New: getdate() doesn't ignore trailing whitespaces
- Auto-submitted: auto-generated
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.