[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Signal handler can't be reinstalled after `exec'




I think something is wrong with the perlbug@perl.com mailing address.
I generated the enclodes bug report with the `perlbug' program about
five hours ago and it was send to perlbug@perl.com, but it didn't
arrive on p5p.  Then I sent a ping message to perlbug@perl.com, and it
didn't get forwarded either.

------- Forwarded Message

Forwarded: Thu, 06 Jan 2000 16:10:00 -0500
Return-Path: mjd@plover.com
Return-Path: <mjd@plover.com>
Delivered-To: mjd-filter-deliver@plover.com
Received: (qmail 1015 invoked by uid 119); 6 Jan 2000 21:08:51 -0000
Delivered-To: mjd-filter@plover.com
Received: (qmail 1010 invoked by uid 119); 6 Jan 2000 21:08:50 -0000
Delivered-To: mjd@plover.com
Received: (qmail 1006 invoked by uid 119); 6 Jan 2000 21:08:49 -0000
Date: 6 Jan 2000 21:08:49 -0000
Message-ID: <20000106210849.1005.qmail@plover.com>
From: mjd@plover.com
To: perlbug@perl.com
Subject: Signal handler can't be reinstalled after `exec'
Cc: mjd@plover.com
Reply-To: mjd@Plover.com



This is a bug report for perl from mjd@Plover.com,
generated with the help of perlbug 1.26 running under perl 5.00502.


- -----------------------------------------------------------------
[Please enter your report here]

Here is the program sig.pl:

	#!/usr/bin/perl
	
	$| = 1;
	
	print "Starting.  Pid is $$.\n";
	$SIG{HUP} = \&Handler;
	for (;;) { sleep 1 }
	
	sub Handler {
	  print "Signal received.\n";
	  exec($0);
	  die "This should not happen.\n";
	}

It prints a message and then waits for sighup.  When it gets the
signal, it re-execs itself.  The `exec' will remove the signal
handler, but since the program is restarting from the beginning, the
new program should reinstall the handler on line 6 just as it did the
first time.

When I run this program and send it HUP signals, it appears to receive
the first signal but not the subsequent ones.  It prints the `Signal
received' message only once.  The first signal does appear to restart
the program, and yields  a new `Starting' message, but the subsequent
signals do not seem to cause a restart:


plover% perl /tmp/sig.pl &
[13] 1002
plover% Starting.  Pid is 1002.
kill -HUP 1002					
plover% Signal received.
Starting.  Pid is 1002.
kill -HUP 1002
plover% kill -HUP 1002
plover% kill -HUP 1002
plover% kill -HUP 1002


The problem persists in perl 5.005_56, _62, and _63.

[Please do not change anything below this line]
- -----------------------------------------------------------------

- ---
This perlbug was built using Perl 5.00502 - Sun Oct 18 04:25:09 CDT 1998
It is being executed now by  Perl 5.00556 - Wed May 19 22:26:34 EDT 1999.

Site configuration information for perl 5.00502:

Configured by root at Sun Oct 18 04:25:09 CDT 1998.

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  Platform:
    osname=linux, osvers=2.0.35, archname=i586-linux
    uname='linux darkstar 2.0.35 #10 tue oct 13 18:04:13 cdt 1998 i586 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.7.2.3
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /shlib /lib /usr/lib
    libs=-lndbm -lgdbm -ldbm -ldb -ldl -lm -lc
    libc=/lib/libc.so.5.4.46, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

- ---
@INC for perl 5.00502:
    /usr/lib/perl5/5.00502/i586-linux
    /usr/lib/perl5/5.00502
    /usr/lib/perl5/site_perl/5.005/i586-linux
    /usr/lib/perl5/site_perl/5.005
    .

- ---
Environment for perl 5.00502:
    HOME=/home/mjd
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
    LOGDIR (unset)
    PATH=/home/mjd/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/sbin:/usr/sbin:/usr/local/bin/X11:/usr/local/bin/mh:/data/mysql/bin:/home/mjd/TPI/bin:/usr/local/mysql/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

------- End of Forwarded Message


Follow-Ups from:
Mark-Jason Dominus <mjd@plover.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]