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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26261 in the body.
You can then email your comments to 26261 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#26261; Package guile. (Sun, 26 Mar 2017 02:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zefram <zefram <at> fysh.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 26 Mar 2017 02:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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




Information forwarded to bug-guile <at> gnu.org:
bug#26261; Package guile. (Mon, 27 Mar 2017 19:16:01 GMT) Full text and rfc822 format available.

Message #8 received at 26261 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Moss <andrewmoss <at> pobox.com>
To: 26261 <at> debbugs.gnu.org
Subject: RE: bug#26261: ~N mishandles small nanoseconds value
Date: Mon, 27 Mar 2017 12:06:10 -0400
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]
[0001-Fixed-bug-N-mishandles-small-nanoseconds-value.patch (text/x-patch, attachment)]

Reply sent to Andy Wingo <wingo <at> igalia.com>:
You have taken responsibility. (Wed, 19 Apr 2017 13:15:02 GMT) Full text and rfc822 format available.

Notification sent to Zefram <zefram <at> fysh.org>:
bug acknowledged by developer. (Wed, 19 Apr 2017 13:15:02 GMT) Full text and rfc822 format available.

Message #13 received at 26261-done <at> debbugs.gnu.org (full text, mbox):

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 18 May 2017 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 316 days ago.

Previous Next


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