develooper Front page | perl.perl5.porters | Postings from January 2004

[PATCH] 5.8.3 -- fix signal comments in L<perlfunc/system>

Thread Next
From:
Brendan O'Dea
Date:
January 25, 2004 02:31
Subject:
[PATCH] 5.8.3 -- fix signal comments in L<perlfunc/system>
Message ID:
20040125002348.GA31407@londo.c47.org
On Tue, Dec 16, 2003 at 10:46:28PM -0900, Britton Leo Kerin wrote:
>In the output of perldoc -f system, I read this:
>...
>Because "system" and backticks block "SIGINT" and "SIGQUIT", killing
>the program they're running doesn't actually interrupt your program.
>...
>
>But in fact system() builtin IGNORES these signals during execution of
>the system() builtin, just like system(3).  They don't get handled
>after system() is done, as would happen if they were blocked and then
>unblocked on system() completion.  [...]

Quite correct.  Moreover it appears that backticks (also mentioned)
neither block or ignore these signals.

A patch for upstream is attached.

As an aside, I found a quite good explanation for why signals are
ignored in these* APPLICATION NOTES for system(3).  It is perhaps
interesting that the one situation described where this behaviour has
"less than the desired effect" is probably the most common in Perl.

* http://www.opengroup.org/onlinepubs/007904975/functions/system.html#tag_03_757_07

--bod

diff -Naur --exclude=debian perl-5.8.3.orig/pod/perlfunc.pod perl-5.8.3/pod/perlfunc.pod
--- perl-5.8.3.orig/pod/perlfunc.pod	2004-01-14 08:51:09.000000000 +1100
+++ x/perl-5.8.3/pod/perlfunc.pod	2004-01-25 10:13:18.000000000 +1100
@@ -5761,9 +5761,10 @@
 Like C<exec>, C<system> allows you to lie to a program about its name if
 you use the C<system PROGRAM LIST> syntax.  Again, see L</exec>.
 
-Because C<system> and backticks block C<SIGINT> and C<SIGQUIT>,
-killing the program they're running doesn't actually interrupt
-your program.
+Since C<SIGINT> and C<SIGQUIT> are ignored during the execution of
+C<system>, if you expect your program to terminate on receipt of these
+signals you will need to arrange to do so yourself based on the return
+value.
 
     @args = ("command", "arg1", "arg2");
     system(@args) == 0
@@ -5783,7 +5784,6 @@
 	printf "child exited with value %d\n", $? >> 8;
     }
 
-
 or more portably by using the W*() calls of the POSIX extension;
 see L<perlport> for more information.
 

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About