public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/842] New: getpid() not working with statically linking
@ 2005-04-12 11:27 egmont at uhulinux dot hu
  2005-04-12 11:28 ` [Bug nptl/842] " egmont at uhulinux dot hu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: egmont at uhulinux dot hu @ 2005-04-12 11:27 UTC (permalink / raw)
  To: glibc-bugs

I have a simple program (attached) that only performs a getpid() call and prints 
its return value. This works perfectly if I link it dynamically, but returns 
constant 5 if it's statically linked.

egmont $ gcc -Wall -O2 -o getpid getpid.c
egmont $ ./getpid ; ./getpid
4166
4167
egmont $ gcc -Wall -O2 -static -o getpid getpid.c
egmont $ ./getpid ; ./getpid
5
5

According to strace, the getpid() system call is not executed at all in the 
second case. So I have a feeling that perhaps the internal cache for the PID 
might remain uninitialized.

Details concerning glibc:

I tried and faced this bug with two different version, one is 20041021T0701 as 
found inside the Fedora Core 3 source RPM (but I did not use the Fedora binary, 
I recompiled their cvs snapshot source tarball, without using their additional 
tarballs or patches), the other version is the official 2.3.5 tarball. How I 
compiled:

rm -rf linuxthreads linuxthreads_db
cd /path/to/objectdir
/path/to/source/configure \
  --with-tls --enable-add-ons \
  --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
  --mandir=/usr/share/man --infodir=/usr/share/info \
  --enable-shared \
  --build=i586-uhu-linux --host=i586-uhu-linux
make user-defined-trusted-dirs=/usr/local/lib

So I have absolutely no sign of linuxthreads, only nptl, installed directly to
/lib (.so) and /usr/lib (.a). No subdirectory under /lib or /usr/lib that 
contains any libc-related files (that is, no subdirectory called i?86, tls, nptl 
or similar) exists. /usr/lib/libc.a is definitely nptl-version, an "nm" on it 
shows two __nptl_... symbols.

I have found several issues with getpid() on the net, including this bugzilla, 
all related to nptl, but all those I've found are said to be already fixed, 
however, this one is misbehaving for me right now.

On the other hand, the getppid() call always works perfectly for me.

Other details:

$ scripts/config.guess # from glibc's source
i686-pc-linux-gnu
$ uname -a
Linux bobek 2.6.9-19 #1 SMP Thu Jan 27 08:52:43 CET 2005 i686 unknown unknown 
UHU-Linux
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i586-uhu-linux/3.3.4/specs
Configured with: /var/uhubuild/work/compile/configure --prefix=/usr --infodir=/
usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,objc,java,f77,
pascal --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --
host=i586-uhu-linux
Thread model: posix
gcc version 3.3.4
$ ld -v
GNU ld version 2.15

-- 
           Summary: getpid() not working with statically linking
           Product: glibc
           Version: 2.3.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: egmont at uhulinux dot hu
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=842

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug nptl/842] getpid() not working with statically linking
  2005-04-12 11:27 [Bug nptl/842] New: getpid() not working with statically linking egmont at uhulinux dot hu
@ 2005-04-12 11:28 ` egmont at uhulinux dot hu
  2005-04-12 14:06 ` jakub at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: egmont at uhulinux dot hu @ 2005-04-12 11:28 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From egmont at uhulinux dot hu  2005-04-12 11:28 -------
Created an attachment (id=455)
 --> (http://sources.redhat.com/bugzilla/attachment.cgi?id=455&action=view)
test case: getpid.c


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=842

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug nptl/842] getpid() not working with statically linking
  2005-04-12 11:27 [Bug nptl/842] New: getpid() not working with statically linking egmont at uhulinux dot hu
  2005-04-12 11:28 ` [Bug nptl/842] " egmont at uhulinux dot hu
@ 2005-04-12 14:06 ` jakub at redhat dot com
  2005-09-26 14:37 ` drepper at redhat dot com
  2006-03-07 19:20 ` egmont at uhulinux dot hu
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at redhat dot com @ 2005-04-12 14:06 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2005-04-12 14:06 -------
Can't reproduce this, with glibc CVS (tried i686 and x86_64) nor
Fedora nptl-devel-2.3.4-2.fc3.4.

-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=842

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug nptl/842] getpid() not working with statically linking
  2005-04-12 11:27 [Bug nptl/842] New: getpid() not working with statically linking egmont at uhulinux dot hu
  2005-04-12 11:28 ` [Bug nptl/842] " egmont at uhulinux dot hu
  2005-04-12 14:06 ` jakub at redhat dot com
@ 2005-09-26 14:37 ` drepper at redhat dot com
  2006-03-07 19:20 ` egmont at uhulinux dot hu
  3 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2005-09-26 14:37 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2005-09-26 14:36 -------
Works just fine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


http://sourceware.org/bugzilla/show_bug.cgi?id=842

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug nptl/842] getpid() not working with statically linking
  2005-04-12 11:27 [Bug nptl/842] New: getpid() not working with statically linking egmont at uhulinux dot hu
                   ` (2 preceding siblings ...)
  2005-09-26 14:37 ` drepper at redhat dot com
@ 2006-03-07 19:20 ` egmont at uhulinux dot hu
  3 siblings, 0 replies; 5+ messages in thread
From: egmont at uhulinux dot hu @ 2006-03-07 19:20 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From egmont at uhulinux dot hu  2006-03-07 19:20 -------
It was still buggy for me with glibc-2.3.6 but now with 2.4 it's okay.
Thanks guys :)

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=842

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-03-07 19:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-12 11:27 [Bug nptl/842] New: getpid() not working with statically linking egmont at uhulinux dot hu
2005-04-12 11:28 ` [Bug nptl/842] " egmont at uhulinux dot hu
2005-04-12 14:06 ` jakub at redhat dot com
2005-09-26 14:37 ` drepper at redhat dot com
2006-03-07 19:20 ` egmont at uhulinux dot hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).