This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Core dump calling strptime()


On Nov 18 00:01, David Arnstein wrote:
> Here is a very short test program that causes a "core dump." Please 
> compile it using the command
> 	gcc -Wall testspt.c -o testspt
> 
> Run the resulting executable testspt.exe with no arguments. Core dump 
> ensues.
> 
> The attached file cygcheck.out is the output from the command
> 	cygcheck -s -v -r
> from the computer where I compiled and executed testspt.exe.
> 
> In case anyone cares, I get this problem when I compile and use 
> newsyslog in Cygwin. Newsyslog calls strptime() several times on the 
> same message string, trying to find a parsing method that it recognizes. 
> It is to be expected that strptime() will fail often, but it is NOT 
> reasonable to core dump, in my opinion.
> 
> File testspt.c:
> --------------
> #include <time.h>
> 
> int main (int argc, char* argv[])
> {
>     char* retval;
>     struct tm tms;
>     char message[] =
>         "INFO      Nov 17 09:31:01 [67284]: Initializing tinyproxy ...";
> 
>     retval = strptime (message, "%c", &tms);
> 
>     return 0;
> }

This is a newlib problem.  I've redirected to the newlib mailing list
and set the reply-to accordingly.

Newlib's strptime function doesn't implement the 'c' and the 'Z'(*)
format specifiers.  If it encounters one of the non-implemented format
specifiers it calls the abort() function which then results in the core
dump.

I guess patches are thoughtfully considered on the newlib list ;-)


Corinna


(*) Z?  I don't see this format specifier defined on Linux, nor in the
    SUSv3 man pages.  What's its job?


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]