A bit of PG archeology uncovers an interesting Linux/Unix factoid - Mailing list pgsql-hackers

From Greg Stark
Subject A bit of PG archeology uncovers an interesting Linux/Unix factoid
Date
Msg-id CAM-w4HMLmCwxCyVfxbbrA=jOr=2VL=mrm8VsJHUv7LWYX7H6Fw@mail.gmail.com
Whole thread Raw
Responses Re: A bit of PG archeology uncovers an interesting Linux/Unix factoid
List pgsql-hackers
For reasons, I was trying to compile older versions of Postgres and
ran into a strange behaviour where system() worked normally but then
returned -1 with errno set to ECHILD. And surprisingly it looks like
we've seen this behaviour in the past but on a Solaris:

commit 07d4d36aae79cf2ac365e381ed3e7ce62dcfa783
Author: Tatsuo Ishii <ishii@postgresql.org>
Date:   Thu May 25 06:53:43 2000 +0000
   On solaris, createdb/dropdb fails because of strange behavior of system().   (it returns error with errno ECHILD
uponsuccessful completion of commands).   This fix ignores an error from system() if errno == ECHILD.
 

It looks like Linux now behaves similarly, in fact there's a Redhat
notice about this causing similar headaches in Oracle:
https://access.redhat.com/solutions/37218

So just in case anyone else wants to use system() in Postgres or
indeed any other Unix application that twiddles with the SIGCHILD
handler this is something to beware of. It's not entirely clear to me
that the mention of SA_NOCLDWAIT is the only way to get this
behaviour, at least one stackoverflow answer implied just setting
SIG_IGN was enough.

-- 
greg



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Re: Reusing abbreviated keys during second pass of ordered [set] aggregates
Next
From: Tom Lane
Date:
Subject: Re: xlc atomics