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

Bug#571754: marked as done (strftime("%c") crashes in (some) locations)



Your message dated Sun, 28 Feb 2010 16:14:10 +0100
with message-id <20100228151405.GD23464@ikki.ethgen.de>
and subject line Re: Bug#571754: strftime("%c") crashes in (some) locations
has caused the Debian Bug report #571754,
regarding strftime("%c") crashes in (some) locations
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
571754: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571754
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Package: libc6
Version: 2.10.2-6
Severity: normal
Tags: l10n

To see the bug, please compile and run the following small program:
- ---
#include <stdio.h>
#include <time.h>
#include <locale.h>

int main(int argc, char **argv)
{
   char time[255];
   struct tm *tm;

   setlocale(LC_ALL, "de_DE");
   tm = localtime(NULL);
   strftime(time, sizeof(time), "%c", tm);
   fprintf(stdout, "%s\n", time);
} // int main(int argc, char **argv...
- ---

The problem only happens with locale set (to de_DE, no other tested).
And only %c is broken.

- From the man page: "%c     The preferred date and time representation
for the current locale."

- -- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (800, 'unstable'), (700, 'stable'), (600, 'oldstable'), (60, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32.9
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1) (ignored: LC_ALL set to de_DE)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6 depends on:
ii  libc-bin                      2.10.2-6   Embedded GNU C Library: Binaries
ii  libgcc1                       1:4.4.3-3  GCC support library

Versions of packages libc6 recommends:
ii  libc6-i686                    2.10.2-6   GNU C Library: Shared libraries [i

Versions of packages libc6 suggests:
ii  debconf [debconf-2.0]         1.5.28     Debian configuration management sy
pn  glibc-doc                     <none>     (no description available)
ii  locales                       2.10.2-6   Embedded GNU C Library: National L

- -- debconf information:
* glibc/upgrade: true
* glibc/disable-screensaver:
  glibc/restart-failed:
* glibc/restart-services: exim4 cups cron atd

- -- 
Klaus Ethgen                            http://www.ethgen.de/
pub  2048R/D1A4EDE5 2000-02-26 Klaus Ethgen <Klaus@Ethgen.de>
Fingerprint: D7 67 71 C4 99 A6 D4 FE  EA 40 30 57 3C 88 26 2B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS4lyWp+OKpjRpO3lAQqGmAf8DIWQFSX54bN30XGnuhmN84YazJnNibP8
FWny1RB8nt0+zmgeN+sNX38ioCcWm1+NMpnY8QolUlncbXLyzKO6jIEUW2UC2iMq
jZofZ0ijgshS0+1rITt0rMaobW1It2ijTf/O5t8pJypdmB98Cfrh3QblB1nJD6lX
7t1/mvad7oYgWV9aIZeqTo3xi82DEmoHAo+FERhr5BngzhwvUR4spg8/LxrJcfED
B3Dtai8AJI5qyIwLHtdeZ/PJLUvW8v0d9vDBVRv8u4A6hmY6ULIg9esnDl1hqiJg
vSzlAGS4ohW67ktAcQHxrY5nquU1KE0LuLL9Q2bwo5lKdgcOKPdS8Q==
=Ku+2
-----END PGP SIGNATURE-----



--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Am So den 28. Feb 2010 um 15:51 schrieb Aurelien Jarno:
> > Thanks for this new example, I am now able to reproducible the problem,
> > I have therefore reopened the bug.
> > 
> 
> I am afraid the bug is again in your code. strftime() crashes because
> tm.tm_zone point to a non allocated memory zone. Initializing the struct
> tm with strptime() is not enough as it only update the structure, and it
> doesn't update this field.
> 
> The correct way to do it is to add the following line before the call to
> strptime():
>     memset(&tm, 0, sizeof(tm));
> Then it doesn't crash anymore.

Hmm... Yes, you seems to have right, I tested it. And now, after knowing
this I found the corresponding note in the man page about this. Gna.

But this field (tm.tm_zone) is not even mentioned in the man page. And
looking to the time.h this only happens if __USE_BSD is defined.

However, better to initialize it fully first.

> Ok to close the bug?

Yes. And sorry for the trouble.

Regards
   Klaus
- -- 
Klaus Ethgen                            http://www.ethgen.de/
pub  2048R/D1A4EDE5 2000-02-26 Klaus Ethgen <Klaus@Ethgen.de>
Fingerprint: D7 67 71 C4 99 A6 D4 FE  EA 40 30 57 3C 88 26 2B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS4qIPZ+OKpjRpO3lAQrHvgf/WRpxlTftTvgJvVbT6rh73VYn6mWudF/+
jixcK5vhS7TQNqFEQ35TWVZFzwnL/GzrXsDFTcBFiqd05o/XSM8snWdiRSsILtvk
EWRXE33P7ImqiBdqDYX/OMMWbMZFMZlhG0p5NMFaigxtAdygJWPJLu03Qj6y8eXF
PDOnCuHEjBHRAI783gAgkCY8Tc6NMpa7QqHx3t52TwGrWVvWd6NLMwtQUarfGVe7
pKjXXfmEME+ZnO/D9sPxF8HGgb2GTcfdFR3+Vv0PPjGz2M/FvXFitvMYILCEeJwo
61EZecYhuRZbaNJcCPFZ0qV1bWch52TS+BvxHVgIRyV8O4sh8Ud1kQ==
=MHZa
-----END PGP SIGNATURE-----


--- End Message ---

Reply to: