-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite recursion on FILENO in tied handle leads to segfault #5272
Comments
From @schwernCreated by @schwernThe following code leads to an infinite recursion on FILENO. { open FOO, ">foo.tmp" or die $!; This leads to a segfault inside malloc (I happen to have threads #0 0x0fee4818 in __pthread_alt_lock () from /lib/libpthread.so.0 The bug only effects bleadperl back to 5.6.0. 5.005_03 and back don't schwern@blackrider:~$ bleadperl -lw ~/tmp/bug2.plx Perl Info
|
From @andk
> This leads to a segfault inside malloc (I happen to have threads > The bug only effects bleadperl back to 5.6.0. 5.005_03 and back don't Confirmed for all non-threaded perls from 5.6.0 to bleadperl. Not For non-threaded perls the bug seems to have been introduced in 5.005_57. -- |
From [Unknown Contact. See original ticket]Michael G Schwern <schwern@pobox.com> writes:
This is due to the fact that 5.7.* adds the TIEHANDLE magic to the IO I am not defending the change - it has bitten me ...
|
From [Unknown Contact. See original ticket]At 2002-03-20 11:53:01, nick.ing-simmons@elixent.com wrote:
Could you please point me to the self-tie recursion avoidance stuff in - ams |
From [Unknown Contact. See original ticket]Abhijit Menon-Sen <ams@wiw.org> writes:
Not easily - it "just worked" like self-tied scalars before... and
|
From cmoore@hellyeah.orgSegfaults 5.8.0 as well. [schwern <!--c--> <i>at</i> <!--a--> hse-montreal-ppp106142.qc.sympatico.ca -
|
From @schwernStill an issue in 5.8.1 RC2. |
From markus.krumpoeck@cybirion.comCreated by markus.krumpoeck@cybirion.com[Please do not change anything below this line] Configured by Debian Project at Tue Mar 8 20:31:23 EST 2005. Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Locally applied patches: --- --- Perl Info
|
From @smpetersOn Tue, Dec 27, 2005 at 04:31:43AM -0800, Markus Krumpöck wrote:
Can you please send some source code that demonstrates the problem? Without |
The RT System itself - Status changed from 'new' to 'open' |
From markus.krumpoeck@cybirion.comAm Dienstag 27 Dezember 2005 14:22 schrieb Steve Peters via RT:
Please see attachments for complete code. "main.pl" is the script started, which includes "Template.pm": my $template = new WebApp::Template ($config); In "Template.pm" the segmentation fault happens when executing $result = $class->SUPER::process(@params); Kind regards, -- |
From guest@guest.guest.xxxxxxxxYou haven't included all the files necessary to run the example: main.pl seems to need (at least) WebApp::Output, WebApp::System, WebApp::Error, WebApp::Input. I take it that the 'Template' module from which WebApp::Template inherits is the one from And Robin |
From guest@guest.guest.xxxxxxxxI've just had another thought. I don't think Perl 5.8 is binary compatible Robin |
From @nwc10On Tue, Dec 27, 2005 at 02:36:07PM +0100, Markus Krumpöck wrote:
This code is not complete, in that it can't be run without 4 modules that Please send a complete example that works, and can be run stand alone to Until you are able to provide the examples sufficient for someone else to Nicholas Clark |
From markus.krumpoeck@cybirion.comAm Dienstag 27 Dezember 2005 22:53 schrieb Nicholas Clark via RT:
Attachted to this mail you will find a minimal example, which produces an The problem may be in the "Filter::Handle" - Module. Kind regards, -- |
From @nwc10On Wed, Dec 28, 2005 at 11:06:49AM +0100, Markus Krumpöck wrote:
I can get it down to this: #!perl -w sub TIEHANDLE { sub PRINT { tie *STDOUT, 'main', \*STDOUT; # use Devel::Peek; Dump (*STDOUT); Dump (${*STDOUT{IO}}); print "Bang!\n";
I think it is. Well, it's more that it's exploiting some of the internals of In 5.6.x it turns out that tied filehandle magic is applied to the typeglob. The upshot is that the line my $fh = *{ $self->{fh} }; make a copy of values of the typeglob, without copying over the magic. So on Whereas on 5.8.x that line still copies the typeglob, which still points to If I change PRINT to avoid the typeglob copy: sub PRINT { then it segfaults on both 5.6.x and 5.8.x I don't know of a good way to temporarily untie the file handle inside PRINT Nicholas Clark |
From RandyS@ThePierianSpring.orgNicholas Clark wrote:
Not to divert from the more important issue of solving this bug, but is I was planning to try something like the above to solve a problem we With apologies for the diversion, Randy. |
From nick@ing-simmons.netNicholas Clark <nick@ccl4.org> writes:
Tk::Event::IO avoids that issue by copying the IO. #!perl -w sub TIEHANDLE { sub PRINT { tie *STDOUT, 'main', \*STDOUT; #use Devel::Peek; Dump (*STDOUT); Dump (${*STDOUT{IO}}); print "Bang!\n"; |
From @rgsNicholas Clark wrote:
Maybe we should add a language-level construct level for that. |
From @smpetersThe code below SEGFAULTS with Perls back to at least 5.8.1-RC3 through use strict; package TestHandle; use base qw(Tie::Handle); sub TIEHANDLE { print "<TestHandle>\n"; my $i; bless \$i, shift } package main; The actual output is... <TestHandle> I'm certainly doing something wrong, but a SEGV is probably not the |
From @schwernSteve Peters (via RT) wrote:
$self is never defined, this code doesn't compile.
It segfaults because you're blowing out the stack, which isn't good but it -- |
The RT System itself - Status changed from 'new' to 'open' |
From @smpetersOn Thu Jan 03 20:50:53 2008, schwern wrote:
OK, here's the right code. #!perl -w use strict; package TestHandle; use base qw(Tie::Handle); sub TIEHANDLE { print "<TestHandle>\n"; my $i; bless \$i, shift } sub PRINT { print "<TestHandle>: ", shift } package main; tie *STDOUT, "TestHandle"; print "Hello"; Now, that you say it and I'm awake (coffee++), I see what's going on. The "Deep recursion" warning is coming from sub_crush_depth() from |
From @hvds"Steve Peters via RT" <perlbug-followup@perl.org> wrote: In the general case: recursion is good; unless you are sufficiently (As it happens, a while back I fixed a bug when recursion depth exceeds Hugo |
From @schwernhv@crypt.org wrote:
What he said. Slapping a limit on recursion depth sounds like training wheels. But on the ideal rule that no Perl program should result in a segfault, it |
From ben@morrow.me.ukQuoth schwern@pobox.com (Michael G Schwern):
If you could die just before (and only just before) the stack gives out, Ben |
From @iabynOn Sat, Jan 05, 2008 at 01:04:16AM +0000, Ben Morrow wrote:
But as far as I'm aware, there's no portable way of checking the stack -- |
From @cpansproutOn Wed Dec 28 08:56:35 2005, nicholas wrote:
Don’t tied scalars do exactly that? |
From zefram@fysh.orgAs with [perl #3054], this test case is calling for infinite recursion, -zefram |
From @cpansproutOn Sun, 10 Dec 2017 14:43:23 -0800, zefram@fysh.org wrote:
With string and reference overloading, an overload method can return the overloaded object itself, to bypass overloading. Wouldn’t it make sense to have a similar mechanism for tied handles? -- Father Chrysostomos |
From zefram@fysh.orgFather Chrysostomos via RT wrote:
That really only makes sense for those few unary overloads where the Tie::StdHandle does have some redirection semantics of that nature, Anyway, such features are off topic for this ticket. -zefram |
Migrated from rt.perl.org#8861 (status was 'open')
Searchable as RT8861$
The text was updated successfully, but these errors were encountered: