public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14876] New: Support for strprime with %Z is inconsistent between doc and code
@ 2012-11-26  3:59 allachan at au1 dot ibm.com
  2012-11-26  4:15 ` [Bug libc/14876] " allachan at au1 dot ibm.com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: allachan at au1 dot ibm.com @ 2012-11-26  3:59 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14876

             Bug #: 14876
           Summary: Support for strprime with %Z is inconsistent between
                    doc and code
           Product: glibc
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: allachan@au1.ibm.com
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


In the documentation for strptime, it states for %Z: "The timezone name. Note:
Currently, this is not fully implemented. The format is recognized, input is
consumed but no field in tm is set."

This belies the reality found in the code since no input is consumed at all.

The code for %Z (this is in glibc 2.16) is:

    case 'Z':
        /* XXX How to handle this?  */
        break;

whereas a simple case such as %% has:

    if (*fmt != '%') {
        match_char (*fmt++, *rp++);
        continue;
    }

The rp variable is the pointer for the input string that is being processed.
You can see that it's incremented for %% but no change is made for %Z, hence
the string pointer will not be advanced.

This was actually discovered via a StackOverflow question at
http://stackoverflow.com/questions/13556260/c-c-strptime-does-not-parse-z-timezone-name
where the format string was " %A, %b %d, %X %Z %Y " and the time being parsed
was "Tuesday, Mar 06, 12:33:45 EET 2001".

Because the EET wasn't consumed by %Z, it was taken to be the year (the
following format specifier), and the parsing failed.

Now I'm not expecting %Z support to be added to the code (though it would be
nice) since I know how hard it may be and it's actually an extension to POSIX
anyway.

But I think we should at least either change the doco to fix the incorrect
statement, or disable %Z altogether until we can implement it properly.

-- 
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] 7+ messages in thread

end of thread, other threads:[~2014-06-13 10:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-26  3:59 [Bug libc/14876] New: Support for strprime with %Z is inconsistent between doc and code allachan at au1 dot ibm.com
2012-11-26  4:15 ` [Bug libc/14876] " allachan at au1 dot ibm.com
2012-11-26  4:19 ` allachan at au1 dot ibm.com
2012-11-26  9:47 ` [Bug libc/14876] Support for strptime " schwab@linux-m68k.org
2012-11-28  7:21 ` allachan at au1 dot ibm.com
2013-10-25 17:07 ` cvs-commit at gcc dot gnu.org
2014-06-13 10:11 ` 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).