On Thu, May 09, 2019 at 08:38:43PM +0200, Ingo Schwarze wrote:
> Hi,
>
> Theo de Raadt wrote on Sun, Mar 24, 2019 at 12:48:03PM -0600:
> > Hiltjo Posthuma <[email protected]> wrote:
> >> On Sun, Feb 24, 2019 at 01:11:39PM +0100, Hiltjo Posthuma wrote:
>
> >>> 2. The military/nautical UTC offsets are [...]
>
> broken by design.
>
> >> As discussed previously for point 2 I think it is fine to either
> >> return NULL and not handle military zones like most libc's do
>
> > My position is we should delete support.
>
> So here is a diff to delete support for the military time zones.
> Just error out when encountering them. That's the best thing we
> can do because their meaning is ill-defined in the first place.
>
> I'm not mixing anything else into this diff. The other bugs should
> be handled separately.
>
> OK?
> Ingo
>
>
> Index: strptime.3
> ===================================================================
> RCS file: /cvs/src/lib/libc/time/strptime.3,v
> retrieving revision 1.27
> diff -u -p -r1.27 strptime.3
> --- strptime.3 21 Feb 2019 19:10:32 -0000 1.27
> +++ strptime.3 9 May 2019 18:29:19 -0000
> @@ -242,15 +242,7 @@ time
> or
> .Ql Standard
> .Pq Dq S
> -time;
> -a single letter military timezone specified as:
> -.Dq A
> -through
> -.Dq I
> -and
> -.Dq K
> -through
> -.Dq Y .
> +time.
> .It Cm \&%Z
> timezone name or no characters when timezone information is unavailable.
> .It Cm \&%%
> Index: strptime.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/time/strptime.c,v
> retrieving revision 1.25
> diff -u -p -r1.25 strptime.c
> --- strptime.c 21 Feb 2019 19:10:32 -0000 1.25
> +++ strptime.c 9 May 2019 18:29:19 -0000
> @@ -520,25 +520,6 @@ literal:
> bp = ep;
> continue;
> }
> -
> - if ((*bp >= 'A' && *bp <= 'I') ||
> - (*bp >= 'L' && *bp <= 'Y')) {
> -#ifdef TM_GMTOFF
> - /* Argh! No 'J'! */
> - if (*bp >= 'A' && *bp <= 'I')
> - tm->TM_GMTOFF =
> - ('A' - 1) - (int)*bp;
> - else if (*bp >= 'L' && *bp <= 'M')
> - tm->TM_GMTOFF = 'A' - (int)*bp;
> - else if (*bp >= 'N' && *bp <= 'Y')
> - tm->TM_GMTOFF = (int)*bp - 'M';
> -#endif
> -#ifdef TM_ZONE
> - tm->TM_ZONE = NULL; /* XXX */
> -#endif
> - bp++;
> - continue;
> - }
> return NULL;
> }
> offs = 0;
>
Hi,
This looks good to me. There is also a comment which could be removed or
changed:
@@ -464,9 +464,6 @@ literal:
* C[DS]T = Central : -5 | -6
* M[DS]T = Mountain: -6 | -7
* P[DS]T = Pacific : -7 | -8
- * Military
- * [A-IL-M] = -1 ... -9 (J not used)
- * [N-Y] = +1 ... +12
*/
while (isspace(*bp))
bp++;
--
Kind regards,
Hiltjo