This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PING][PATCH v1.1][BZ #4772] Allow strptime read outputs from strftime.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 5 Nov 2013 15:22:26 +0100
- Subject: Re: [PING][PATCH v1.1][BZ #4772] Allow strptime read outputs from strftime.
- Authentication-results: sourceware.org; auth=none
- References: <20131016084143 dot GA7305 at domone dot podge> <Pine dot LNX dot 4 dot 64 dot 1310161210280 dot 10873 at digraph dot polyomino dot org dot uk> <20131016153632 dot GA16052 at domone dot podge> <20131023131559 dot GA6107 at domone dot podge> <20131030153254 dot GA16807 at domone dot podge>
Ping,
I noticed that I ommited to mention testcase, here is corrected
changelog.
[BZ #4772]
* time/strptime_l.c: Allow modifiers in strptime.
* time/tst-strptime.c: Add testcase.
On Wed, Oct 30, 2013 at 04:32:54PM +0100, OndÅej BÃlka wrote:
>
> ping
> On Wed, Oct 23, 2013 at 03:15:59PM +0200, OndÅej BÃlka wrote:
> > ping
> > On Wed, Oct 16, 2013 at 05:36:32PM +0200, OndÅej BÃlka wrote:
> > > On Wed, Oct 16, 2013 at 12:12:48PM +0000, Joseph S. Myers wrote:
> > > > On Wed, 16 Oct 2013, Ondrej Bilka wrote:
> > > >
> > > > > Another simple bug that was left for five years. A problem is that a
> > > > > strptime does not parse modifiers. It contain a simple patch to fix that
> > > > > issue.
> > > > >
> > > > > In meantime a identical functionality was added for recursive calls so
> > > > > this patch just enables this uncoditionally.
> > > >
> > > > Patch should include a new testcase unless there's something making it
> > > > hard to add one to the testsuite. That applies to most patches fixing
> > > > user-visible bugs.
> > > >
> > > Here is version with test.
> > >
> > >
> > > [BZ #4772]
> > > * time/strptime_l.c: Allow modifiers in strptime.
> > >
> > > diff --git a/time/strptime_l.c b/time/strptime_l.c
> > > index 00fc1ef..395532d 100644
> > > --- a/time/strptime_l.c
> > > +++ b/time/strptime_l.c
> > > @@ -320,17 +320,14 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
> > > }
> > >
> > > ++fmt;
> > > - if (statep != NULL)
> > > - {
> > > - /* In recursive calls silently discard strftime modifiers. */
> > > - while (*fmt == '-' || *fmt == '_' || *fmt == '0'
> > > - || *fmt == '^' || *fmt == '#')
> > > - ++fmt;
> > > -
> > > - /* And field width. */
> > > - while (*fmt >= '0' && *fmt <= '9')
> > > - ++fmt;
> > > - }
> > > + /* We discard strftime modifiers. */
> > > + while (*fmt == '-' || *fmt == '_' || *fmt == '0'
> > > + || *fmt == '^' || *fmt == '#')
> > > + ++fmt;
> > > +
> > > + /* And field width. */
> > > + while (*fmt >= '0' && *fmt <= '9')
> > > + ++fmt;
> > >
> > > #ifndef _NL_CURRENT
> > > /* We need this for handling the `E' modifier. */
> > > diff --git a/time/tst-strptime.c b/time/tst-strptime.c
> > > index 21fbb63..354d3e6 100644
> > > --- a/time/tst-strptime.c
> > > +++ b/time/tst-strptime.c
> > > @@ -41,6 +41,7 @@ static const struct
> > > { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 },
> > > { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 },
> > > { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 },
> > > + { "C", "2001 21 Mon", "%2000Y %W %a", 1, 140, 4, 21 },
> > > { "C", "2012 00 Sun", "%Y %W %a", 0, 0, 0, 1 },
> > > { "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p",
> > > 6, 0, 0, 1 },
> >
> > --
> >
> > I'd love to help you -- it's just that the Boss won't let me near the computer.
>
> --
>
> Too many little pins on CPU confusing it, bend back and forth until 10-20% are neatly removed. Do _not_ leave metal bits visible!
--
The keyboard isn't plugged in