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

Bug#170984: marked as done (static linking to pthread causes segfault in ctime_r())



Your message dated Mon, 13 Jan 2003 15:19:44 +0900
with message-id <80ptr1tvun.wl@oris.opensource.jp>
and subject line Bug#170984: static linking to pthread causes segfault in ctime_r()
has caused the attached Bug report 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 I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 27 Nov 2002 20:50:37 +0000
>From mb@ndc.se Wed Nov 27 14:50:37 2002
Return-path: <mb@ndc.se>
Received: from mailc.telia.com [194.22.190.4] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 18H98m-0001Uz-00; Wed, 27 Nov 2002 14:50:37 -0600
Received: from there (h246n2fls34o836.telia.com [217.208.107.246])
	by mailc.telia.com (8.12.5/8.12.5) with SMTP id gARKoYRg001759
	for <submit@bugs.debian.org>; Wed, 27 Nov 2002 21:50:34 +0100 (CET)
X-Original-Recipient: <submit@bugs.debian.org>
Message-Id: <200211272050.gARKoYRg001759@mailc.telia.com>
Content-Type: text/plain;
  charset="iso-8859-1"
From: Mikael Bohman <mb@ndc.se>
To: submit@bugs.debian.org
Subject: static linking to pthread causes segfault in ctime_r()
Date: Wed, 27 Nov 2002 21:50:33 +0100
X-Mailer: KMail [version 1.3.2]
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Delivered-To: submit@bugs.debian.org
X-Spam-Status: No, hits=0.6 required=5.0
	tests=SPAM_PHRASE_00_01
	version=2.41
X-Spam-Level: 

Package: libc6-dev
Version: 2.3.1-5
Severity: normal

When the code below is compiled like so:

gcc  -W -Wall -D_REENTRANT -static -g tst.cpp -o tst -lpthread

the resulting executable causes a segfault. The backtrace looks like this:

mb@tyrone:~$ gdb test core.630
gdb: Symbol `emacs_ctlx_keymap' has different size in shared object, consider 
re-linking
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...
Core was generated by `./test'.
Program terminated with signal 11, Segmentation fault.
#0  0x0805f1dd in vfprintf ()
(gdb) bt
#0  0x0805f1dd in vfprintf ()
#1  0x0808be33 in vsprintf ()
#2  0x08081ac5 in sprintf ()
#3  0x0806b4ca in asctime_r ()
#4  0x08053a31 in ctime_r ()
#5  0x080481e8 in print_date () at test.c:20
#6  0x08048236 in print_message_function (ptr=0x809eab0) at test.c:32
#7  0x08048c0c in pthread_start_thread ()
(gdb)

If I compile without -static it works. If I comment out the call to ctime_r() 
it works. If I downgrade the libc6 packages it works with both static and 
dynamic linking.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <time.h>

void print_date(void)
{
    char timebuf[26]; /* This magic number is based on the ctime(3c) man page 
*/
    time_t secs = time(0);

    ctime_r (&secs, timebuf);
    printf("%s", timebuf);
}

void *print_message_function( void *ptr )
{
    char *message;
    message = (char *) ptr;
    printf("%s \n", message);

    sleep(1);

    print_date();

    pthread_exit(0);
}
  
int main()
{
    pthread_t thread1, thread2;
    char *message1 = "Thread 1";
    char *message2 = "Thread 2";
    int ret1, ret2;

    printf("Starting...\n");
    print_date();
    
    ret1 = pthread_create(&thread1, NULL, 
                          print_message_function, (void*) message1);
    ret2 = pthread_create(&thread2, NULL,
                          print_message_function, (void*) message2);

    pthread_join( thread1, NULL);
    pthread_join( thread2, NULL); 

    printf("Thread 1 returns: %d\n", ret1);
    printf("Thread 2 returns: %d\n", ret2);

    exit(0);
}

-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux tyrone 2.4.17 #1 Thu Jul 18 19:33:15 CEST 2002 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages libc6-dev depends on:
ii  libc6                         2.3.1-5    GNU C Library: Shared libraries 
an

---------------------------------------
Received: (at 170984-done) by bugs.debian.org; 13 Jan 2003 06:19:48 +0000
>From gotom@debian.or.jp Mon Jan 13 00:19:47 2003
Return-path: <gotom@debian.or.jp>
Received: from oris.opensource.jp (oris.opensource.gr.jp) [218.44.239.73] (postfix)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 18Xxwp-00081G-00; Mon, 13 Jan 2003 00:19:47 -0600
Received: from oris.opensource.jp (oris.opensource.jp [218.44.239.73])
	by oris.opensource.gr.jp (Postfix) with ESMTP
	id AFD5BC351C; Mon, 13 Jan 2003 15:19:44 +0900 (JST)
Date: Mon, 13 Jan 2003 15:19:44 +0900
Message-ID: <80ptr1tvun.wl@oris.opensource.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: "Mikael Bohman" <mikael.bohman@danahermotion.se>
Cc: "GOTO Masanori" <gotom@debian.or.jp>, 170984-done@bugs.debian.org
Subject: Re: Bug#170984: static linking to pthread causes segfault in ctime_r()
In-Reply-To: <54E6247013B5EE4FBE659456BC6A92340BA774@ndcnts8.ndc.se>
References: <54E6247013B5EE4FBE659456BC6A92340BA774@ndcnts8.ndc.se>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 170984-done@bugs.debian.org
X-Spam-Status: No, hits=-9.8 required=5.0
	tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_03_05,
	      USER_AGENT
	version=2.41
X-Spam-Level: 

Thanks for your checking :)
I close this bug.

Regards,
-- gotom

At Sun, 12 Jan 2003 19:39:33 +0100,
Mikael Bohman wrote:
> It works ok for me too with 2.3.1-9, you can close the bug.
> Thanks!
> /Micke
> 
> 	-----Original Message----- 
> 	From: GOTO Masanori [mailto:gotom@debian.or.jp] 
> 	Sent: Sat 2003-01-04 19:43 
> 	To: Mikael Bohman; 170984@bugs.debian.org 
> 	Cc: 
> 	Subject: Re: Bug#170984: static linking to pthread causes segfault in ctime_r()
> 	
> 	
> 
> 	At Wed, 27 Nov 2002 21:50:33 +0100,
> 	Mikael Bohman wrote:
> 	>
> 	> Package: libc6-dev
> 	> Version: 2.3.1-5
> 	> Severity: normal
> 	>
> 	> When the code below is compiled like so:
> 	>
> 	> gcc  -W -Wall -D_REENTRANT -static -g tst.cpp -o tst -lpthread
> 	>
> 	> the resulting executable causes a segfault. The backtrace looks like this:
> 	
> 	I tested it with 2.3.1-9, but it did not crash.
> 	You're still in trouble with this bug?
> 	Or, could I close this bug?



Reply to: