patch for glibc 2.3.6 system() hang?

Chris MacGregor
Fri Oct 5 18:44:00 GMT 2007

Hi.  We're encountering a problem with system() (the C runtime function 
to execute an external program via a shell) hanging.  We're using glibc 
2.3.6 and gcc 3.4.6, and seeing this on arm, mips, and i686.

Does anyone have a patch for this problem?  I've located a post by 
Ulrich Drepper implying that he applied a patch (in an unspecified 
location in the glibc, to an unspecified version/branch of glibc) that 
might fix this, circa 25 February 2007, and I'm continuing to search for 
that change.  However, I haven't found it yet, and I wonder if anyone 
else has already solved this.

It's most perplexing when this:

    system ("/bin/sync");

hangs in a threaded program.  (NPTL or linuxthreads - the i686 platform 
is NPTL, and the others (of necessity for our gcc/glibc versions, I 
think) are using linuxthreads.)

Don't hassle me about why we're doing the above instead of just calling 
the sync() system call - I didn't write this code, and even if we fix it 
there are much more appropriate uses elsewhere.  It's just that the 
failure of this one is so clearly egregious...  (I once found a place in 
the code where someone used 'system("/bin/rm -f ...")' instead of 
calling unlink().  Sigh.)


For unsubscribe information see

More information about the crossgcc mailing list