public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "siddhesh at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/15346] New: getdate() doesn't ignore trailing whitespaces
Date: Mon, 08 Apr 2013 12:28:00 -0000	[thread overview]
Message-ID: <bug-15346-131@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2013-04-08 12:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 12:28 siddhesh at redhat dot com [this message]
2013-04-10  6:03 ` [Bug libc/15346] " siddhesh at redhat dot com
2014-06-13 18:30 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-15346-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).