From: Frank Seitz on
Ben Morrow wrote:
> Quoth "C.DeRykus" <derykus(a)gmail.com>:
>> On Mar 4, 4:22�pm, Frank Seitz <devnull4...(a)web.de> wrote:
>>> #!/usr/bin/perl
>>>
>>> use strict;
>>> use warnings;
>>>
>>> my $stderr;
>>> close STDERR;
>>> open STDERR,'>',\$stderr or die;
>>> warn "a\n";
>>> $stderr =~ s/./xx/g;
>>>
>>> # eof
>>>
>>> $ ./test.pl
>>> Segmentation fault
>>>
>>> What is the problem?
>>>
>>> $ perl -v
>>> This is perl, v5.10.1 (*) built for i686-linux
>>>
>> A bug? The trailing \n appears to be problematic.
>>
>> Possible workaround:
>>
>> $stderr =~ s/[^\n]/xx/g;
>>
>> This is perl, v5.10.1 (*) built for MSWin32-x86-multi-thread
>
> With 5.10.1 for i386-freebsd I can reproduce the bug without the
> newline, but only if I use a one-liner:
>
> ~% perl ioscseg
> ~% perl -e"$(<ioscseg)"
> Segmentation fault (core dumped)
> ~%
>
> The crash appears to be in the same place as before, so I presume it's
> just somewhat allocation-dependant.

Do you have an idea about the reason of the crash and
what I can do to reliably circumvent the bug?

Frank
--
Dipl.-Inform. Frank Seitz
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Blog: http://www.fseitz.de/blog
XING-Profil: http://www.xing.com/profile/Frank_Seitz2
From: Ben Morrow on

Quoth Frank Seitz <devnull4711(a)web.de>:
> Ben Morrow wrote:
> > Quoth "C.DeRykus" <derykus(a)gmail.com>:
> >> On Mar 4, 4:22�pm, Frank Seitz <devnull4...(a)web.de> wrote:
> >>> #!/usr/bin/perl
> >>>
> >>> use strict;
> >>> use warnings;
> >>>
> >>> my $stderr;
> >>> close STDERR;
> >>> open STDERR,'>',\$stderr or die;
> >>> warn "a\n";
> >>> $stderr =~ s/./xx/g;
> >>>
> >>> # eof
> >>>
> >>> $ ./test.pl
> >>> Segmentation fault
> >>>
> >>> What is the problem?
> >>>
> >>> $ perl -v
> >>> This is perl, v5.10.1 (*) built for i686-linux
> >>>
> >> A bug? The trailing \n appears to be problematic.
> >>
> >> Possible workaround:
> >>
> >> $stderr =~ s/[^\n]/xx/g;
> >>
> >> This is perl, v5.10.1 (*) built for MSWin32-x86-multi-thread
> >
> > With 5.10.1 for i386-freebsd I can reproduce the bug without the
> > newline, but only if I use a one-liner:
> >
> > ~% perl ioscseg
> > ~% perl -e"$(<ioscseg)"
> > Segmentation fault (core dumped)
> > ~%
> >
> > The crash appears to be in the same place as before, so I presume it's
> > just somewhat allocation-dependant.
>
> Do you have an idea about the reason of the crash and
> what I can do to reliably circumvent the bug?

No, sorry. If I had to guess I'd say 'don't modify a string while you've
got a filehandle to it open', or maybe just 'don't s///...', but I don't
really have any idea that that is the root of the problem.

Ben

From: Peter J. Holzer on
On 2010-03-05 01:47, Ben Morrow <ben(a)morrow.me.uk> wrote:
> It's a bug in perl, but it appears to have been fixed in blead. The fix
> will be in 5.10.0, and probably in 5.10.2 if there ever is one
5.12.0?

hp
From: Ben Morrow on

Quoth "Peter J. Holzer" <hjp-usenet2(a)hjp.at>:
> On 2010-03-05 01:47, Ben Morrow <ben(a)morrow.me.uk> wrote:
> > It's a bug in perl, but it appears to have been fixed in blead. The fix
> > will be in 5.10.0, and probably in 5.10.2 if there ever is one
> 5.12.0?

Yes. Thanks for the correction.

Ben