--- 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 ---