develooper Front page | perl.perl5.porters | Postings from May 2013

Re: Safe 2.35 localizing %SIG

Thread Previous
From:
David Cantrell
Date:
May 24, 2013 11:21
Subject:
Re: Safe 2.35 localizing %SIG
Message ID:
20130524112103.GA27556@bytemark.barnyard.co.uk
On Thu, May 23, 2013 at 12:57:50AM +0200, Leon Timmermans wrote:
> On Wed, May 22, 2013 at 11:30 PM, David Cantrell <david@cantrell.org.uk> wrote:
> > I believe you!
> >
> > I've just spent an unproductive couple of hours trying to patch Safe.pm
> > to allow me to give it a list of signals that I want to leave working
> > anyway regardless of the potential problems, but couldn't figure out a
> > clean way of getting them through the evals. Ah well, I'll just have to
> > find another way of getting my timeout to work.
> POSIX::sigaction() may allow you to create an escape hatch???

I don't think so - looks like it still relies on %SIG.

I think the solution will be to fork() off a child and run the Safe
compartment in that, killing off the child if it runs for too long. I
can return data from the child to the parent by serialising it to a temp
file or over a socket.

Handily, Parallel::ForkManager appears to support most of this already.

-- 
David Cantrell | Hero of the Information Age

    The Law of Daves: in any gathering of technical people, the
    number of Daves will be greater than the number of women.

Thread Previous


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