[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#417815: libc6: localtime dies with : tzfile.c:544: __tzfile_compute: Assertion `num_types == 1' failed



This one time, at band camp, Sven Luther said:
> 
>   The code yielding to this was of the kind of :
> 
>   struct tm tm;
>   time_t t;
>   t = time(NULL);
>   localtime (&t, &tm);
> 
> This is in a fr_FR.utf8 locale, on a powerpc box. The same code on an x86 box
> just segfaults without error message.

That doesn't even compile here:

#include <time.h>
#include <stdlib.h>

int main (void) {
  struct tm tm;
  time_t t;
  t = time(NULL);
  localtime (&t, &tm);
  exit(0);
}

steve@gashuffer:~$ gcc -Wall t.c
t.c: In function ‘main’:
t.c:8: error: too many arguments to function ‘localtime’
steve@gashuffer:~$ 

This code works fine, though:

#include <time.h>
#include <stdlib.h>

int main (void) {
  struct tm *tm;
  time_t t;
  t = time(NULL);
  tm = localtime (&t);
  exit(0);
}

steve@gashuffer:~$ gcc -Wall t.c
steve@gashuffer:~$ LC_ALL=fr_FR.utf8 ./a.out
steve@gashuffer:~$ 
-- 
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        sgran@debian.org |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature


Reply to: