Bug#1014730: liburi-perl: Breaks apt-cacher with "Can't locate Regexp/IPv6.pm" error

Niko Tyni ntyni at debian.org
Mon Jul 11 19:26:12 BST 2022


[apt-cacher maintainers: the context here is that URI.pm introduced an
optional dependency on Regexp::IPv6 by requiring it in an eval block,
but the apt-cacher __DIE__ handler exits when the require fails.]

On Mon, Jul 11, 2022 at 05:35:17PM +0200, gregor herrmann wrote:

> So we have:
> - do nothing
> - patch URI to restart the default signal handler in the eval
> - (reassign? and) do something in apt-cacher

I'm not really sure if there's a consensus on best practices around
$SIG{__DIE__}.  IMO apt-cacher is the one that should be fixed, rather
than demanding that all the modules it uses need to reset and restore
$SIG{__DIE__} before catching exceptions.

>From 'perldoc -f die' :

        You can arrange for a callback to be run just before the "die"
        does its deed, by setting the $SIG{__DIE__} hook. The associated
        handler is called with the exception as an argument, and can
        change the exception, if it sees fit, by calling "die" again.
        See "%SIG" in perlvar for details on setting %SIG entries, and
        "eval" for some examples. Although this feature was to be run only
        right before your program was to exit, this is not currently so:
        the $SIG{__DIE__} hook is currently called even inside "eval"ed
        blocks/strings! If one wants the hook to do nothing in such
        situations, put

            die @_ if $^S;

        as the first line of the handler (see "$^S" in perlvar). Because
        this promotes strange action at a distance, this counterintuitive
        behavior may be fixed in a future release.

Corresponding untested patch against apt-cacher attached.
-- 
Niko Tyni   ntyni at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Handle-eval-blocks-in-unsuspecting-libraries.patch
Type: text/x-diff
Size: 781 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-perl-maintainers/attachments/20220711/2ca68fb7/attachment.patch>


More information about the pkg-perl-maintainers mailing list