Bug#699483: libc6: ctime() returns a string with an embedded newline
Subject: libc6: ctime() returns a string with an embedded newline character
Package: libc6
Version: 2.11.3-3
Severity: minor
The function ctime() (sys/time.h) returns a string with an
embedded newline character.
Program to reproduce:
*********************
/* foo.c */
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
int main(int argc, char** argv) {
time_t now;
now = time(NULL);
/* V note there is no newline char */
printf("The date is %s",ctime(&now));
exit(EXIT_SUCCESS);
}
***********************
Expected Output:
*********************
$./foo
The date is Thu Jan 31 15:10:55 2013$
*********************
Note that the shell prompt should directly follow program output.
Observed Output:
**********************
$./foo
The date is Thu Jan 31 15:10:55 2013
$
**********************
Note that the shell prompt appears on the next line, indicating the presence
of a newline character.
-- System Information:
Debian Release: 6.0.5
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libc6 depends on:
ii libc-bin 2.11.3-3 Embedded GNU C Library: Binaries
ii libgcc1 1:4.4.5-8 GCC support library
Versions of packages libc6 recommends:
ii libc6-i686 2.11.3-3 Embedded GNU C Library: Shared lib
Versions of packages libc6 suggests:
ii debconf [debconf-2.0] 1.5.36.1 Debian configuration management sy
pn glibc-doc <none> (no description available)
ii locales 2.11.3-3 Embedded GNU C Library: National L
-- debconf information:
glibc/upgrade: true
glibc/restart-services:
glibc/disable-screensaver:
glibc/restart-failed:
Reply to: