This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
popen/pclose bug in 2.1 with Linux 2.2.1?
- To: libc-hacker@cygnus.com
- Subject: popen/pclose bug in 2.1 with Linux 2.2.1?
- From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Date: 15 Feb 1999 19:09:25 +0100
Below is a bug report (PR libc/966+967) about pclose. I'm not sure if
this is really a bug, could somebody look into it, please?
Stracing the program and looking at libio/iopopen.c, I noticed that
iopopen.c uses vfork. Could this be the problem?
Andreas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: Juergen Heinzl <juergen@monocerus.demon.co.uk>
To: bugs@gnu.org
Subject: glibc-2.1 :: broken pclose() ?
Hello,
since I found nothing in the FAQ about that one ...
configuring man_db-2.3.10 tells me pclose() is broken with this version
of the library. With some really old programme I get this too ...
96 1 S 0:00 /sbin/restore
97 1 S 0:00 /bin/gunzip -c /var/archive/sun/cpio.22.mar.98.gz
102 1 S 0:00 /bin/gunzip -c /var/archive/mon/cpio.30.nov.98.gz
107 1 S 0:00 /bin/gunzip -c /var/archive/mon/cpio.08.feb.99.gz
109 1 S 0:00 /bin/gunzip -c /var/archive/sun/cpio.14.feb.99.gz
.. where restore call gunzip via popen() but only one at a time. All
instances of gunzip go away as soon as one leaves restore and the ones
above hang around after calling pclose(). I wrote it years ago and never
have had that effect, cannot tell for sure about 2.0.112 of the glibc
though.
With man_db the effect was an ESPIPE (Illegal seek) error and I yet try
to reproduce it within a smaller test programme.
The glibc is compiled with egcs-1.1.1 and binutils-2.9.1.0.18 with the
following flags ...
-Os -march=i686 -mcpu=i686 -malign-loops=2 -malign-jumps=2 \
-malign-functions=2 -fno-strength-reduce
.. on a Linux 2.2.1 machine.
If it is not a known problem I shall try to reproduce it with a smaller
programme. Using the ksh as /bin/sh yields the same result, so it might
not be a shell problem.
Thanks a lot,
Juergen
--
\ Real name : Jürgen Heinzl \ no flames /
\ EMail Private : juergen@monocerus.demon.co.uk \ send money instead /
\ Phone Private : +44 181-332 0750 \ /
From: Juergen Heinzl <juergen@monocerus.demon.co.uk>
To: bugs@gnu.org
Subject: glibc-2.1 :: broken pclose() ... short config code
>Unformatted:
Me again,
it was *very* late due to that, so forgive me 8-} ... here's the code
of the man_db configure script that fails ...
#include <stdio.h>
#include <sys/wait.h>
int
try_pclose (FILE *f, int expected)
{
int s;
s = pclose (f);
if (s != -1 && WIFEXITED (s))
return WEXITSTATUS (s) != expected;
else
return 1;
}
int
main (void)
{
FILE *f, *t;
int i, sf, st;
for (i = 0; i <= 1; ++i) {
f = popen ("false", "r");
sleep (1);
t = popen ("true", "r");
sleep (1);
if (i) {
st = try_pclose (t, 0);
sf = try_pclose (f, 1);
} else {
sf = try_pclose (f, 1);
st = try_pclose (t, 0);
}
if (sf || st) exit(1);
}
exit(0);
}
..
Cheers,
Juergen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de