Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: segfault in strftime
- X-seq: zsh-users 14897
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: segfault in strftime
- Date: Fri, 26 Feb 2010 14:17:15 +0000
- In-reply-to: <2A337AAE-8D40-4796-A733-9E7F30FABFF8@xxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: CSR
- References: <A73C7D9C-66C5-4BFA-8FB3-8560FE65B529@xxxxxxxxxxx> <201002261303.o1QD3Sqq018901@xxxxxxxxxxxxxx> <2A337AAE-8D40-4796-A733-9E7F30FABFF8@xxxxxxxxxxx>
On Fri, 26 Feb 2010 14:59:09 +0100
Sebastian Stark <seb-zsh@xxxxxxxxxxx> wrote:
> I'm not used to produce or read backtraces, is the following helpful?
That's very interesting, thank you.
> Does it mean the problem is my libc?
No...
> #1 0x000000000049bb54 in ztrftime (buf=0x6feed0 "\001J!Î+", bufsize=158, fmt=0x2ba7cd751832 " %d.%m.%Y %H:%M:%S", tm=0x0)
^^^^^^
> at utils.c:2603
This is the interesting bit. localtime() dectected a value it couldn't
convert to a structure and returned NULL. It's allowed to do that if it
didn't like the value passed, though I'm not sure why it wouldn't. It
seems not all time_t's can be converted to times, a fact I was hitherto
unaware of.
Index: Src/Modules/datetime.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/datetime.c,v
retrieving revision 1.18
diff -p -u -r1.18 datetime.c
--- Src/Modules/datetime.c 9 Dec 2007 14:58:36 -0000 1.18
+++ Src/Modules/datetime.c 26 Feb 2010 14:08:55 -0000
@@ -121,6 +121,10 @@ bin_strftime(char *nam, char **argv, Opt
}
t = localtime(&secs);
+ if (!t) {
+ zwarnnam(nam, "%s: unable to convert to time", argv[1]);
+ return 1;
+ }
bufsize = strlen(argv[0]) * 8;
buffer = zalloc(bufsize);
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author