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

libc/locale bug in strftime()?

[I'd submit this as a bug report, but I'm not sure which package has the
bug, or even if it is Debian-specific.]

[I posted about this a week ago to comp.os.linux.development.system; no one
replied. Later I got a chance to test it on a Slackware system (with libc
5.2.something, I think), and the bug wasn't there...]

I think I found a bug in libc 5.4.20. The strftime() function dumps core
when called with "%b" or "%B" in the format string (to get month names). But
if I compile the program statically, it works, strangely enough. The bug is
reproducible. Here's a transcript:

{anar}rjs:~/t$ cat k.c
#include <stdio.h>
#include <time.h>

  char s[32];
  struct tm tm;

{anar}rjs:~/t$ gcc -o k k.c
{anar}rjs:~/t$ ls -l k.c k
-rwxr-xr-x   1 rjs      rjs          4121 Feb 12 00:05 k
-rw-r--r--   1 rjs      rjs           160 Feb 12 00:04 k.c
{anar}rjs:~/t$ ./k
Segmentation fault (core dumped)
{anar}rjs:~/t$ ls -l k.c k core
-rw-------   1 rjs      rjs        258048 Feb 12 00:05 core
-rwxr-xr-x   1 rjs      rjs          4121 Feb 12 00:05 k
-rw-r--r--   1 rjs      rjs           160 Feb 12 00:04 k.c
{anar}rjs:~/t$ gcc -static -o k k.c
{anar}rjs:~/t$ ./k

My system is a Debian 1.2.6 installation with libc 5.4.20, gcc,
Linux kernel 2.0.27 (kernel compiled by me, nothing very special; libc and
gcc are from Debian, libc5_5.4.20-1 and gcc_2.7.2.1-4), running on a
Pentium-100. My locale settings are as installed by Debian (no LOCALE or
LANG environment variables set).

Can someone else try the above code to see if it happens on Debian in
general or only my system? Can someone fix the bug? :)

-=- Rjs -=- rjs@spider.compart.fi, rjs@lloke.dna.fi

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com

Reply to: