Skip Menu |

This queue is for tickets about the aliased CPAN distribution.

Report information
The Basics
Id: 25293
Status: resolved
Priority: 0/
Queue: aliased

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] aliased masks the setting of $SIG{__DIE__}
$ perl -wle 'use Test::More; print $SIG{__DIE__}' CODE(0x1836744) $ perl -wle 'use aliased "Test::More"; print $SIG{__DIE__}' This is due to the "local $SIG{__DIE__}" before the eval in aliased.pm. Any modules loaded inside that eval (directly or indirectly) will have their $SIG{__DIE__} localized and thus neutered. You might say "don't do that" but if you load module A aliased which loads module B which loads module C which loads D which loads E which finally loads Test::Builder... well you can see how it can cause weird effects. Test and patch attached.
Subject: sigdie.patch
Auto-merging (0, 27676) /local/aliased to /vendor/aliased (base /vendor/aliased:27674). A t/sigdie.t U lib/aliased.pm ==== Patch <-> level 1 Source: 9c88509d-e914-0410-b01c-b9530614cbfe:/local/aliased:27676 Target: 9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/aliased:27674 Log: r27675@windhund: schwern | 2007-03-05 15:25:55 -0800 local copy r27676@windhund: schwern | 2007-03-05 15:39:22 -0800 Make sure global $SIG{__DIE__} gets out of aliased modules. === t/sigdie.t ================================================================== --- t/sigdie.t (revision 27674) +++ t/sigdie.t (patch - level 1) @@ -0,0 +1,19 @@ +#!/usr/bin/perl -w +use warnings; +use strict; + +use lib "t/lib"; + +BEGIN { + # Ensure nothing else has loaded a $SIG{__DIE__} + die if $SIG{__DIE__}; +} + +# Test::Builder might have a $SIG{__DIE__}, too so we +# make sure it is effected by any aliased bug, too. +use aliased "Test::More"; +use aliased "HasSigDie"; + +plan(tests => 1); + +is ref $SIG{__DIE__}, "CODE"; === lib/aliased.pm ================================================================== --- lib/aliased.pm (revision 27674) +++ lib/aliased.pm (patch - level 1) @@ -43,12 +43,19 @@ sub _load_alias { my ( $package, $callpack, @import ) = @_; - local $SIG{'__DIE__'}; - my $code = @import == 0 - ? "package $callpack; use $package;" - : "package $callpack; use $package (\@import)"; - eval $code; - die $@ if $@; + my $sigdie; + { + local $SIG{__DIE__}; + my $code = @import == 0 + ? "package $callpack; use $package;" + : "package $callpack; use $package (\@import)"; + eval $code; + die $@ if $@; + $sigdie = $SIG{__DIE__}; + } + + # Make sure a global $SIG{__DIE__} makes it out of the localization. + $SIG{__DIE__} = $sigdie if defined $sigdie; } sub alias { ==== BEGIN SVK PATCH BLOCK ==== Version: svk v2.0.0 (darwin) eJyNVc9v40QULheEIk6VuCAkhtQrbSXS+HdsRw3RkrRbVtut1MIJyZp4npNRHU/kmaSE9aJNEcuK KyfEAf4Kboh/jTd20h+rVlsrtscz733zvfe+eTkozrp9q+z1zNKwzPL0u2dRdEJVMnlkuaXhl8C4 EoXhlRksIDOcMhNjwy1zOgVclWJeJHqgaDEGpQc8OQfV61kIF9RwwwpiA1uhjqgSuTTCCj5WBYBh lV7fL/uO/sWGFZYScKWCjQtYcMlFjjTsjt/x0QTtLfQXM8jjQgh1tWRrb7NMMiEh1vAa0tP2toEh VQ6MF5AgpyXOqgpp410ZuncYYuB8dMu0oumtN7qJaCEHDAVHjhGUlLE45RloUqot+Zhx2NOb2rFh ly3rfhy7xqlW6WyWLWMFPygGmaIaO44Nx7IxxcdbW1uX3F0t/x5uvx1uv/5mePjmOP/rJPt9ePLn YDW5HK4Gq+H201WxOlh99svB50eXH70dXH76x4vVh7/tfNGey6I94nl7BkVGWheNuQRyQYuc52PZ largieo2MHrSVG18NbuNxpPh4dExedkgeO2QYS7nBZBcqAn6EMgQYEIlyQRlwAglxunR4cs4HhwN 4/gVxk942m28ajR2yBlIFUVP5jxjUJApH08Uui7gS6KEIFKQC0CrKT1HH0W4JJCmmCBEHS0JzfHO OJXz8V7zuSig+ZTKUz4e8MYso/ljheCS7PeItYuc0blA3ObXLwZDjKHv3hRKXSEsmGOXncANTa9j J06HddyQUidwRtS3aegHVuA7uiyVTryNAGtvV0ukXRECtjebVkp6r1rcGu6eKnsVoY6dutTybb9D wQlM5JOEie+micdML6WGa4a1Dv796b9nH//8wdabT7Ze4+sf79ej6ZIYteq6VbnqoukrEwnNbtem e7Wo3RLBgOyTPp/ORKHI/j4xr9YJ+Yo0ZzQ5p2NAS5pl+qNLtHiM9Xy3ecM8eq85efz9eqvd5jUR WGiSmsr1nJaQ0UcV4fN6dh0mMr4jJlRbLdbnWkuVXikZZ2L0bgoqsUmtNjHHOyVqAnWq+I9UYRPa q4Bu++xfbY6cGKQ8R4Wup+4UWlXX1Pbd0IKUuYyBaXWwzo4DMBqFnpuGll21GytwSlJoEXn9C56z yTxnESEymVxAkZOS2KbZaZlOy/SI5UW2F3keaZmBibWqK5yI2bJRQ/gPgXDCyLY3ENfpujNZ2J3l JlFr5ZOpYPMM5F4D+bd6Pbs0bLv+Jzir2nkUfZvzBRSSZo+wTbrljKoJNljs8vgxn3Omz1K7Ir85 TptzZDh+GSZB4Jkha0FouS3TtczWyLSSFqbNMX3LTUYp9Hbt8l5wr2wvIGeieAfdfSi64XUeZBfd DiKqQvgf31VKEw== ==== END SVK PATCH BLOCK ====
Thanks. Patch applied and tweaked. New version (0.21) is on its way to the CPAN now.