Bug#479434: perl: Getopt::Long with subs breaks in Perl 5.10
Package: perl
Version: 5.10.0-9
Severity: important
Something fairly fundamental appears to have changed about the handling
of variable aliasing and subroutine calls that breaks Getopt::Long with
sub arguments. Consider the following one-liner, extracted from the
lintian frontend:
perl -MGetopt::Long -e 'my $action; sub set_action { $action = $_[0] } Getopt::Long::GetOptions ("setup-lab" => \&set_action); print "$action\n"; $action = "check" unless $action; print "$action\n"' -- --setup-lab
Getopt::Long calls set_action with two arguments ('setup-lab' and 1)
and $action subsequently stringifies to "setup-lab", but $action appears
to be false for the unless check. So it's then reassigned to a different
value. It looks like the state of the $action variable is partly aliased
to $_[0], supported by the fact that the bug disappears if $action is
assigned "$_[0]" instead of just $_[0].
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.24-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages perl depends on:
ii libc6 2.7-10 GNU C Library: Shared libraries
ii libdb4.6 4.6.21-8 Berkeley v4.6 Database Libraries [
ii libgdbm3 1.8.3-3 GNU dbm database routines (runtime
ii perl-base 5.10.0-9 The Pathologically Eclectic Rubbis
ii perl-modules 5.10.0-9 Core Perl modules
Versions of packages perl recommends:
ii netbase 4.32 Basic TCP/IP networking system
ii perl-doc 5.10.0-9 Perl documentation
-- no debconf information
Reply to: