zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Axel Beckert <abe@deuxchevaux.org>
Cc: zsh-workers@zsh.org
Subject: Re: zsh 5.6.2-test-2
Date: Mon, 24 Dec 2018 01:38:42 -0600	[thread overview]
Message-ID: <C7926210-86FE-4626-9A93-4A387C315CC4@dana.is> (raw)
In-Reply-To: <20181224071421.GL1941@sym.noone.org>

On Mon, Dec 24, 2018 at 06:40:22AM +0100, Axel Beckert wrote:
>And I suspect 5ad76492af8931added1ae9600309d915d1427a5 (43800: Add
>nanosecond support to strftime built-in) to be the cause as the
>nanosecond test is the one which fails (on i386 at least).

Yes, it's my fault, i'm sorry.

The test is wrong — 10 ** 9 is too many nanoseconds. I must not have been
paying attention, and just went with it because the built-in took it anyway.
I think it should probably not do that, to account for clever people like me

dana


diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c
index 18c7fb58e..521c15a5b 100644
--- a/Src/Modules/datetime.c
+++ b/Src/Modules/datetime.c
@@ -148,7 +148,7 @@ output_strftime(char *nam, char **argv, Options ops, UNUSED(int func))
 	    } else if (*argv[2] == '\0' || *endptr != '\0') {
 		zwarnnam(nam, "%s: invalid decimal number", argv[2]);
 		return 1;
-	    } else if (ts.tv_nsec < 0) {
+	    } else if (ts.tv_nsec < 0 || ts.tv_nsec > 999999999) {
 		zwarnnam(nam, "%s: invalid nanosecond value", argv[2]);
 		return 1;
 	    }
diff --git a/Test/V09datetime.ztst b/Test/V09datetime.ztst
index 22d560750..da4dd4442 100644
--- a/Test/V09datetime.ztst
+++ b/Test/V09datetime.ztst
@@ -90,7 +90,7 @@
   strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322
   strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322 0
   strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322 2
-  strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322 $(( 222 * (10 ** 9) ))
+  strftime '%Y-%m-%d %H:%M:%S.%3.' 1012615322 $(( 222 * (10 ** 6) ))
 0:optional nanoseconds
 >2002-02-02 02:02:02.000
 >2002-02-02 02:02:02.000
@@ -103,6 +103,9 @@
   strftime '%Y' 1012615322 '' 2> /dev/null
 1:empty nanoseconds not allowed
 
+  strftime '%N' 1012615322 $(( 222 * (10 ** 9) )) 2> /dev/null
+1:too-large nanoseconds not allowed
+
   strftime '%N' 1012615322 ${(l<64><9>):-} 2> /dev/null
 1:overflowed nanoseconds not allowed
 


  reply	other threads:[~2018-12-24  7:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d7b0451f90bdfe61f48cc1361690180e07158900.camel@ntlworld.com>
     [not found] ` <b8851c3a50bd8bceba1961f2f764e1a6869481ac.camel@ntlworld.com>
2018-12-20 22:25   ` The big kre zsh bug report Martijn Dekker
2018-12-21  7:53     ` Bart Schaefer
2018-12-21  8:11       ` Fix for ${\var} oddity Bart Schaefer
2018-12-25 17:18       ` [PATCH] honour NO_UNSET when reading values in arithmetic expansion/commands Martijn Dekker
2018-12-25 20:44       ` 'wait' exit status and warnings [was: The big kre zsh bug report] Martijn Dekker
2018-12-30 18:13         ` Peter Stephenson
2019-01-21 22:53           ` Martijn Dekker
2018-12-31  2:08       ` Line continuation between $ and { " Martijn Dekker
2018-12-21 11:30     ` The big kre zsh bug report Robert Elz
2018-12-21 20:37       ` Bart Schaefer
2018-12-22  0:13       ` Robert Elz
2018-12-21  2:28   ` Robert Elz
2018-12-24  5:40 ` zsh 5.6.2-test-2 Axel Beckert
2018-12-24  7:14   ` Axel Beckert
2018-12-24  7:38     ` dana [this message]
2018-12-24  9:16       ` [PATCH] ztrftime(): Fix truncation for % dana
2018-12-24 12:45         ` Daniel Shahaf
2018-12-24 16:24           ` dana
2018-12-24 17:06             ` Daniel Shahaf
2018-12-24 17:31               ` dana
2018-12-28 22:16                 ` dana
2018-12-29  9:55                   ` Daniel Shahaf
2018-12-29 10:27                     ` Daniel Shahaf
2018-12-29 11:02                       ` dana
2018-12-29 11:08                         ` Daniel Shahaf
2018-12-29 11:30                           ` dana
2018-12-29 11:34                             ` Daniel Shahaf
2018-12-24 23:35           ` Joey Pabalinas
2018-12-24 23:30         ` Joey Pabalinas
     [not found] ` <CAKc7PVDUjo8HAdwqgRAKcgQHOzThM+hYnjX+2FKzUZB+pfmC-Q@mail.gmail.com>
     [not found]   ` <CAKc7PVB-agFUarJ=LqC2QNDFta1O5D_o4v-gt7LiobVDohNGVQ@mail.gmail.com>
     [not found]     ` <06228a6975b91f7066d0046bf912dd69fa5993a2.camel@ntlworld.com>
2018-12-31 13:44       ` zsh 4.6.2-test-2 dana
2018-12-31 15:19         ` Sebastian Gniazdowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C7926210-86FE-4626-9A93-4A387C315CC4@dana.is \
    --to=dana@dana.is \
    --cc=abe@deuxchevaux.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).