Re: [patch] time_t printf in zsh

2016-02-21 Thread Jérémie Courrèges-Anglas
j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:

> Matthew Martin  writes:
>
>> zsh printf's a time_t as a long.  The cast is so that I can send the
>> same patch upstream (assuming that casting to long long is the correct
>> fix). Bug found with clang.
>
> It looks like zsh does not assume long long and %lld support, so more
> work might be needed for an upstream patch.
>
> However, ok jca@ to commit the patch below in the ports tree.

Here's a modified patch:

Index: Makefile
===
RCS file: /cvs/ports/shells/zsh/Makefile,v
retrieving revision 1.79
diff -u -p -r1.79 Makefile
--- Makefile21 Dec 2015 19:13:17 -  1.79
+++ Makefile21 Feb 2016 20:28:53 -
@@ -5,7 +5,7 @@ COMMENT=Z shell, Bourne shell-compatibl
 V= 5.2
 DISTNAME=  zsh-$V
 CATEGORIES=shells
-REVISION=  2
+REVISION=  3
 
 MAINTAINER=Pierre-Emmanuel Andre 
 
Index: patches/patch-Src_Builtins_sched_c
===
RCS file: patches/patch-Src_Builtins_sched_c
diff -N patches/patch-Src_Builtins_sched_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-Src_Builtins_sched_c  21 Feb 2016 20:28:53 -
@@ -0,0 +1,16 @@
+$OpenBSD$
+--- Src/Builtins/sched.c.orig  Thu Aug 20 21:59:47 2015
 Src/Builtins/sched.c   Sun Feb 21 21:03:19 2016
+@@ -353,7 +353,11 @@ schedgetfn(UNUSED(Param pm))
+   time_t t;
+ 
+   t = sch->time;
+-  sprintf(tbuf, "%ld", t);
++#if defined(PRINTF_HAS_LLD)
++  sprintf(tbuf, "%lld", (long long)t);
++#else
++  sprintf(tbuf, "%ld", (long)t);
++#endif
+   if (sch->flags & SCHEDFLAG_TRASH_ZLE)
+   flagstr = "-o";
+   else


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: [patch] time_t printf in zsh

2016-02-21 Thread Jérémie Courrèges-Anglas
Matthew Martin  writes:

> zsh printf's a time_t as a long.  The cast is so that I can send the
> same patch upstream (assuming that casting to long long is the correct
> fix). Bug found with clang.

It looks like zsh does not assume long long and %lld support, so more
work might be needed for an upstream patch.

However, ok jca@ to commit the patch below in the ports tree.

> - Matthew Martin
>
>
> Index: patches/patch-Src_Builtins_sched_c
> ===
> RCS file: patches/patch-Src_Builtins_sched_c
> diff -N patches/patch-Src_Builtins_sched_c
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-Src_Builtins_sched_c21 Feb 2016 01:23:00 -
> @@ -0,0 +1,12 @@
> +$OpenBSD$
> +--- Src/Builtins/sched.c.origFri Feb 19 19:38:11 2016
>  Src/Builtins/sched.c Sat Feb 20 11:06:55 2016
> +@@ -353,7 +353,7 @@ schedgetfn(UNUSED(Param pm))
> + time_t t;
> + 
> + t = sch->time;
> +-sprintf(tbuf, "%ld", t);
> ++sprintf(tbuf, "%lld", (long long) t);
> + if (sch->flags & SCHEDFLAG_TRASH_ZLE)
> + flagstr = "-o";
> + else
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



[patch] time_t printf in zsh

2016-02-20 Thread Matthew Martin
zsh printf's a time_t as a long.  The cast is so that I can send the
same patch upstream (assuming that casting to long long is the correct
fix). Bug found with clang.

- Matthew Martin


Index: patches/patch-Src_Builtins_sched_c
===
RCS file: patches/patch-Src_Builtins_sched_c
diff -N patches/patch-Src_Builtins_sched_c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-Src_Builtins_sched_c  21 Feb 2016 01:23:00 -
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- Src/Builtins/sched.c.orig  Fri Feb 19 19:38:11 2016
 Src/Builtins/sched.c   Sat Feb 20 11:06:55 2016
+@@ -353,7 +353,7 @@ schedgetfn(UNUSED(Param pm))
+   time_t t;
+ 
+   t = sch->time;
+-  sprintf(tbuf, "%ld", t);
++  sprintf(tbuf, "%lld", (long long) t);
+   if (sch->flags & SCHEDFLAG_TRASH_ZLE)
+   flagstr = "-o";
+   else