Re: [PATCH] libc: fix signal handling in system()

2012-01-23 Thread Mike Frysinger
On Friday 20 January 2012 07:57:28 Richard Braun wrote: > On Tue, Jan 17, 2012 at 10:33:10AM +0100, Richard Braun wrote: > > When built without NPTL support (or for a sparc target), the system() > > function doesn't conform to its specification. Namely, it uses signal() > > to install/save/restore

Re: [PATCH] libc: fix signal handling in system()

2012-01-20 Thread Richard Braun
On Tue, Jan 17, 2012 at 10:33:10AM +0100, Richard Braun wrote: > When built without NPTL support (or for a sparc target), the system() > function doesn't conform to its specification. Namely, it uses signal() > to install/save/restore signal handlers, which may break applications > using custom han

Re: [PATCH] libc: fix signal handling in system()

2012-01-17 Thread Rich Felker
On Tue, Jan 17, 2012 at 07:51:12AM +0100, Richard Braun wrote: > On Tue, Jan 17, 2012 at 03:03:19AM +0100, Laurent Bercot wrote: > > Yes, and that's not a problem. system() is a horrible interface > > anyway, if only because of the automatic shell invocation and > > parsing; no self-respecting Uni

[PATCH] libc: fix signal handling in system()

2012-01-17 Thread Richard Braun
When built without NPTL support (or for a sparc target), the system() function doesn't conform to its specification. Namely, it uses signal() to install/save/restore signal handlers, which may break applications using custom handlers installed with sigaction(). In addition, it resets the SIGCHLD ha

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Richard Braun
On Tue, Jan 17, 2012 at 03:03:19AM +0100, Laurent Bercot wrote: > Yes, and that's not a problem. system() is a horrible interface > anyway, if only because of the automatic shell invocation and > parsing; no self-respecting Unix programmer should ever use it. > system() needs to be implemented for

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Mike Frysinger
On Tuesday 17 January 2012 01:38:57 Richard Braun wrote: > On Mon, Jan 16, 2012 at 10:52:58PM -0500, Mike Frysinger wrote: > > this leaves the other fields of sigaction uninitialized. i think we need: > > if (command == 0) > > return 1; > > > > + memset(&sa, 0, sizeof(sa)); > >

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Richard Braun
On Mon, Jan 16, 2012 at 10:52:58PM -0500, Mike Frysinger wrote: > this leaves the other fields of sigaction uninitialized. i think we need: > > if (command == 0) > return 1; > > + memset(&sa, 0, sizeof(sa)); > sa.sa_handler = SIG_IGN; > sigemptyset(&sa.sa_mas

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Mike Frysinger
On Monday 16 January 2012 04:54:52 Richard Braun wrote: > --- a/libc/stdlib/system.c > +++ b/libc/stdlib/system.c > > + sa.sa_handler = SIG_IGN; > + sigemptyset(&sa.sa_mask); > + sa.sa_flags = 0; this leaves the other fields of sigaction uninitialized. i think we need: if (c

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Laurent Bercot
> it also means system() is completely unsafe to use in multi-threaded > programs that handle SIGCHLD... Yes, and that's not a problem. system() is a horrible interface anyway, if only because of the automatic shell invocation and parsing; no self-respecting Unix programmer should ever use it. sy

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Mike Frysinger
On Monday 16 January 2012 14:58:25 Rich Felker wrote: > OK, I'm dyslexic or something and somehow permuted the signal names > every time I read it. Sorry. I think your approach probably works, but > it also means system() is completely unsafe to use in multi-threaded > programs that handle SIGCHLD.

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Rich Felker
On Mon, Jan 16, 2012 at 07:05:23PM +0100, Richard Braun wrote: > On Mon, Jan 16, 2012 at 09:54:24AM -0500, Rich Felker wrote: > > This is the THIRD time I've told you that blocking SIGCHLD rather than > > ignoring it is non-conformant, and I provided the relevant citation > > (link and quoted): > >

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Richard Braun
On Mon, Jan 16, 2012 at 09:54:24AM -0500, Rich Felker wrote: > This is the THIRD time I've told you that blocking SIGCHLD rather than > ignoring it is non-conformant, and I provided the relevant citation > (link and quoted): > > The system() function shall ignore the SIGINT and SIGQUIT signals

Re: [PATCH] libc: fix signal handling in system()

2012-01-16 Thread Rich Felker
On Mon, Jan 16, 2012 at 10:54:52AM +0100, Richard Braun wrote: > When built without NPTL support (or for a sparc target), the system() > function doesn't conform to its specification. Namely, it uses signal() > to install/save/restore signal handlers, which may break applications > using custom han

[PATCH] libc: fix signal handling in system()

2012-01-16 Thread Richard Braun
When built without NPTL support (or for a sparc target), the system() function doesn't conform to its specification. Namely, it uses signal() to install/save/restore signal handlers, which may break applications using custom handlers installed with sigaction(). In addition, it resets the SIGCHLD ha