New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
signal handler can clobber $! #7235
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgIf a signal is caught, and interrupts a system call, and the Perl signal
use warnings; my $a;
The program attempts to read one character, and just displays what it $ ./t0 This is pretty surprising behaviour to the code that was calling sysread; The behaviour is perfectly understandable, and probably someone is going
void sigtstp(int signum) int main(void)
$ ./t1 Obviously the difference is just a question of where errno/$! is set. Code such as I showed above still needs to save and restore Perl Info
|
From @smpetersOn Thu Apr 15 06:25:56 2004, zefram <!-- x --> at fysh.org wrote:
The problem is that by the time $! is displayed at the end, several |
The RT System itself - Status changed from 'new' to 'open' |
From nospam-abuse@bloodgate.com-----BEGIN PGP SIGNED MESSAGE----- Moin, On Tuesday 24 July 2007 23:23:29 Steve Peters via RT wrote:
I am not sure what other operations you mean. This modified program: #!/usr/bin/perl prints on Linux, Perl v5.8.8: linux:/home/te # perl t.pl I can't think of a way to check $! earlier. All the best, Tels - -- "It is true that some lawyers are dishonest, arrogant, greedy, venal, -- The Washington Post iQEVAwUBRqZxJncLPEOTuEwVAQKn8gf6A0I1wQtR6M9lGSyRjsaL7VtO4hDBeOv9 |
From mark@mark.mielke.ccTels wrote:
I believe the correct behaviour would be for sysread() to return EINTR. $ perl -e ' This leads me to believe that it is the explicit assignment to the Perl $ perl -e ' And to be sure this has to do with signals and assignment to $!: So - on the surface, it does look like there is some sort of bug. However! I do not believe C promises you the ability to set the value of errno. Cheers, -- |
From @gbarrOn Jul 24, 2007, at 9:06 PM, Mark Mielke wrote:
Yes
UNIX signal handlers are run on a separate stack and are called To fix this despatch_signals in mg.c would need to save and restore
You can always write to errno, you just cannot be sure when it will Graham. |
From perlbug@plan9.deCreated by perlbug@plan9.deHi! Today, I wondered whether I should localise $! in my signal handler in perl. I looked through 5.10 sources, and think that perl simply destroys errno Please note that I have not *verified* anything of this :) For example, the Perl_csighandler calls "rsignal" which might destroy The Perl_sighandler might do I/O (for warn), again destroying errno. While this is probably not a big deal in most cases, in some cases, this Just my 0.02€ Perl Info
|
From lubo.rintel@gooddata.comThis is probably the same issue as this patch deals with: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2010-02/msg00060.html |
The RT System itself - Status changed from 'new' to 'open' |
From schmorp@schmorp.deOn Thu, Feb 04, 2010 at 04:58:19AM -0800, Lubomir Rintel via RT <perlbug-followup@perl.org> wrote:
nope, but similar. localising $! is not enough, as the (C) signal handler (and the dSAVE_ERRNO should be done outside the loop, anyways) it surely helps in general, of course, but the issue the patch works -- |
From @LeontOn Thu Apr 15 06:25:56 2004, zefram@fysh.org wrote:
This bug seems to be fixed in blead, probably by d016601. Leon |
From @LeontOn Wed Apr 01 08:55:28 2009, perlbug@plan9.de wrote:
PATH=/root/s2:/root/s:/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11/bin:/usr/games:/usr/local/bin:/usr/local/sbin:/root/pserv:.
This bug is a duplicate of #28824. It seems to have been fixed in commit Leon |
@cpansprout - Status changed from 'open' to 'resolved' |
@cpansprout - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#28824 (status was 'resolved')
Searchable as RT28824$
The text was updated successfully, but these errors were encountered: