perl segfaults when using sub prototype and "format"

Solution Verified - Updated -

Environment

Red Hat Enterprise Linux (RHEL) 6.3
perl-5.10.1-130.el6

Issue

The following small Perl script segfaults on RHEL 6:

#!/usr/bin/perl -w

my $VERSION = "4";

sub version();

version();
exit(0);

#
# Prints version.
#
sub version()
{
   format VERSION_FMT=
v.@<<<<<<<<<<
$VERSION 
.
   $~ = VERSION_FMT;
   write;
}

It works fine on RHEL 5 (Perl v5.8.8) and Mandriva 2011.0 (Perl v5.12.3).

Resolution

The bug has been fixed in perl-5.10.1-131.el6_4, available in advisory RHBA-2013-0781.

Root Cause

This is a known issue addressed by upstream in the following commit.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments