Jesse Vincent [Wed, 8 Jun 2011 03:50:37 +0000 (23:50 -0400)]
Disable some threads tests on m68k for now due to missing TLS.
A backport from downstream at Debian:
perl (5.14.0-1) debian/m68k_thread_stress.diff
Subject: Disable some threads tests on m68k for now due to missing TLS.
Closes: #495826, #517938
Father Chrysostomos [Wed, 8 Jun 2011 03:44:28 +0000 (20:44 -0700)]
perldelta entries for lvalue and COW fixes
Father Chrysostomos [Wed, 8 Jun 2011 03:36:39 +0000 (20:36 -0700)]
Regenerate known_pod_issues.dat
Father Chrysostomos [Wed, 8 Jun 2011 03:30:24 +0000 (20:30 -0700)]
Update perldelta with entries copied from 5.14.1
Since I just updated 5.14.1’s perldelta, it made sense to go ahead and
do this. For a list of the commits that are dealt with here, log into
cherrymaint and look for anything recent marked ‘Cherry-picked’.
I did not bother including the Ubuntu library path and Darwin test
fixes. I don’t think they are worth mentioning, but others may disa-
gree... (‘may’ in both senses).
Father Chrysostomos [Wed, 8 Jun 2011 00:56:06 +0000 (17:56 -0700)]
Remove unnecessary TAINT_NOT
(Ignore this for perldelta.)
*++newsp = *MARK obviously does no tainting. The TAINT_NOT following
it was unnecessarily copied to S_return_lvalues from pp_return when
the former came into existence. (pp_return does need TAINT_NOT, as it
uses sv_mortalcopy, which calls sv_setsv_flags, which does tainting.)
Father Chrysostomos [Wed, 8 Jun 2011 00:05:06 +0000 (17:05 -0700)]
[perl #92290, #92406] Returning a pad var from lv sub
This fixes a recent (post-5.14.0) regression.
Commit bf8fb5e (the fix for #62498) introduced it for lvalue subs with
no return statement [perl #92406].
Commit fa1e92c (the fix for #72724) introduced it for lvalue subs that
do have an explicit return [perl #92290].
Simply returning a scalar itself from an lvalue sub does not work if
it is a pad variable with a reference count of 1. In that circum-
stance, the sub-popping code sees that the SV can be re-used the next
time the sub is called, so it undefines it and hangs on to it. So
the scalar returned gets emptied before the calling code can see it.
The reference count has to be increased temporarily, which sv_2mortal
and SvREFCNT_inc combined accomplish.
Father Chrysostomos [Tue, 7 Jun 2011 23:09:17 +0000 (16:09 -0700)]
Correct test names in sub_lval.t
Leon Brocard [Tue, 7 Jun 2011 20:29:26 +0000 (21:29 +0100)]
Expand a little on what to do with Module::CoreList and maint
Leon Brocard [Tue, 7 Jun 2011 20:28:57 +0000 (21:28 +0100)]
Update Module::CoreList for 5.12.4
Father Chrysostomos [Tue, 7 Jun 2011 15:42:58 +0000 (08:42 -0700)]
Fix broken link in perlfunc
Father Chrysostomos [Tue, 7 Jun 2011 15:31:11 +0000 (08:31 -0700)]
Add Bo Johansson to AUTHORS
I think the e-mail address is misspelt, but that is what was
provided in the patch
bojilund [Tue, 7 Jun 2011 08:24:43 +0000 (10:24 +0200)]
Add information about portability caveats related to using kill on forked process.
The outcome of kill on a pseudo-process in Windows is unpredictable
and it should not be used except under dire circumstances.
The process which implements the pseudo-processes can be blocked
and the Perl interpreter hangs.
bojilund [Tue, 7 Jun 2011 07:32:31 +0000 (09:32 +0200)]
Improve documentation to support portability
If something has a portability issue, we should mention it in the main
place people will read about the thing with the issue. For Perl
built-ins, that's perlfunc. We don't have to explain the issue, but we
should at the very least tell people where to find an explanation of
the issue.
David Golden [Tue, 7 Jun 2011 10:35:22 +0000 (06:35 -0400)]
perldelta.pod: added summary of formline changes
Summary paragraph received by email from Dave Mitchell.
Karl Williamson [Tue, 7 Jun 2011 03:29:18 +0000 (21:29 -0600)]
perldelta: Add potential entries
I looked through all my commits, and came up with this text for all the
ones I think could possibly be desired to put into the perldelta. All
other commits I've made for 5.15 so far, can be ignored IMO as far as
the delta is concerned. I'm not so sure about even the ones I've
done here. Feel free to omit them. The wording for the edge case is
convoluted; but it's hard for me to describe the complicated
circumstances when the bug appeared.
David Golden [Mon, 6 Jun 2011 22:39:39 +0000 (18:39 -0400)]
git-deltatool: added a progress counter
Now shows "Commit N of M" so there is a sense of progress while
reviewing commit history
Pau Amma [Mon, 6 Jun 2011 20:39:19 +0000 (13:39 -0700)]
pod punctuation nit in vmsish
Nicholas Clark [Mon, 6 Jun 2011 11:40:40 +0000 (13:40 +0200)]
Test that IPC::Open{2,3} correctly fault read-only file-handle parameters.
Nicholas Clark [Mon, 6 Jun 2011 11:30:51 +0000 (13:30 +0200)]
Test that IPC::Open{2,3} correctly qualify file handles to their package.
Nicholas Clark [Mon, 6 Jun 2011 11:12:54 +0000 (13:12 +0200)]
In IPC-Open2.t, use functions other than ok(), to generate better diagnostics.
Nicholas Clark [Mon, 6 Jun 2011 10:42:58 +0000 (12:42 +0200)]
In IPC-Open3.t, merge two similar tests using a loop.
David Mitchell [Mon, 6 Jun 2011 18:09:31 +0000 (19:09 +0100)]
[perl #90006] out of memory during thread clone
If you run out of memory during thread cloning, exit() may be called which
will unwind the context stacks, and be very unhappy if there aren't any.
Which there might not be if we haven't allocated any yet during cloning.
We can't just fix this by creating them earlier during the cloning
sequence, because creating them requires calling malloc(), which
may fail and exit...
So just check for this condition during stack unwind.
David Mitchell [Mon, 6 Jun 2011 16:15:09 +0000 (17:15 +0100)]
[perl #90006] cloning crashes during Out of Memory
Perl's malloc has a $^M facility to create an emergency memory
allocation during an Out Of Memory crisis. This requires accessing
PL_defstash. In perl_clone_using(), in debugging builds, the Idefstash
field was intially poisoned, and before it had a chance to be properly
initialised, malloc() may have been called.
Fix this by initialising PL_defstash to NULL early on.
David Mitchell [Mon, 6 Jun 2011 15:01:12 +0000 (16:01 +0100)]
perl_clone_using: do simple assign/copying first
For all the elements of the interpreter that can be cloned by
a simple initialisation (e.g. assign NULL/0/-1), or by a direct
copy from proto, do these first. This means that anything more complex,
that might for example require a malloc, gets done after as much of the
interpreter structure has already been initialised as possible.
This is the beginnings of a fix for [perl #90006].
This commit should have no change in functionality; it's simply moving a
bunch of assign statements to earlier within perl_clone_using().
David Mitchell [Mon, 6 Jun 2011 13:02:24 +0000 (14:02 +0100)]
[perl #88776] Signedness warning in toke.c
fix a warning introduced by
6d51015587940c2032a6533d886163f69ca028f9
David Mitchell [Mon, 6 Jun 2011 11:39:08 +0000 (12:39 +0100)]
perlfunc: fix error in open("-|") description
both 'to child' and 'from child' were listed as "|-"
David Mitchell [Mon, 6 Jun 2011 10:19:37 +0000 (11:19 +0100)]
clarify eval $string scope in docs
[perl #88014] demonstrated that the docs for string eval misleadingly
implied that the code wasn't executed within new new block scope,
leading to false expectations that $1 etc would retain their values
outside the eval.
Father Chrysostomos [Mon, 6 Jun 2011 05:37:54 +0000 (22:37 -0700)]
[perl #92258] <$fh> hangs on a glob copy
Opening a file handle to \$glob causes assertion failures
(under debugging) or hangs or other erratic behaviour without
debugging. This might even crash in some cases.
It never really worked properly, but it didn’t start hanging
apparently until 5.12.2 and 5.14.0.
Father Chrysostomos [Mon, 6 Jun 2011 03:09:13 +0000 (20:09 -0700)]
Remove two pointless uses of sv_2mortal
boolSV returns an immortal. When sv_2mortal is called on
an immortal, it simply returns. So eliminate the call.
Father Chrysostomos [Sun, 5 Jun 2011 21:01:57 +0000 (14:01 -0700)]
Add Samuel Thibault to AUTHORS
Samuel Thibault [Wed, 4 Aug 2010 10:34:05 +0000 (13:34 +0300)]
Make hints/gnu.sh append to $ccflags rather than overriding them
Bug-Debian: http://bugs.debian.org/587901
Don't override possible extra $ccflags values given to Configure
on GNU/Hurd.
Father Chrysostomos [Sun, 5 Jun 2011 05:00:44 +0000 (22:00 -0700)]
Make Storable freeze COWs properly
It was freezing them as read-only scalars.
Father Chrysostomos [Sun, 5 Jun 2011 02:14:33 +0000 (19:14 -0700)]
Make Devel::Peek::fill_mstats work on COWs
Father Chrysostomos [Sun, 5 Jun 2011 02:01:59 +0000 (19:01 -0700)]
Get PerlIO::scalar to write to COWs
Father Chrysostomos [Sun, 5 Jun 2011 00:55:22 +0000 (17:55 -0700)]
Add John Hawkinson to AUTHORS
John Hawkinson [Sun, 5 Jun 2011 00:54:26 +0000 (17:54 -0700)]
[perl #92234] Annoying typos in README.macosx
README.macosx in the HEAD (and back to at least 5.8.9) misspells
-Duseshrplib twice in two different wrong ways. This makes it a bit
annoying to find the right flag use :(
Dominic Hargreaves [Sat, 4 Jun 2011 22:45:45 +0000 (23:45 +0100)]
Refer to X11 rather than "X windows"
Father Chrysostomos [Sun, 5 Jun 2011 00:42:38 +0000 (17:42 -0700)]
Add Dominic Hargreaves to AUTHORS
Dominic Hargreaves [Sun, 5 Jun 2011 00:41:24 +0000 (17:41 -0700)]
[perl #92228] Mention diagnostics pragma in perldiag
This was originally reported at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485467:
Father Chrysostomos [Sun, 5 Jun 2011 00:40:05 +0000 (17:40 -0700)]
Add Nobuhiro Iwamatsu to AUTHORS
Nobuhiro Iwamatsu [Sun, 5 Jun 2011 00:38:58 +0000 (17:38 -0700)]
Update lengthen time-out time for t/re/re.t.
When we carry out this test on SH4, it becomes the time-out.
2 seconds are set in watchdog, but are too short for SH4.
This patch was changed for 10 seconds.
$ time ./perl t/re/re.t
1..19
ok 1 - is_regexp(REGEXP ref)
ok 2 - is_regexp(REGEXP)
ok 3 - is_regexp("")
ok 4 - regexp_pattern[0] (ref)
ok 5 - regexp_pattern[1] (ref)
ok 6 - scalar regexp_pattern (ref)
ok 7 - regexp_pattern[0] (bare REGEXP)
ok 8 - regexp_pattern[1] (bare REGEXP)
ok 9 - scalar regexp_pattern (bare REGEXP)
ok 10 - !regexp_pattern("")
ok 11 - regnames
ok 12 - regnames
ok 13 - regnames in scalar context
ok 14 - regnames
ok 15
ok 16
ok 17
ok 18
ok 19 - Didn't loop
real 0m7.482s
user 0m3.848s
sys 0m0.036s
Father Chrysostomos [Sat, 4 Jun 2011 21:31:58 +0000 (14:31 -0700)]
Add Pau Amma to AUTHORS
Pau Amma [Sat, 4 Jun 2011 21:31:07 +0000 (14:31 -0700)]
move "garbage collection" glossary entry where it belongs
Father Chrysostomos [Sat, 4 Jun 2011 20:10:41 +0000 (13:10 -0700)]
Stop localised ties from becoming ro when COW
Father Chrysostomos [Sat, 4 Jun 2011 18:58:14 +0000 (11:58 -0700)]
Allow restricted hashes containing COWs to be cleared
Father Chrysostomos [Sat, 4 Jun 2011 18:54:10 +0000 (11:54 -0700)]
Allow COW values to be deleted from restricted hashes
I wonder how many other things a604c75 broke....
Father Chrysostomos [Sat, 4 Jun 2011 18:38:02 +0000 (11:38 -0700)]
Allow lvalue subs to return COWs in reference context
(That’s ‘reference’ as in ‘pass by reference’. It applies to
foo(lvalue_func()) and for(lvalue_func()).)
Commit f71f472 took care of scalar context.
Commit a0aa607 came and long and took care of list context, but,
unfortunately, missed reference context.
This commit takes care of that.
Karl Williamson [Sat, 4 Jun 2011 20:41:25 +0000 (14:41 -0600)]
Add tests for [perl #87908]
Father Chrysostomos [Sat, 4 Jun 2011 13:44:01 +0000 (06:44 -0700)]
Fix several array-returning bugs in lvalue subs
This finishes fixing bug #23790.
When called in reference context (for(...) or map $_, ...), lvalue
subs returning arrays or hashes would return the AV or HV itself, as
though it were lvalue context.
The result was that $_ would be bound to an AV or HV, which is not
supposed to happen, as it’s a scalar (that’s when you start getting
‘Bizarre copy’ errors).
Commit
91e34d82 fixed this in pp_leavesublv, but the if condition it
added was placed outside the loop, so it only applied when the array
was the first thing returned. It also did not take hashes into account.
By changing the lvalue-context check in pp_padav, pp_padhv and
pp_rv2av (which also serves as pp_rv2hv), I was able to apply a more
general fix, which also fix another bug: Those array and hash ops were
croaking when called in scalar reference context (...->$method).
Because it is no longer part of the sub-leaving code, explicitly
returning an array in reference context works now, too.
This commit also eliminates the code added by
91e34d82, as it’s no
longer necessary.
Father Chrysostomos [Sat, 4 Jun 2011 12:53:29 +0000 (05:53 -0700)]
Get f_map.t working on non-threaded perls
(broken by 767eda4)
Father Chrysostomos [Sat, 4 Jun 2011 05:14:41 +0000 (22:14 -0700)]
Teach B::Concise about OPpMAYBE_LVSUB
Father Chrysostomos [Sat, 4 Jun 2011 04:50:35 +0000 (21:50 -0700)]
Remove duplicate test
Father Chrysostomos [Sat, 4 Jun 2011 04:34:45 +0000 (21:34 -0700)]
[perl #88138] ' is not equivalent to :: before a null
' is usually equivalent to :: in a symbol name. At the *end* of a
symbol name (as in $'), it’s not equivalent. (That’s a feature.)
Perl_gv_fetchpvn_flags was checking for the end by saying
if(next character), which returns false for a null. It should be
checking the length, which it was already doing for ::, and which
this commit makes it do.
Father Chrysostomos [Sat, 4 Jun 2011 03:06:24 +0000 (20:06 -0700)]
[perl #7946] Lvalue subs do not autovivify
This commit makes autovivification work with lvalue subs. It follows
the same technique used by other autovivifiable ops (aelem, helem,
tc.), except that, due to flag constraints, it uses a single flag and
instead checks the op tree at run time to find out what sort of thing
to vivify.
The flag constraints are that these two flags:
#define OPpENTERSUB_HASTARG 32 /* Called from OP tree. */
#define OPpENTERSUB_NOMOD 64 /* Immune to op_lvalue() for :attrlist. */
conflict with these:
#define OPpDEREF (32|64) /* autovivify: Want ref to something: */
#define OPpDEREF_AV 32 /* Want ref to AV. */
#define OPpDEREF_HV 64 /* Want ref to HV. */
#define OPpDEREF_SV (32|64) /* Want ref to SV. */
Renumbering HASTARG and NOMOD is problematic, as there are places in
op.c that change entersubs into rv2cvs, and the entersub and rv2cv
flags would conflict. Setting the flags correctly when changing the
type is hard and would result in subtle bugs if not done perfectly.
Ops like ${...} don’t actually autovivify; it’s the op inside that
does it. In those cases, the parent op is flagged with OPpDEREFed, and
it skips get-magic, as it has already been called by the inner op.
Since entersub is now marked as being an autovivifying op, ${...} in
lvalue context ends up skipping get-magic if there is a foo() inside.
And this affects even regular subs. So pp_leavesub and pp_return have
to call get-magic; hence the new tests in gmagic.t.
Father Chrysostomos [Fri, 3 Jun 2011 21:20:10 +0000 (14:20 -0700)]
Follow-up to
d34a6664
As Nicholas Clark wrote in
nntp://nntp.perl.org/
20110603192458.GZ2604@plum.flirble.org:
> $ valgrind ./perl -Ilib 91880.pl
> ==5542== Memcheck, a memory error detector
...
> I think that the problem is that this code in S_run_user_filter()
>
> ENTER_with_name("call_filter_sub");
> SAVEGENERICSV(GvSV(PL_defgv));
> SAVETMPS;
> EXTEND(SP, 2);
>
>
> is putting an action on the save stack to write to an address within
> the GP of PL_defgv. However, the perl code run about 10 lines later
> frees up the GP of PL_defgv, so the scope stack now has a dangling
> pointer. 12 lines later at scope exit, the scope stack unwinding
> writes to the pointer, and nasal daemons emerge.
This commit precedes the SAVEGENERICSV with a call to save_gp, to make
sure the GP is not freed (and then a call to GvINTRO_off [set by
save_gp], so that subsequent glob assignments are not implicitly
localised).
This basically emulates what happens with ‘local *_ = \$some_scalar’,
but without the extra intermediate RV.
Father Chrysostomos [Fri, 3 Jun 2011 16:25:21 +0000 (09:25 -0700)]
Correct entersub/rv2cv priv constants in B::Concise
See the commit message of d4ddbae for detail.
Father Chrysostomos [Fri, 3 Jun 2011 13:41:48 +0000 (06:41 -0700)]
Fix a confusing comment in perly.y
There’s no arrow there.
Father Chrysostomos [Fri, 3 Jun 2011 13:26:18 +0000 (06:26 -0700)]
Rearrange some private op flag constants
Some constants in op.h were a bit muddled up and were not grouped
according to which ops used them. And one of the comments was wrong.
The history is a bit involved:
Commit 7a52d87 added this comment, which was correct:
+ /* OP_RV2CV only */
#define OPpENTERSUB_AMPER 8 /* Used & form to call. */
Commit 9675f7a added this constant:
/* OP_RV2CV only */
#define OPpENTERSUB_AMPER 8 /* Used & form to call. */
+#define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */
Commit cd06dff added this one, which is confusing, as it is only used
on entersub:
/* OP_RV2CV only */
#define OPpENTERSUB_AMPER 8 /* Used & form to call. */
#define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */
+#define OPpENTERSUB_INARGS 4 /* Lval used as arg to a sub. */
Commit e26df76 added this, resulting in there being two
OP_RV2CV sections:
+ /* OP_RV2CV only */
+#define OPpMAY_RETURN_CONSTANT 1 /* If a constant sub, return the constant */
+
To top it all, commit b900987 unfortunately ‘fixed’ a mislead-
ing comment:
- /* OP_RV2CV only */
+ /* OP_ENTERSUB and OP_RV2CV only */
#define OPpENTERSUB_AMPER 8 /* Used & form to call. */
#define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */
#define OPpENTERSUB_INARGS 4 /* Lval used as arg to a sub. */
Father Chrysostomos [Fri, 3 Jun 2011 04:18:50 +0000 (21:18 -0700)]
Move the lvalue code from pp_return into a separate func
so that upcoming commits can add more conditions without
slowing down the most common cases, and so that it can
eventually be merged with pp_leavesublv.
Jim Cromie [Wed, 1 Jun 2011 04:15:11 +0000 (22:15 -0600)]
regexp.h: work around -Werror compile failure of XS in linux perf tool
The linux perf tool has an XS component, but when built using system
perl 5.14.0, its compilation errors out on the switch statement in
regexp.h: get_regex_charset_name(), which lacks a default case. Add
one, copying the end-of-function return "?".
Preserve the end-of-function return "?", to avoid a hypothetical
compiler bug which misses the default case, and infers a void return
for a function thats declared otherwize.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Father Chrysostomos [Thu, 2 Jun 2011 17:55:49 +0000 (10:55 -0700)]
[perl #4362] Test for ‘Can't find terminator’
Father Chrysostomos [Thu, 2 Jun 2011 13:01:57 +0000 (06:01 -0700)]
Deparse $obj->$meth=... [perl #62498]
When an lvalue method-as-variable is compiled, the method
op has a sibling that is an rv2cv:
a <2> sassign vKS/2 ->b
3 <$> const[IV 1] s ->4
9 <1> entersub[t3] sKRMS*/NO(),TARG ->a
4 <0> pushmark s ->5
- <1> ex-rv2sv sKM/1 ->6
5 <#> gvsv[*obj] s ->6
7 <1> method sK/1 ->8
- <1> ex-rv2sv sK/1 ->7
6 <#> gvsv[*meth] s ->7
8 <1> rv2cv /NO() ->9
Deparse didn’t know about it, and was iterating through the
children of entersub, thinking the last one was the method,
stopping at any item named ‘method_named’. So I modified it
to stop at ‘method’ as well.
Nicholas Clark [Thu, 2 Jun 2011 08:51:14 +0000 (09:51 +0100)]
Tweak the test from
183eb698e2ceb8ab to work with PERL_UNICODE set.
One should always generate the golden B::Concise output with PERL_UNICODE set
so that ${^OPEN} is set, as the test system knows how to take it out, not put
it in.
Father Chrysostomos [Thu, 2 Jun 2011 01:00:45 +0000 (18:00 -0700)]
Collapse some repetitive code
Father Chrysostomos [Thu, 2 Jun 2011 00:50:45 +0000 (17:50 -0700)]
Deparse glob the same way regardless of PERL_EXTERNAL_GLOB
This should fix the recent new failure in the VMS smokes
(since 2f77d7b).
Father Chrysostomos [Wed, 1 Jun 2011 23:37:17 +0000 (16:37 -0700)]
[perl #62498] Scalar context breaks lvalue subs
That RT ticket reported that a $ prototype puts an implicit scalar()
on its argument, and that scalar(lvalue()) causes the function to
return a temporary value. In particular:
${\scalar($_)} = 1; # ok
${\scalar f()} = 1; # no effect
(where f is an lvalue sub that returns $_).
It turns out that this does not only affect scalar(), but also
|| and &&:
${\($_ && undef)} = 3; # ok
${\(f() && undef)} = 3; # no effect
Also, that comment in pp_leavesublv about f()->meth() not being lvalue
context is wrong, as
$o->${\sub { $_[0] = "whatever" }};
assigns to $o, and
sub UNIVERSAL::undef { undef $_[0] }
allows calls like
$x->undef
to undefine $x, if it contains an object or package name.
Since copying values in rvalue context is wasteful anyway, since the
definition of rvalue context is that the value is going to be copied
(resulting in *two* copies), the easiest solution is not to copy val-
ues in rvalue context.
This ends up applying to what I call ‘reference’ context (semi-lvalue,
or potential lvalue) as well.
This works already with explicit return.
As a bonus, this also fixes bug #78680, for which there are already
to-do tests that were added before the bug was reported. See also:
http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=
20060118203058.GQ616@plum.flirble.org
Jim Cromie [Wed, 1 Jun 2011 21:13:40 +0000 (14:13 -0700)]
[perl #91946] add constant folding tests
test arithmetic folding, conditional folding (both true & false),
and string, lc() & uc() folds, and mixed string.int folds.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Father Chrysostomos [Wed, 1 Jun 2011 21:11:37 +0000 (14:11 -0700)]
Warn when list-assigning to TEMP
Father Chrysostomos [Wed, 1 Jun 2011 21:07:04 +0000 (14:07 -0700)]
Tests for XS lvalue functions
including the ‘Useless assignment to a temporary’ warning
which is only triggered by these.
Father Chrysostomos [Wed, 1 Jun 2011 20:24:46 +0000 (13:24 -0700)]
Correct mistake in perldelta temlate
Jim Cromie [Tue, 31 May 2011 16:47:29 +0000 (10:47 -0600)]
perlhack.pod: invoke git-format-patch with --attach
As George Greer noted on p5p, --attach causes the message to be
written using MIME-attach syntax, so when perlbug sends it,
rt.perl.org detaches the file and adds it to the ticket.
While tradtional inline patches appear to survive without whitespace
mangling, attachments are more in keeping with RTs design and use.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Jim Cromie [Fri, 27 May 2011 17:33:30 +0000 (11:33 -0600)]
perlbug: replace all $::opt_* with %opt
patch does:
perl -pi -e 's/$::opt_(\w)/$opt{$1}/g' perlbug.PL
adds my %opt decl, and in getopts.
drops no warnings 'once'
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Craig A. Berry [Wed, 1 Jun 2011 12:36:23 +0000 (07:36 -0500)]
Add alternate e-mail for Dennis Kaarsemaker.
Dennis Kaarsemaker [Tue, 31 May 2011 21:10:52 +0000 (23:10 +0200)]
Advise the pumpking to make new maint branches available in the APC
Father Chrysostomos [Wed, 1 Jun 2011 04:56:35 +0000 (21:56 -0700)]
Remove unnecessary stuff from sub_lval.t
I cannot find any information on these, but that comment
is erroneous and that sub is not doing anything.
Father Chrysostomos [Wed, 1 Jun 2011 04:55:13 +0000 (21:55 -0700)]
Revert "Accept lvalue subroutines as a useful feature."
This reverts commit
c72c0c0bdd3dbc2b529b28a4f324a1cc149a6453
at Jesse’s request.
Father Chrysostomos [Wed, 1 Jun 2011 04:54:25 +0000 (21:54 -0700)]
Revert "Remove a line added by the prev commit"
This reverts commit
6b8305409e650748b2e6fb75634200370b69238b
at Jesse’s request.
Father Chrysostomos [Wed, 1 Jun 2011 04:46:55 +0000 (21:46 -0700)]
It’s still the 20th century?
Father Chrysostomos [Wed, 1 Jun 2011 04:32:28 +0000 (21:32 -0700)]
Make empty lvalue subs work correctly
In perl 5.8.1 and earlier, sub{} would return @_ in list context. This
was fixed in 5.8.2 for regular subs, but not lvalue subs.
Before the syntactic restriction on return values was removed in
commit 145b2bb, there was a bug affecting compilation of empty subs
before any use statement:
$ perl5.14.0 -e 'sub foo :lvalue {}'
Can't modify stub in lvalue subroutine return at -e line 1, near "{}"
Execution of -e aborted due to compilation errors.
$ perl5.14.0 -le 'use sigtrap; sub foo :lvalue {} print "ok"'
ok
But I digress. :-)
Up to 5.14, lvalue subs were still returning @_, or, rather, the ele-
ments of @_ as separate scalars:
$ perl5.14.0 -Mre -le '(sub :lvalue {}->($a,$b))=(3,4); print "$a $b"'
Useless use of "re" pragma at -e line 0
3 4
(Not exactly useless, eh? The -Mre allows the sub to compile.)
This commit fixes that bug.
Father Chrysostomos [Wed, 1 Jun 2011 03:07:32 +0000 (20:07 -0700)]
Remove a line added by the prev commit
Lvalue subs *can* return lists
Johan Vromans [Mon, 30 May 2011 06:03:03 +0000 (08:03 +0200)]
Accept lvalue subroutines as a useful feature.
Support for lvalue subroutines has been stable and reliable for more
than 10 years. Despite this, they are still marked as being
experimental.
This patch removes the 'experimental' warnings from the docs, and
adjusts the description accordingly.
Father Chrysostomos [Wed, 1 Jun 2011 01:13:43 +0000 (18:13 -0700)]
Allow rvalue syntax in expr returned from lvalue sub
This changes the syntax of the last statement and the arguments to
‘return’ in an lvalue subroutine to be the same as that of a non-
lvalue routine. This almost finishes the work begun by commit fa1e92c.
(return still needs to enforce the same rules as leavesublv.)
Father Chrysostomos [Wed, 1 Jun 2011 00:09:15 +0000 (17:09 -0700)]
Allow lvalue subs to return TEMPs
This is perhaps not ideal, but it fixes (or allows to be fixed) seve-
ral bugs.
I was hoping that the cases that this perhaps erroneously allows
through would fall back to the warning I added in commit 8fe85e3, but,
unfortunately, in all these cases the refcount is greater than 1 when
pp_sassign is reached.
To be less vague: ‘foo() = 3’ warns if foo() returns a TEMP with no
set-magic and a refcount of 1 (meaning it will be freed shortly). But
truly temporary values returned by pure-Perl lvalue subs have a refer-
ence count of at least 2, and as many entries on the mortals stack.
I cannot distinguish between truly temporary values and those that
are but nominally temporary (marked TEMP because the refcount will go
down, but not to zero) by checking for a refcount <= 2 in pp_sassign,
because this example returns with a refcount of 2:
+sub :lvalue { return delete($_[0]), $x }->($x) = 3; # returns a TEMP
There’s no logical reason why that shouldn’t work, if this does:
+sub :lvalue { return foo(), $x }->($x) = 3; # not TEMP
as they are conceptually identical.
The advantages to this change:
• The delete example above will work.
• It allows XS lvalue subs that return TEMPs to work in the debugger
[perl #71172], restoring the bug fix that b724cc1 implemented but
c73030b reverted.
• It makes these three cases identical, as they should be. Note that
only two of them return TEMPs:
+sub :lvalue { return shift }->($x) = 3;
+sub :lvalue { \@_; return shift }->($x) = 3; # returns a TEMP
+sub :lvalue { return delete $_[0] }->($x) = 3; # returns a TEMP
So I think the advantages outweigh the disadvantages.
Father Chrysostomos [Tue, 31 May 2011 21:42:14 +0000 (14:42 -0700)]
Revert "Allow returning of temps and ro’s from lv subs"
This reverts commit
b724cc14b25929aee44eee20bd26102cceb520b6.
Lvalue subroutines are more of a mess than I realised when I made
that commit.
I just tried removing the syntactical restriction on what the last
statement or the argument to return can be in an lvalue sub. It opened
a whole can of worms.
PADTMPs are bizarre creatures that have somewhat erratic behaviour.
Since assigning to a PADTMP is almost always a mistake (since the
value will definitely be discarded), those *should* be disallowed,
when the sub is called in lvalue context. That also avoids propagating
a whole load of bugs when referencing PADTMPs, aliasing to them, etc.
Read-only scalars end up triggering a ‘Modification of a read-only
value attempted’ message without the restrictions in pp_leavesublv,
but the message the latter was providing (which this revert restores)
is clearer (‘Can't return a readonly value from lvalue subroutine’).
Speaking of lvalue context, there are three types of context with
regard to lvalue-ness (orthogonal to the usual void/scalar/list
contexts):
• rvalue context ($x = func())
• lvalue context (func() = $x)
• semi-lvalue context (\func())
Each is handle by a separate code path in pp_leavesublv:
• rvalue context - any value can be returned; it’s copied (waste-
ful, perhaps?)
• semi-lvalue context - any value can be returned; it’s not copied
• lvalue context - stringent rules about what can and cannot be
returned (which this revert restores)
So it is perfectly fine to restrict what can be returned from an
lvalue sub *in true lvalue context*, without affected rvalue use.
Now, regarding TEMPs, although this commit restores the restriction on
returning TEMPs, a forthcoming commit will relax that restriction once
more, since it causes bugs.
Karl Williamson [Tue, 31 May 2011 15:22:13 +0000 (09:22 -0600)]
reflags.t: Remove no longer applicable TODO
When this test was written, t the new 5.14 regex modifiers were
not usable in suffix notation. That changed before 5.14 shipped,
but the test did not.
Karl Williamson [Tue, 31 May 2011 15:19:11 +0000 (09:19 -0600)]
regcomp.c: Add comment
Jim Cromie (via RT) [Sun, 29 May 2011 01:39:48 +0000 (18:39 -0700)]
perlhack.pod: fix perlbug invocation
In perlhack,
% perlbug -s "[PATCH] $(git log -1 --format=%s HEAD)" -f 0001-*.patch
is incomplete; --format=%s needs a proper value.
Use --oneline instead, as it also --abbrev(iates) sha1
$ git log --oneline -1
c8dfc96 regexp.h: repair linux perf compilation
Note that HEAD is optional, but just as clear as <branch-name>.
David Mitchell [Tue, 31 May 2011 12:45:55 +0000 (13:45 +0100)]
[perl #91790] Perlguts documentation for sv_setref_pv
The section of documentation in perlguts for the sv_setref_* functions
was ambiguous: it wasn't clear whether each paragraph was referring to
the function above or below it. Fix this by prepending lots of "The
following function...".
Also fix a couple of functions signatures.
Father Chrysostomos [Tue, 31 May 2011 06:01:39 +0000 (23:01 -0700)]
Allow lvalue subs to return COWs in list context
Commit f71f472 missed list assignment. :-(
Father Chrysostomos [Tue, 31 May 2011 03:43:03 +0000 (20:43 -0700)]
Allow returning of temps and ro’s from lv subs
This commit removes the restriction on returning temps and read-only
scalars from lvalue subs that occurs when the sub returns implicitly
(with no ‘return’ statement; ‘return’ has never had that restriction).
It does not actually help pure-Perl lvalue subs much yet, as op.c
still enforces lvalue syntax on the last statement.
But this should fix bug #71172, allowing XS lvalue subs to work under
the debugger.
Father Chrysostomos [Tue, 31 May 2011 02:00:51 +0000 (19:00 -0700)]
[perl #72706] Test recursive substr lvalue
Father Chrysostomos [Tue, 31 May 2011 01:45:26 +0000 (18:45 -0700)]
Make explicit return in lvalue subs work under recursion
This is something that fa1e92c missed.
Father Chrysostomos [Mon, 30 May 2011 21:48:18 +0000 (14:48 -0700)]
Bump DD’s version to 1.05
5.14.1 is now using the number 1.04.
Father Chrysostomos [Mon, 30 May 2011 16:52:36 +0000 (09:52 -0700)]
Add Craig DeForest to AUTHORS
Father Chrysostomos [Mon, 30 May 2011 16:49:36 +0000 (09:49 -0700)]
[perl #31946] Warn when assigning to a TEMP
This is the first step in downgrading a fatal error (Can't return a
temporary from lvalue subroutine) to a warning. Currently only XS
lvalue routines that return TEMPs and pure-Perl lvalue routines that
use explicit return (which don’t quite work properly yet anyway,
despite commit fa1e92c) are affected by this.
This is implemented in pp_sassign and pp_aassign, rather than
pp_leavesublv, so it will affect explicit returns and so it will
be skipped for overloaded ‘.=’, etc.
Thanks to Craig DeForest for suggesting how to do this.
Father Chrysostomos [Mon, 30 May 2011 15:55:40 +0000 (08:55 -0700)]
[perl #91880] $_ refcounting problems in @INC filters
In @INC filters (subs returned by subs in @INC), $_ is localised to a
variable to which the next line of source code is to be assigned. The
function in pp_ctl.c that calls it (S_run_user_filter) has a pointer
to that variable.
Up till now, it was not setting the refcount or localising
$_ properly.
‘undef *_’ inside the sub would destroy the only refcount it
had, leaving a freed sv for toke.c to parse (which would crash,
of course).
In some cases, S_run_user_filter has to created a new variable. In
those cases, it was setting $_ to a mortal variable with the TEMP
flag, but with a refcount of 1, which would result in ‘Attempt to free
unreferenced scalar’ warnings if the $_ were freed by the subroutine.
This commit changes S_run_user_filter to use SAVEGENERICSV, rather
than SAVE_DEFSV, to localise $_, since the former lowers the refcount
on scope exit, while the latter does not. So now I have also made it
increase the refcount after assigning to the now-properly-localised $_
(DEFSV). I also turned off the TEMP flag, to avoid weird side effects
(which were what led me to this bug to begin with).
Father Chrysostomos [Mon, 30 May 2011 03:39:33 +0000 (20:39 -0700)]
2nd try: [perl #91834] utf8::decode does not respect copy-on-write
I reverted the first version of this patch because I put the if()
statement before a declaration. I did a revert, rather than a correc-
tion, to make back-porting easier.
Father Chrysostomos [Mon, 30 May 2011 03:36:05 +0000 (20:36 -0700)]
Revert "[perl #91834] utf8::decode does not respect copy-on-write"
This reverts commit
40f11004fb3b5fa1cd207a20090df837d721b736.
Karl Williamson [Mon, 30 May 2011 03:14:51 +0000 (21:14 -0600)]
mktables: Avoid possible user-defined property
Properties with no elements are defined in terms of the complement
of the property which matches all of Unicode: \p{Any}. But it
currently is defined in terms of IsAny, which is user-overridable;
Just drop the 'Is'
Father Chrysostomos [Sun, 29 May 2011 21:21:06 +0000 (14:21 -0700)]
[perl #91834] utf8::decode does not respect copy-on-write
utf8::decode was not respecting copy-on-write, but simply modify-
ing the PV (the scalar’s string buffer) in place, causing problems
with hashes:
my $name = "\x{c3}\x{b3}";
my ($k1) = keys %{ { $name=>undef } };
my $k2 = $name;
utf8::decode($k1);
utf8::decode($k2);
print "k1 eq k2 = '", $k1 eq $k2, "'\n";
my $h = { $k1 => 1, $k2 => 2 };
print "{k1} '", $h->{$k1}, "'\n";
print "{k2} '", $h->{$k2}, "'\n";
This example (from the RT ticket) shows that there were two hash ele-
ments with the same key.
As of this commit, the hash only has one element.