Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh 5.6.2-test-2
- X-seq: zsh-workers 43935
- From: dana <dana@xxxxxxx>
- To: Axel Beckert <abe@xxxxxxxxxxxxxxx>
- Subject: Re: zsh 5.6.2-test-2
- Date: Mon, 24 Dec 2018 01:38:42 -0600
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tZPf78boxlKpFZ6etzYuPCv0tUmdHBIMMwRc2myjmkg=; b=cmKMWZKkgaK59Yu34zPZai9xxVhQrU3jDA3Hg1fY/RibMLU4KgwzYmcqNpEUnXKsxm 0EJZS5lt69YrLoQRvnjr9gucW5bAqG/sQ9DJ6osM5J+BCmvTubvYVvzb/WOwSlkftZha 71h1R3vZ8l12otU3iM+wdn4dGvVmrx6zRIFm9WfhmgcHFjKd34+faoZ4vB27ovqP2BbV GdmR0IQquFWyrxAQDQzLkdFcqGq7jGqHKyLa9L5/k3Sveb8B3ORDrxue7roTiq9B4abz OX2xHgkYcqGF4Pwqp0eR2mc63JI0/6qiFlDAsWeEv/qPUKSX7POeRK40qesc86THGLkB QgQg==
- In-reply-to: <20181224071421.GL1941@sym.noone.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <d7b0451f90bdfe61f48cc1361690180e07158900.camel@ntlworld.com> <20181224054021.GK1941@sym.noone.org> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author