Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: segfault in strftime



On 2010-02-26 13:08:48 +0100, Sebastian Stark wrote:
> I just found that zsh segfaults when I do this:
> 
>  zmodload zsh/datetime
>  strftime "%a %d.%m.%Y %H:%M:%S" 67768036191673200
> 
> while it doesn't for smaller numbers, like:
> 
>  strftime "%a %d.%m.%Y %H:%M:%S" 67768036191673199
> 
> It will print a negative year for this value though. Negative results are not a big problem I think, but a segfault could be.
> 
> I tried this with zsh-4.3.10 under linux-gnu-x86_64. Can anyone reproduce this?

I can reproduce this under Debian/unstable (zsh 4.3.10).

But under Mac OS X Tiger / PowerPC, with zsh 4.3.10:

strftime: 67768036191673199: result too large

probably because it is only 32 bits. But it seems that a large
positive integer can be regarded as negative:

$ strftime "%a %d.%m.%Y %H:%M:%S" 2776803611
Tue 22.11.1921 15:51:55

Also, it seems to have a problem with -1:

Under Mac OS X:

$ strftime "%a %d.%m.%Y %H:%M:%S" -2
Thu 01.01.1970 00:59:58
$ strftime "%a %d.%m.%Y %H:%M:%S" -1
strftime: -1: unknown error: 0

Under Linux/x86_64 (Debian/unstable):

$ strftime "%a %d.%m.%Y %H:%M:%S" -2
Thu 01.01.1970 00:59:58
$ strftime "%a %d.%m.%Y %H:%M:%S" -1
strftime: -1: success

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)



Messages sorted by: Reverse Date, Date, Thread, Author