summaryrefslogtreecommitdiff
path: root/t/op/ref.t
Commit message (Collapse)AuthorAgeFilesLines
* [perl #106288] Tests for \scalar @arrayFather Chrysostomos2011-12-181-1/+3
|
* [perl #101738] Make sv_sethek set the UTF8 flag correctlyFather Chrysostomos2011-10-201-1/+10
| | | | | | | | | | | | | | | It was only ever turning it on, and not turning it off if the sv hap- pened to have it on from its previous use. This caused ref() (which uses sv_sethek(TARG,...)) to return a shared scalar with the UTF8 flag on, even if it was supposed to be off. For shared scalars, the UTF8 flag on ASCII strings does make a differ- ence. The pv *and* the flags are used in hash lookup, for speed. So a scalar returned by ref() with the UTF8 flag on by mistake would not work in hash lookups. exists $classes{ref $foo} would return false, even if there were an entry for that class.
* Remove untrue comment from t/op/ref.tFather Chrysostomos2011-10-201-1/+0
| | | | This has been untrue since it was added in commit 6e592b3a.
* Several TODO tests that now pass.Brian Fraser2011-10-061-4/+2
|
* pp.c & sv.c: pp_ref UTF8 and null cleanup.Brian Fraser2011-10-061-1/+3
| | | | | | | | | This adds a new function to sv.c, sv_ref, which is a nul-and-UTF8 clean version of sv_reftype. pp_ref now uses that. sv_ref() not only returns the SV, but also takes in an SV to modify, so we can say both sv_ref(TARG, obj, TRUE); and sv = sv_ref(NULL, obj, TRUE);
* Disallow weakening of read-only referencesFather Chrysostomos2011-09-161-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | $ perl -MScalar::Util=weaken -le 'DESTROY{return if$_++;weaken$_[0]}$x=bless[]' DESTROY created new reference to dead object 'main' during global destruction. It says that because the reference count has gone down to -1 (or the max unsigned value, whichever it is), and the error occurs when SvREFCNT is true. So there is no new reference to the dead object; it’s just the refcount that’s off. This case is worse: $ perl -MScalar::Util=weaken -le 'DESTROY{weaken$_[0];$x=$_[0]}bless[];' Segmentation fault $_[0]’s reference count is normally lowered manually by sv_clear, to avoid a recursive call to sv_clear (as lowering the reference count normally triggers that). If the variable has been weakened, then $_[0] no longer holds a reference count. sv_clear proceeds to destroy at, as its reference count is 1 (held by $x), causing $x to point to a freed scalar. Not good. Since $_[0] is read-only anyway, it should not be weakenable.
* Test ref(\pos) and ref(\vec...)Father Chrysostomos2011-06-161-2/+4
|
* Revert "Partially revert 4155e4fe"Father Chrysostomos2011-05-181-2/+1
| | | | This reverts commit 7f586e41ad4ecd904c7d8dbe1ddb0f9410484bac.
* handle freed backref array in global cleanupDavid Mitchell2011-04-131-1/+55
| | | | | | | | | | | | | | | | | | [perl #88330] If a thinggy is heavily leaked, so that it takes multiple passes through Perl_sv_clean_all to get its refcount to zero, then if it has weak refs to it, its backref array may get freed before it. We already set the refcount of the array to 2 to preserve it across one pass of Perl_sv_clean_all, but I can't think of a way of protecting it more generally (short of using a private array structure rather than an AV). In the past, this caused a scary assertion failure. Now instead, just skip if we're in global cleanup and the array is freed. This isn't ideal, but its reasonably robust, as we don't reuse freed SVs once in global cleanup (so the freed AV hangs around to be identified as such).
* Skip a block of ref.t's tests on minitest, as C<re> may not be available.Nicholas Clark2011-03-061-2/+3
|
* Partially revert 4155e4feFather Chrysostomos2011-01-301-1/+2
| | | | | | | | | | | This disables the fix for [perl #36347], which made sure that unrefer- enced objects were DESTROYed, marking the tests as to-do. This bug fix broke three CPAN modules. I will probably not have time to fix them before 5.14, so disabling the fix until after 5.14 seems the safest option. This resolves [perl #82542] and other related tickets.
* [perl #81750] Perl 5.12: undef-as-hashref bugFather Chrysostomos2011-01-211-1/+21
| | | | | | | | | | | | | | | | | The addition of the boolkeys op type in commit 867fa1e2d did not account for the fact that rv2hv (%{}) can sometimes return undef (%$undef with strict refs turned off). When the boolkeys op is created (and the rv2hv becomes its kid), the rv2hv is flagged with OPf_REF, meaning that it must return a hash, not the contents. Perl_softrefxv in pp.c checks for that flag. If it is set, it dies with ‘Can't use an undefined value as a HASH reference’ for unde- fined values. This commit changes it to make an exception if rv2hv->op_next is a boolkeys op. It also changes pp_boolkeys to account for undef.
* Fix typos (spelling errors) in t/*.Peter J. Acklam) (via RT2011-01-071-1/+1
| | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81916] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81916 >
* Make newline on last record explicit.Craig A. Berry2011-01-051-4/+4
| | | | | | | | | | On VMS, the last line written to a file will get a trailing newline willy nilly. This has its advantages insofar as you never get the "no newline at end of file" warnings from various utilities, but reality conflicts with expectations when you explicitly test for the last (or only) line *not* ending with newline, which is what the recent addtion to ref.t (5e3072707906cc4cb8a364c4cf7c487df0300caa) was doing. Adding an explicit newline makes everyone happy.
* tests for [perl #36347] Object destruction incompleteFather Chrysostomos2011-01-021-1/+20
|
* Add a refgen+PADTMP testFather Chrysostomos2010-10-031-2/+11
|
* Add a warning to test.pl if quotes are used in one-liners.Nicholas Clark2010-09-241-2/+2
| | | | | | Fix all the tests that were using quotes, and (by implication) working because barewords are treated as strings, and one-liners aren't run under strict.
* Avoid using double quotes in a one-liner runperl.Nicholas Clark2010-09-241-1/+1
| | | | | test.pl uses "" for command line quoting on Win32, VMS and NetWare, '' on *nix. Hence what "works on my machine" on *nix may not work elsewhere.
* stop do_clean_named_objs() leaving dangling refsDavid Mitchell2010-09-201-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently perl does 3 major scans of the SV arenas, so the action of perl_destroy() is a bit like this: for (all arena SVs) { if (its a ref to an object) undef the ref (and thus probably free the object) } for (all arena SVs) { if (it's a typeglob and at least one of its slots holds an object) { set SVf_BREAK on the gv SvREFCNT_dec(gv) } } return if $PERL_DESTRUCT_LEVEL < 1; PL_in_clean_all = 1 for (all arena SVs) { set SVf_BREAK on the sv SvREFCNT_dec(sv) } The second scan is problematic, in that by randomly zapping GVs, it can leave dangling pointers to freed GVs. This is while perl-level destructors may still be called, meaning perl users can see corrupted state. Note also that at this point PL_in_clean_all hasn't been set, so sv_free() may put out 'Attempt to free unreferenced scalar' warnings. This commit fixes this by only freeing the affected slots of the GV, rather than freeing the GV itself. Thus makes it more like the first pass, which undefs RVs, and ensures no dangling refs.
* Attached are two TODO patches for the remaining test failures on VMS.Craig A. Berry2010-03-171-4/+7
| | | | If these can go in for 5.12.0, I'd appreciate it.
* Improvements to 31c9a3 - CPAN code did depend on the previous behaviour of ↵Nicholas Clark2010-02-061-2/+2
| | | | | | | | | | | | | | | | | | | blessing filehandles into FileHandle It turns out that it's not quite as simple as blessing into IO::File. If you do (just) that, then it breaks any existing code that does C<require IO::Handle;> to allow it to call methods on file handles, because they're blessed into IO::File, which isn't loaded. (Note this code doesn't assume that methods in IO::Seekable are there to be called) So, it all should work if you also set @IO::File:::ISA correctly? That way, code that assumes that methods from IO::Handle can be called will work. However, gv.c now starts complaining (but not failing) if IO::Handle, IO::Seekable and Exporter aren't present, because it goes looking for methods in them. So the solution seems to be to set @IO::File::ISA *and* create (empty) stashes for the other 3 packages. Patch appended, but not applied.
* RT#69616: regexp SVs lose regexpness in assignmentBen Morrow2009-10-221-1/+28
| | | | | | | | It uses reg_temp_copy to copy the REGEXP onto the destination SV without needing to copy the underlying pattern structure. This means changing the prototype of reg_temp_copy, so it can copy onto a passed-in SV, but it isn't API (and probably shouldn't be exported) so I don't think this is a problem.
* Suppress system messages when op/ref.t calls die on VMS.Craig A. Berry2009-08-151-3/+4
|
* Mark all .t and .pm files as non executableRafael Garcia-Suarez2009-06-061-0/+0
|
* Tests for [perl #57564] and [perl #24524] Refcounting bugBram2008-08-061-1/+13
| | | | | Message-ID: <20080805195800.xq9k9kttwk0kwsk0@horde.wizbit.be> p4raw-id: //depot/perl@34171
* Some more missing isGV_with_GP()sBen Morrow2008-06-281-9/+57
| | | | | Message-ID: <20080628160017.GA81579@osiris.mauzo.dyndns.org> p4raw-id: //depot/perl@34092
* For symbolic references test the defined path through the pp functions.Nicholas Clark2007-04-111-1/+17
| | | p4raw-id: //depot/perl@30915
* Be a bit more specific in what our second typeglob isn't. It is actuallyNicholas Clark2007-04-111-1/+1
| | | | | expected to be undef. p4raw-id: //depot/perl@30913
* Test that format references can't be wrongly dereferenced.Nicholas Clark2007-03-101-9/+24
| | | | | | Test that a glob dereference of a PVIO correctly sets the IO of the temporary glob that it creates. p4raw-id: //depot/perl@30537
* Add get_cvn_flags(), which is like get_cv() but takes a length. ThisNicholas Clark2007-01-151-1/+7
| | | | | allows symbolic code references with embeded NULs to work. p4raw-id: //depot/perl@29830
* Test that names with embedded NULs work for symbolic array, hash andNicholas Clark2007-01-151-3/+44
| | | | | typeglob references. p4raw-id: //depot/perl@29814
* One shouldn't be able to dereference a GLOB as a SCALAR.Yitzchak Scott-Thoennes2006-02-141-1/+13
| | | | | | | | Subject: Re: [perl #38484] Data::Dumper only warns on unhandled reference types Message-ID: <20060212171839.GA3604@efn.org> plus regression tests. p4raw-id: //depot/perl@27179
* Make Perl_gv_fetchpvn_flags actually heed the passed in length.Nicholas Clark2006-01-311-2/+1
| | | | | This means that \0 bytes in symbolic references now work. p4raw-id: //depot/perl@27028
* Re: stringification of v-string referencesJohn Peacock2005-12-061-1/+6
| | | | | | Message-ID: <439592B4.2050101@rowman.com> Date: Tue, 06 Dec 2005 08:31:32 -0500 p4raw-id: //depot/perl@26280
* Allow non-arrowed form of chained subscripts after slicesYitzchak Scott-Thoennes2005-09-131-1/+18
| | | | | | | | | | Subject: Re: [perl #37039] perlref documentation about optional -> is too vague Date: Thu, 1 Sep 2005 17:41:36 -0700 Message-ID: <20050902004136.GA2656@efn.org> Date: Mon, 5 Sep 2005 08:10:20 -0700 Message-ID: <20050905151020.GA3556@efn.org> p4raw-id: //depot/perl@25399
* Add TODO tests for UTF8 encoded soft referencesNicholas Clark2005-01-061-1/+48
| | | p4raw-id: //depot/perl@23763
* Turn barewords into strings to run under strict subs.Nicholas Clark2005-01-061-13/+20
| | | | | Run under strict refs outside the soft reference tests. p4raw-id: //depot/perl@23760
* All tests now use test.plNicholas Clark2005-01-061-51/+57
| | | p4raw-id: //depot/perl@23759
* Start converting t/op/ref.t to use test.plNicholas Clark2005-01-061-72/+59
| | | p4raw-id: //depot/perl@23758
* a regex in STDOUT destructor coredumped because regex pad alreadyDave Mitchell2004-08-201-1/+14
| | | | | freed p4raw-id: //depot/perl@23230
* [perl #27268] Blessed reference to anonymous globDave Mitchell2004-03-261-1/+11
| | | | | Stop *$$x=$x giving "Attempt to free unreferenced scalar" warning p4raw-id: //depot/perl@22591
* Re: [perl #22719] ISA cache problem with blessed stash objectsDave Mitchell2003-06-241-1/+9
| | | | | Message-ID: <20030624121618.GC22675@fdgroup.com> p4raw-id: //depot/perl@19849
* Re: nitpick with \(0..2)Steve Grazzini2003-06-091-2/+2
| | | | | Message-ID: <20030606054259.GA30249@grazzini.net> p4raw-id: //depot/perl@19729
* Fix another segfault case (warn called from UNIVERSAL::DESTROY).Adrian M. Enache2003-04-211-1/+5
| | | | | | | | | | Subject: Re: [perl #21347] segfault in UNIVERSAL::AUTOLOAD Date: Sun, 20 Apr 2003 02:45:48 +0300 Message-ID: <20030419234548.GA849@ratsnest.hole> and Date: Wed, 2 Apr 2003 07:52:28 +0300 Message-ID: <20030402045227.GA1023@ratsnest.hole> p4raw-id: //depot/perl@19300
* Fix bug #21347 (segfault in UNIVERSAL::AUTOLOAD with qr//)Adrian M. Enache2003-04-191-1/+7
| | | | | | | | | | by adding a dummy destructor method Regexp::DESTROY. This prevents infinite recursion, since Regexp::DESTROY is no more autoloaded. Subject: Re: [perl #21347] segfault in UNIVERSAL::AUTOLOAD Message-ID: <20030402020242.GA2966@ratsnest.hole> p4raw-id: //depot/perl@19277
* Re: [perl #9394] Re: [ID 20020525.002] coredump/ bad free warning in blead ↵Nicholas Clark2003-01-221-10/+31
| | | | | | | with SIGWARN Message-ID: <20030121222720.GG293@Bagpuss.unfortu.net> p4raw-id: //depot/perl@18557
* Re: [PATCH@8545] [ID 20000808.005] OP_REFGEN as an lvalueStephen McCamant2002-08-121-17/+21
| | | | | Message-ID: <14963.32943.102669.67625@soda.csua.berkeley.edu> p4raw-id: //depot/perl@17717
* which_perl for safer $^XingMichael G. Schwern2001-12-071-1/+1
| | | | | | | Message-ID: <20011207034544.GN22648@blackrider> (plus op/ref tweak) p4raw-id: //depot/perl@13506
* @INC tweak.Jarkko Hietaniemi2001-11-291-0/+5
| | | p4raw-id: //depot/perl@13352
* [PATCH] Re: $\ very brokenJarkko Hietaniemi2001-11-291-2/+17
| | | | | | | | | | | | From: Rafael Garcia-Suarez <rgarciasuarez@free.fr> Date: Wed, 28 Nov 2001 22:33:08 +0100 Message-ID: <20011128223308.E732@rafael> Subject: Re: [PATCH] Re: $\ very broken From: Nicholas Clark <nick@ccl4.org> Date: Wed, 28 Nov 2001 22:29:00 +0000 Message-ID: <20011128222859.K37621@plum.flirble.org> p4raw-id: //depot/perl@13345