Your message dated Mon, 26 Jan 2009 15:57:32 +0200 with message-id <[email protected]> has caused the report #512796, regarding setpgrp() causes: "Can't call method "foo" without a package or object reference" to be marked as having been forwarded to the upstream software author(s) [email protected]
(NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 512796: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512796 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---On Fri, Jan 23, 2009 at 08:21:24PM +0000, Marcin Owsiany wrote: > The following program dies for me on perl v5.8.8 with: > Can't call method "foo" without a package or object reference at a line 10. > > -------------------------------------------------------->8--- > package A; > sub new { bless {}, shift } > sub foo { } > sub getref { setpgrp() } > > package main; > my $o = A->new; > # my $r = A::getref; > # $o->foo($r); > $o->foo(A::getref); > -------------------------------------------------------->8--- > > However just uncomment the commented lines, and comment the last one, > and it works! :-O Thanks for the report. This bug is still present in bleadperl. The attached patch should fix it. -- Niko Tyni [email protected]>From 38bc943b3e930c46bd9043230ab36503f43a657e Mon Sep 17 00:00:00 2001 From: Niko Tyni <[email protected]> Date: Mon, 26 Jan 2009 14:14:36 +0200 Subject: [PATCH] setpgrp() should extend the stack before modifying it As reported by Marcin Owsiany in <http://bugs.debian.org/512796>, invoking setpgrp without any arguments could corrupt the stack. --- pp_sys.c | 1 + t/op/setpgrpstack.t | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) create mode 100644 t/op/setpgrpstack.t diff --git a/pp_sys.c b/pp_sys.c index cfbf918..0d2c970 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4318,6 +4318,7 @@ PP(pp_setpgrp) if (MAXARG < 2) { pgrp = 0; pid = 0; + XPUSHi(-1); } else { pgrp = POPi; diff --git a/t/op/setpgrpstack.t b/t/op/setpgrpstack.t new file mode 100644 index 0000000..31f498e --- /dev/null +++ b/t/op/setpgrpstack.t @@ -0,0 +1,16 @@ +#!./perl -w + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; +} + +use Config; +plan tests => 2; + +SKIP: { + skip "setpgrp() is not available", 2 unless $Config{d_setpgrp}; + ok(!eval { package A;sub foo { die("got here") }; package main; A->foo(setpgrp())}); + ok($@ =~ /got here/, "setpgrp() should extend the stack before modifying it"); +} -- 1.5.6.5
--- End Message ---

