Bug#579537: perl: seg-fault when calling write in sub called via constant reference

Jeremy Sowden jeremy at azazel.net
Wed Apr 28 12:31:35 UTC 2010


Package: perl
Version: 5.10.1-12
Severity: normal
Tags: upstream


Subject: perl: seg-fault when calling write in sub called via constant reference
Package: perl
Version: 5.10.1-12
Severity: normal


The following script:

  #!/usr/bin/perl

  use strict;
  use warnings;

  use constant TMP => \&tmp;

  sub tmp ()
    {
    my $a = "a";

    format =
  @
  $a
  .

    write;
    }

  TMP->();

causes Perl to seg-fault:

  Apr 28 11:46:19 ulthar kernel: [16333.673848] test.pl[2011]: segfault at 10 ip 00007f03c9ad51ca sp 00007fff9f006030 error 4 in libperl.so.5.10.1[7f03c9a5d000+164000]

Moving the use statement below the sub-routine definition avoids the problem:

  #!/usr/bin/perl

  use strict;
  use warnings;

  sub tmp ()
    {
    my $a = "a";

    format =
  @
  $a
  .

    write;
    }

  use constant TMP => \&tmp;

  TMP->();

The same behaviour occurs using the perl in Lenny.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (900, 'stable'), (90, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages perl depends on:
ii  libbz2-1.0              1.0.5-4          high-quality block-sorting file co
ii  libc6                   2.10.2-6         Embedded GNU C Library: Shared lib
ii  libdb4.7                4.7.25-9         Berkeley v4.7 Database Libraries [
ii  libgdbm3                1.8.3-9          GNU dbm database routines (runtime
ii  perl-base               5.10.1-12        minimal Perl system
ii  perl-modules            5.10.1-12        Core Perl modules
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages perl recommends:
ii  make                          3.81-8     An utility for Directing compilati
ii  netbase                       4.40       Basic TCP/IP networking system

Versions of packages perl suggests:
pn  libterm-readline-gnu-perl | l <none>     (no description available)
ii  perl-doc                      5.10.1-12  Perl documentation

-- no debconf information

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (900, 'stable'), (90, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages perl depends on:
ii  libbz2-1.0              1.0.5-4          high-quality block-sorting file co
ii  libc6                   2.10.2-6         Embedded GNU C Library: Shared lib
ii  libdb4.7                4.7.25-9         Berkeley v4.7 Database Libraries [
ii  libgdbm3                1.8.3-9          GNU dbm database routines (runtime
ii  perl-base               5.10.1-12        minimal Perl system
ii  perl-modules            5.10.1-12        Core Perl modules
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages perl recommends:
ii  make                          3.81-8     An utility for Directing compilati
ii  netbase                       4.40       Basic TCP/IP networking system

Versions of packages perl suggests:
pn  libterm-readline-gnu-perl | l <none>     (no description available)
ii  perl-doc                      5.10.1-12  Perl documentation

-- no debconf information






More information about the Perl-maintainers mailing list