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

* [Bug libc/14876] Support for strprime with %Z is inconsistent between doc and code
  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 ` allachan at au1 dot ibm.com
  2012-11-26  4:19 ` allachan at au1 dot ibm.com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: allachan at au1 dot ibm.com @ 2012-11-26  4:15 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from paxdiablo <allachan at au1 dot ibm.com> 2012-11-26 04:15:15 UTC ---
Actually, there's one possibility for consuming the input I thought I'd
mention.

If we're certain the timezone won't have spaces in it, we could just consume
everything up to the next whitespace.

You still won't get a timezone indicator in your struct tm but at least it:

(1) would agree with the doco; and

(2) would successfully parse strings of the correct format without an error.

Now there may be some reason why that won't work, but I can't think of one off
the top of my head. No doubt someone more familiar with the codebase will let
me know if I'm indulging in verbal diarrhoea.

-- 
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

* [Bug libc/14876] Support for strprime with %Z is inconsistent between doc and code
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: allachan at au1 dot ibm.com @ 2012-11-26  4:19 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from paxdiablo <allachan at au1 dot ibm.com> 2012-11-26 04:19:04 UTC ---
I've also just noticed that the code I had in the original comment for %%
actually is for any character that's not a format specifier.

The code for %% was actually:

    case '%':
        /* Match the `%' character itself.  */
        match_char ('%', *rp++);
        break;

but the concept still stands, re the advancement of the rp pointer.

I'll shut up now.

-- 
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

* [Bug libc/14876] Support for strptime with %Z is inconsistent between doc and code
  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 ` schwab@linux-m68k.org
  2012-11-28  7:21 ` allachan at au1 dot ibm.com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2012-11-26  9:47 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Support for strprime with   |Support for strptime with
                   |%Z is inconsistent between  |%Z is inconsistent between
                   |doc and code                |doc and code

-- 
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

* [Bug libc/14876] Support for strptime with %Z is inconsistent between doc and code
  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
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: allachan at au1 dot ibm.com @ 2012-11-28  7:21 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from paxdiablo <allachan at au1 dot ibm.com> 2012-11-28 07:20:47 UTC ---
FWIW, the following code may do the job:

    case 'Z':
        while (ISSPACE(*rp))
            rp++;
        while (!ISSPACE(*rp) && (*rp != '\0'))
            rp++;
        break;

-- 
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

* [Bug libc/14876] Support for strptime with %Z is inconsistent between doc and code
  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
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-10-25 17:07 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
       via  ddc7e412ab252e7360a4357664beb3b5d9c4f42b (commit)
      from  ca42d35ea1a4b69b11a3b9a3e3bd1390470d188f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ddc7e412ab252e7360a4357664beb3b5d9c4f42b

commit ddc7e412ab252e7360a4357664beb3b5d9c4f42b
Author: Ondřej Bílka <neleai@seznam.cz>
Date:   Fri Oct 25 19:04:47 2013 +0200

    Make strptime %Z consistent between doc and code. Fixes bug 14876

-----------------------------------------------------------------------

Summary of changes:
 NEWS                |   14 +++++++-------
 time/strptime_l.c   |    6 +++++-
 time/tst-strptime.c |    1 +
 3 files changed, 13 insertions(+), 8 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From glibc-bugs-return-19974-listarch-glibc-bugs=sources.redhat.com@sourceware.org Fri Oct 25 17:08:09 2013
Return-Path: <glibc-bugs-return-19974-listarch-glibc-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-glibc-bugs@sources.redhat.com
Received: (qmail 17324 invoked by alias); 25 Oct 2013 17:08:09 -0000
Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <glibc-bugs.sourceware.org>
List-Subscribe: <mailto:glibc-bugs-subscribe@sourceware.org>
List-Post: <mailto:glibc-bugs@sourceware.org>
List-Help: <mailto:glibc-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: glibc-bugs-owner@sourceware.org
Delivered-To: mailing list glibc-bugs@sourceware.org
Received: (qmail 17287 invoked by uid 48); 25 Oct 2013 17:08:05 -0000
From: "neleai at seznam dot cz" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/14876] Support for strptime with %Z is inconsistent between doc and code
Date: Fri, 25 Oct 2013 17:08:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: glibc
X-Bugzilla-Component: libc
X-Bugzilla-Version: 2.16
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: neleai at seznam dot cz
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cc resolution
Message-ID: <bug-14876-131-XNpxNKfZ6Z@http.sourceware.org/bugzilla/>
In-Reply-To: <bug-14876-131@http.sourceware.org/bugzilla/>
References: <bug-14876-131@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-10/txt/msg00333.txt.bz2
Content-length: 571

https://sourceware.org/bugzilla/show_bug.cgi?id\x14876

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |neleai at seznam dot cz
         Resolution|---                         |FIXED

--- Comment #5 from Ondrej Bilka <neleai at seznam dot cz> ---
Fixed

--
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libc/14876] Support for strptime with %Z is inconsistent between doc and code
  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
                   ` (4 preceding siblings ...)
  2013-10-25 17:07 ` cvs-commit at gcc dot gnu.org
@ 2014-06-13 10:11 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 10:11 UTC (permalink / raw)
  To: glibc-bugs

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

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] 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).