GNU bug report logs - #26261
~N mishandles small nanoseconds value

Previous Next

Package: guile;

Reported by: Zefram <zefram <at> fysh.org>

Date: Sun, 26 Mar 2017 02:20:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> igalia.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Andy Wingo <wingo <at> igalia.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#26261: closed (~N mishandles small nanoseconds value)
Date: Wed, 19 Apr 2017 13:15:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 19 Apr 2017 15:14:01 +0200
with message-id <87h91ko7za.fsf <at> igalia.com>
and subject line Re: bug#26261: ~N mishandles small nanoseconds value
has caused the debbugs.gnu.org bug report #26261,
regarding ~N mishandles small nanoseconds value
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
26261: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26261
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Zefram <zefram <at> fysh.org>
To: bug-guile <at> gnu.org
Subject: ~N mishandles small nanoseconds value
Date: Sun, 26 Mar 2017 03:19:24 +0100
The ~N format specifier in SRFI-19's date->string is documented to show
the nanoseconds value, with zero padding.  The documentation explicates
further by showing as an example a string of nine zeroes.  In fact the
implementation only pads to seven digits, and so produces incorrect
output for and nanoseconds value in the range [0, 100000000):

scheme@(guile-user)> (use-modules (srfi srfi-19))
scheme@(guile-user)> (date->string (make-date 0 5 34 12 26 3 2017 0) "~N")
$1 = "0000000"
scheme@(guile-user)> (date->string (make-date 2 5 34 12 26 3 2017 0) "~N")
$2 = "0000002"
scheme@(guile-user)> (date->string (make-date 200 5 34 12 26 3 2017 0) "~N")
$3 = "0000200"
scheme@(guile-user)> (date->string (make-date 200000 5 34 12 26 3 2017 0) "~N")
$4 = "0200000"
scheme@(guile-user)> (date->string (make-date 99999999 5 34 12 26 3 2017 0) "~N")
$5 = "99999999"
scheme@(guile-user)> (date->string (make-date 200000000 5 34 12 26 3 2017 0) "~N")
$6 = "200000000"

The padding clearly has to be to the full nine digits.

-zefram


[Message part 3 (message/rfc822, inline)]
From: Andy Wingo <wingo <at> igalia.com>
To: Andrew Moss <andrewmoss <at> pobox.com>
Cc: 26261-done <at> debbugs.gnu.org
Subject: Re: bug#26261: ~N mishandles small nanoseconds value
Date: Wed, 19 Apr 2017 15:14:01 +0200
On Mon 27 Mar 2017 18:06, Andrew Moss <andrewmoss <at> pobox.com> writes:

> I believe I have fixed this bug, but I'm not sure if I put the test
> case in the right place within the file. Please see the attached
> patch.
>
> From e975f8ae8d494985a51faed5b15c5664a557e0e2 Mon Sep 17 00:00:00 2001
> From: Andrew Moss <andrewmoss <at> pobox.com>
> Date: Mon, 27 Mar 2017 11:58:29 -0400
> Subject: [PATCH] Fixed bug: ~N mishandles small nanoseconds value
>
> Fixes <http://bugs.gnu.org/26261>.
> Reported by Zefram <zefram <at> fysh.org>.
>
> * module/srfi/srfi-19.scm ("define directives"): N padding increased from 7 to 9
>
> * test-suite/tests/srfi-19.test ("date->string"): New test.

Applied.  Thank you very very much for the fix!

Andy


This bug report was last modified 8 years and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.