develooper Front page | perl.perl5.porters | Postings from June 2008

Re: [perl #55668] 'eval'ing a certain format string segfaults perl

Thread Previous | Thread Next
From:
Alexandr Ciornii
Date:
June 12, 2008 10:04
Subject:
Re: [perl #55668] 'eval'ing a certain format string segfaults perl
Message ID:
2f1541220806121003w6ae76971u977df27390a35340@mail.gmail.com
This program does not segfault on 5.10.0 (Strawberry Perl on Win32)
and segfaults on 5.8.8 (ActiveState and Vanilla).
On 5.10.0 error is "Runaway format at (eval 1) line 5.".

2008/6/12 via RT Arthur Kantor <perlbug-followup@perl.org>:
> # New Ticket Created by  Arthur Kantor
> # Please include the string:  [perl #55668]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=55668 >
>
>
> This is a bug report for perl from kantor@cs.wisc.edu,
> generated with the help of perlbug 1.35 running under perl v5.8.8.
>
>
> -----------------------------------------------------------------
> [Please enter your report here]
>
> The following program segfaults perl:
>
> The error has something to do with escaping the $ sign in \$oSpec).
>
> The test case follows:
>
>
> #!/usr/bin/perl -w
> use strict;
>
> my $optSpec = [
>        ["help|h",
>                "",
>                "print this help message"],
>        ["dataDir|d=s",
>                "/cworkspace/ifp-32-2/hasegawa/data/telephone/eng/fisher1",
>                "The corpus data dir"]
> ];
>
> printDocOptions($optSpec);
>
>
> sub printDocOptions{
>        my ($optSpec) = @_;
>
>        print "Options:\n";
>        #TODO make the options spec display
>        my $maxOptLength=0;
>        foreach my $o (@$optSpec){
>                $maxOptLength =length($o->[0]) if($maxOptLength <
> length($o->[0])) ;
>        }
>
>        my ($oSpec, $oDefault, $oDesc);
>        my $format  = "format STDOUT = \n"
>                . '  ^' . '<' x $maxOptLength . "\n"
>                . '\$oSpec' . "\n"
>                . '    ' . ' ' x $maxOptLength . "^*  ~~\n"
>                . '\$oDesc' . "\n"
>                . ".\n";
>        print $format;
>        eval $format;
>        die $@ if $@;
>
>
>        foreach my $o (@$optSpec){
>                ($oSpec, $oDefault, $oDesc) = @$o;
>                write;
>        }
>
>
>        return "";
> }
>
>
>
> [Please do not change anything below this line]
> -----------------------------------------------------------------
> ---
> Flags:
>    category=core
>    severity=medium
> ---
> This perlbug was built using Perl v5.8.8 in the Red Hat build system.
> It is being executed now by Perl v5.8.8 - Tue Apr 29 02:54:41 EDT 2008.

-- 
Alexandr Ciornii, http://chorny.net

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About