If the signal handlers are just re-installed after calling Safe, then I think there is the possibility of missing a signal (one that occurs while Safe is running).

The Safe author(s) had 3 options: 1) Temporarily block usr1,2 and do nothing and wait for caller to figure it out later, 2)throw these signals away, 3)do something of its own which probably ain't that polite.

One possible? solution is to block Usr1 and Usr2 before calling Safe, but that requires C code and requires Safe to be "well behaved". I don't know of anyway in Perl to modify the signal mask. In this case to not miss a signal, caller then re-installs the signal handlers and then unblocks the signals. Then any pending signal would be delivered. It is possible for the OS to have a "pending, but not delivered" signal.

A big issues here is "how well behaved" Safe is? Sounds like its not very "polite". If it installs its own handlers but doesn't unblock the USR signals and essentially "take over the world", then that can be worked around with effort.

Just re-installing the signal handlers after the call to Safe will work with the exception of what happens while Safe is running. It appears to me that not everything is "safe" with Safe. A signal might not just be delayed, but missed which is different.

I did look at the Safe doc's and it appears to me that this thing would flunk the Kindergarten grade of "plays well with others".


In reply to Re^5: trouble with custom signal handlers by Marshall
in thread trouble with custom signal handlers by casaschi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.