Father Chrysostomos [Tue, 19 Apr 2011 04:29:11 +0000 (21:29 -0700)]
Make keys $scalar an lvalue
This does a run-time check to see whether $scalar is a hash ref, and
dies if it is not.
This is to keep keys \@_ consistent with keys @_.
I cannot simply use OPf_MOD, since that indicates *potential* lvalue
context (including subroutine args).
So, instead, I take advantage of the fact that OPf_SPECIAL is always
set on the LHS of an assignment (usually to indicate that local()
should not erase the value).
Karl Williamson [Tue, 19 Apr 2011 03:42:18 +0000 (21:42 -0600)]
perlop: Update for some 5.14 changes
Karl Williamson [Tue, 19 Apr 2011 03:35:33 +0000 (21:35 -0600)]
perluniintro: Update for 5.14 changes
Karl Williamson [Tue, 19 Apr 2011 03:28:07 +0000 (21:28 -0600)]
perlunicode.pod: Nits
Karl Williamson [Tue, 19 Apr 2011 03:21:39 +0000 (21:21 -0600)]
perlre: Remove false statement about locales
Craig A. Berry [Tue, 19 Apr 2011 02:51:08 +0000 (21:51 -0500)]
VMS section clean-up for perldelta.
Tom Christiansen [Tue, 19 Apr 2011 02:30:35 +0000 (12:30 +1000)]
perldelta editing pass
Father Chrysostomos [Tue, 19 Apr 2011 00:50:05 +0000 (17:50 -0700)]
Remove ambigous warning from perldiag
This no longer happens as of commit 7ac5715.
Father Chrysostomos [Tue, 19 Apr 2011 00:44:01 +0000 (17:44 -0700)]
Make keys/value/each $scalar accept only unblessed refs
See ticket #80626.
Andy Dougherty [Mon, 18 Apr 2011 17:42:22 +0000 (13:42 -0400)]
collapse plibpth to one line and remove trailing /
The recent change to hints/linux.sh,
40f026236b9959b7ad3260fedc6c66cd30bb7abc
set the plibpth variable.
It was supposed to set all entries on a single line, but it didn't.
Do it now, and also remove trailing /'s.
(The collapsing is a more robust version of the previous commit,
since reverted, that davem wrote independently).
David Mitchell [Mon, 18 Apr 2011 22:53:42 +0000 (23:53 +0100)]
Revert "collapse plibpth to one line"
This reverts commit
55e4a474ad63535e486bd657f45b5339709cbcd3.
In improved version is coming next...
David Mitchell [Mon, 18 Apr 2011 22:43:27 +0000 (23:43 +0100)]
collapse plibpth to one line
The recent change to hints/linux.sh,
40f026236b9959b7ad3260fedc6c66cd30bb7abc
set the plibpth variable.
It was supposed to set all entries on a single line, but it didn't.
Do it now,
David Mitchell [Mon, 18 Apr 2011 18:29:52 +0000 (19:29 +0100)]
configpm: handle multi-line key='value\n...'
There is old code in configpm to handle mulit-line entries in config.sh
along the lines of
plibpth='/lib/x86_64-redhat-linux/4.4.5/
/lib/../lib64/
/usr/lib/x86_64-redhat-linux/4.4.5/
/usr/lib/../lib64/
/lib/
/usr/lib/'
which was broken, and produced
Use of uninitialized value $1
warnings, and messed up the content of lib/Config_heavy.pl.
We probably normally don't have multi-line entries, which is why no-one
noticed it before, but
40f026236b9959b7ad3260fedc6c66cd30bb7abc
has started generating the entry above.
David Mitchell [Mon, 18 Apr 2011 17:35:13 +0000 (18:35 +0100)]
fix for pp.c under win32 etc
Commit
d4fc4415aac96132fac5b1e43e73bcba33a41b79 added two definitions
of the DEREF_PLAIN_ARRAY array; the non-GCC one had syntax errors
Richard Möhn [Mon, 18 Apr 2011 15:52:08 +0000 (15:52 +0000)]
Minor fixes to perldelta.pod
Reviewed section "Core Enhancements".
Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
Richard Möhn [Mon, 18 Apr 2011 14:42:00 +0000 (16:42 +0200)]
Consistent use of 'e.g.,' in perldelta.pod
There were some places, where 'e.g.' was used without a comma. I made it
consistent.
Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
Richard Möhn [Mon, 18 Apr 2011 13:48:45 +0000 (15:48 +0200)]
Consistent use of two spaces after full stop in perldelta.pod
There were more occurences of two spaces after full stops, so I made
those two that were only one.
Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
Father Chrysostomos [Mon, 18 Apr 2011 15:44:00 +0000 (08:44 -0700)]
perldelta: typos
Ævar Arnfjörð Bjarmason [Mon, 18 Apr 2011 15:26:04 +0000 (15:26 +0000)]
pod/perldelta.pod: POSIX should be in all-caps (not "Posix")
Ævar Arnfjörð Bjarmason [Mon, 18 Apr 2011 15:20:48 +0000 (15:20 +0000)]
pod/perldelta.pod: clarify "Use of qw(...) as parentheses" deprecation
Clarify the note about qw(...) as parentheses deprecation. Without
being clarified this could be misunderstood to deprecate most uses of
qw(...).
This came up on the Git mailing list[1] after I submitted a patch[2]
to fix this issue in Gitweb[3].
1. http://permalink.gmane.org/gmane.comp.version-control.git/167293
2. http://permalink.gmane.org/gmane.comp.version-control.git/167283
3. http://permalink.gmane.org/gmane.comp.version-control.git/167297
Ævar Arnfjörð Bjarmason [Mon, 18 Apr 2011 14:56:02 +0000 (14:56 +0000)]
pod/perldelta.pod: link to pertinent feature.pm POD
Instead of just linking to L<feature> link to the "the
'unicode_strings' feature" section.
Father Chrysostomos [Mon, 18 Apr 2011 13:34:01 +0000 (06:34 -0700)]
Make push/shift $scalar accept only unblessed aryrefs
See ticket #80626.
Father Chrysostomos [Mon, 18 Apr 2011 13:27:21 +0000 (06:27 -0700)]
perldelta for d12b49d (Unicode constants)
Tony Cook [Sat, 9 Apr 2011 00:45:37 +0000 (10:45 +1000)]
check --whole-archive is supported (in cc.cbu) before using it
netbsd for pre 4.6 gcc requires --whole-archive to build shared
libraries, but this is rejected and not required in 4.6.0.
Tony Cook [Mon, 18 Apr 2011 09:40:50 +0000 (19:40 +1000)]
Revert "check --whole-archive is supported before using it"
This reverts commit
673d8593b7ef274dadbfff97fd641e3c563fc716.
I meant to apply the cc.cbu version of this patch.
Jesse Vincent [Mon, 18 Apr 2011 08:16:02 +0000 (18:16 +1000)]
Lots of perldelta editing. Still miles to go before we sleep
Father Chrysostomos [Sun, 17 Apr 2011 23:09:36 +0000 (16:09 -0700)]
Make Unicode constants under use utf8 work again
Because sub lookup (and glob lookup in general) ignores the UTF8
flag, such subs are actually ‘correctly’ stored under the utf8-encoded
equivalent of the name, and not the name itself.
Craig A. Berry [Mon, 18 Apr 2011 03:43:45 +0000 (22:43 -0500)]
TODO some of the new sigdispatch tests on VMS.
Needs more signal foo than I can muster at the moment to figure out
what the intent is here and why it's not working.
Andy Dougherty [Sun, 17 Apr 2011 08:19:57 +0000 (18:19 +1000)]
As part of their switch to a multi-arch library layout,
Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
(such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
where to look. We don't want gcc's own libraries, however, so we
filter those out.
This could be conditional on Ubuntu, but other distributions have
announced their intent follow suit, and this scheme seems to work even
on rather old gcc's. This unconditionally uses gcc because even if the
user is using another compiler, we still need to find the math library
and friends, and I don't know how other compilers will cope with that
situation. Still, as an escape hatch, allow Configure command line
overrides to plibpth to bypass this check.
Karl Williamson [Sun, 17 Apr 2011 02:04:49 +0000 (20:04 -0600)]
perlre: Nits in recently added text
Tom Christiansen [Sat, 16 Apr 2011 14:33:56 +0000 (08:33 -0600)]
Nits in perlunicode
Father Chrysostomos [Sat, 16 Apr 2011 05:33:31 +0000 (22:33 -0700)]
Followup to 088225f/[perl #88132]: packages ending with :
Commit 088225f was not sufficient to fix the regression. It still
exists for packages whose names end with a single colon.
I discovered this when trying to determine why RDF::Trine was crashing
with 5.14-to-be.
In trying to write tests for it, I ended up triggering the same crash
that RDF::Trine is having, but in a different way.
In the end, it was easier to fix about three or four bugs (depending
on how you count them), rather than try to fix only the regression
that #88132 deals with (isa caches not updating when packages ending
with colons are aliased), as they are all intertwined.
The changes are as follows:
Concerning the if (!(flags & ~GV_NOADD_MASK)...) statement in
gv_stashpvn: Normally, gv_fetchpvn_flags (which it calls and whose
retval is assigned to tmpgv) returns NULL if it has not been told
to add anything and if the gv requested looks like a stash gv (ends
with ::). If the number of colons is odd (foo:::), that code path is
bypassed, so gv_stashpvn returns a GV without a hash. So gv_stashpvn
tries to used that NULL hash and crashes. It should instead return
NULL, to be consistent with the two-colon case.
Blindly assigning a name to a stash does not work if the stash has
multiple effective names. A call to mro_package_moved is required as
well. So what gv_stashpvn was doing was insufficient.
The parts of the mro code that check for globs or stash elems that
contain stashes by looking for :: at the end of the name now take into
account that the name might consist of a single : instead.
Craig A. Berry [Fri, 15 Apr 2011 21:31:42 +0000 (16:31 -0500)]
Give EU::CB 04-base.t an absolute path on VMS.
catfile() with an empty string as a first argument does *not*
produce an absolute path on VMS (and probably only does so by
accident elsewhere). For purposes of the test, it seems that
any absolute path would do, so this could probably be done
portably, but on the eve of 5.14 let's make a separate code
path for VMS and leave everyone else as is for now.
Craig A. Berry [Fri, 15 Apr 2011 21:20:48 +0000 (16:20 -0500)]
IPC::Open3 needs porting to work on VMS.
So skip the test for now. Something like the Win32 mechanism
spawn_with_handles() may be workable but needs investigation.
Craig A. Berry [Sun, 3 Apr 2011 13:10:43 +0000 (08:10 -0500)]
Don't copy all of %ENV in prereq.t.
It's sufficient for purposes of enabling prerequisite warnings to
set a localized $ENV{PERL_CORE} to undef rather than making a local
copy of the entire %ENV hash. This makes the test pass on VMS,
where copying %ENV in toto is not supported.
This fixes a smoke failure, so borrow it from upstream, where it's
already released as part of MM 6.57_10. 6.58 will contain an
additional tweak that works with Perl 5.6, but no need to worry
about that here.
Karl Williamson [Fri, 15 Apr 2011 17:47:55 +0000 (11:47 -0600)]
perlrebackslash: Slight edits
Karl Williamson [Fri, 15 Apr 2011 17:44:10 +0000 (11:44 -0600)]
perlop: Slight edits
Karl Williamson [Fri, 15 Apr 2011 17:19:40 +0000 (11:19 -0600)]
perlunicode: More 5.14 edits
Karl Williamson [Fri, 15 Apr 2011 17:11:51 +0000 (11:11 -0600)]
perlunitut: clarification
Karl Williamson [Fri, 15 Apr 2011 15:53:21 +0000 (09:53 -0600)]
perluniprops: Linked to wrong pod; slight edits
Tom Christiansen [Thu, 14 Apr 2011 16:26:37 +0000 (10:26 -0600)]
perlunicode: Edits for 5.14
Nicholas Clark [Fri, 15 Apr 2011 12:38:29 +0000 (13:38 +0100)]
In the release guide, mention the AdvanceCOMP can compress gzip files better.
It's an option release managers (on *nix) might want to be aware of.
David Mitchell [Fri, 15 Apr 2011 09:17:07 +0000 (10:17 +0100)]
stop waithires.t failing under high load
In threads::shared, the waithires.t test checks cond_timedwait() with
sub-second timeouts. If the newly-minted child doesn't manage to grab the
lock within 0.05s, the cond_timedwait() will timeout, and the child and
the test will hang, until eventually killed off by the watchdog. This can
easily happen on a slow/loaded system.
We fix this by putting the cond_timedwait() in a retry loop, only giving
up after 10 seconds of repeated timeouts.
Tom Christiansen [Thu, 14 Apr 2011 16:30:18 +0000 (10:30 -0600)]
perllocale: Clean up recent additions
Father Chrysostomos [Thu, 14 Apr 2011 13:23:50 +0000 (06:23 -0700)]
perldelta: 342c852 changed $re::VERSION
Father Chrysostomos [Thu, 14 Apr 2011 13:19:07 +0000 (06:19 -0700)]
[perl #88486] IO::File does not always export SEEK*
Commit d963bf0 made perl set @IO::File::ISA automagically.
Commit 15e6cdd made filehandle methods load IO::File automagically.
Commit efc5c7c attempted to solve the problem that having IO::Handle
loaded causes IO::File to be bypassed, rendering 15e6cdd only
semi-effective (see [perl #87940]), by requiring IO::File inside
IO::Handle.
That commit ended up breaking several CPAN modules, because IO::File
adds @IO::Seekable::EXPORT to its own exports.
If IO::Seekable is loaded first (before IO::File), before setting up
its @EXPORT it loads IO::Handle, which loads IO::File, which tries to
load IO::Seekable, which is in %INC already, and which is hence wait-
ing for IO::File to load before it sets its own @EXPORT. So IO::File
sees @IO::Seekable::EXPORT empty.
Hence, every piece of code that tries to import SEEK_END from IO::File
will simply not get it if IO::Seekable is already loaded (explicitly
or, e.g., by File::Temp).
This commit hopefully fixes the breakage and the problem that efc5c7c
attempted to fix by loading IO::File only inside IO::Handle::new (the
only method that IO::File overrides).
Father Chrysostomos [Thu, 14 Apr 2011 03:28:44 +0000 (20:28 -0700)]
perldelta entries for 088225f
Jan Dubois [Thu, 14 Apr 2011 00:02:39 +0000 (17:02 -0700)]
[perl #88420] BOM support on Windows broken in 5.13.11
When Perl reads the script in text mode, then the tell() position
on the script handle may include stripped carriage return characters.
Therefore the file position after reading the first line of the
script may be one larger than the length of the input buffer.
Father Chrysostomos [Wed, 13 Apr 2011 16:48:39 +0000 (09:48 -0700)]
[perl #88132] broken ISA lookup after aliasing packages ending with ::
gv_fetchpvn_flags did not always assign a name to a return HV ending
with ::. This would result in code in various places skipping certain
‘stashes’ (in quotes because nameless HVs are technically not stashes)
because they were nameless when they should not have been.
So sometimes ISA caches would end up being out of date, as in the test
cases posted with [perl #88132] (and incorporated into this patch).
This commit fixes that by changing the parsing of glob names.
Formerly, a :: was not considered a package separator if it came imme-
diately after a ::. So foo:::: would become foo::/:: (with the final
:: considered a regular stash entry, not a ‘stash’ stash entry) and
foo:::::: would become foo::/:::/:.
Now a :: is always a package separator. So *foo::::bar is accessible
via $foo::{"::"}{bar} and *$foo:::::: via $foo::{"::"}{"::"}.
This happens to fix [perl #88134] as well.
Karl Williamson [Wed, 13 Apr 2011 15:55:44 +0000 (09:55 -0600)]
perldelta: Clarify entry
Karl Williamson [Wed, 13 Apr 2011 15:26:35 +0000 (09:26 -0600)]
perlre.pod: Clarify
Several confusions have arisen about how things work, and this
addresses them.
Karl Williamson [Wed, 13 Apr 2011 01:43:12 +0000 (19:43 -0600)]
perlunicode: Update for 5.14
Karl Williamson [Wed, 13 Apr 2011 03:49:58 +0000 (21:49 -0600)]
perllocale: Update for 5.14
Nicholas Clark [Tue, 12 Apr 2011 08:01:48 +0000 (09:01 +0100)]
In testargs.t in Test::Harness, don't run a world-writable file.
The test writes a file, then changes the mode, then executes it. The file needs
to be +x to be executable (on many platforms). The file will need to be +w to
be deletable on some platforms. But setting the file world writable just before
running it feels like a bad idea, given that the file's name is as predictable
as process IDs, as there's a race condition to break into the account running
perl's tests.
David Mitchell [Wed, 13 Apr 2011 13:35:09 +0000 (14:35 +0100)]
handle freed backref array in global cleanup
[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).
Tony Cook [Fri, 8 Apr 2011 14:05:24 +0000 (00:05 +1000)]
check --whole-archive is supported before using it
netbsd for pre 4.6 gcc requires --whole-archive to build shared
libraries, but this is rejected and not required in 4.6.0.
Simply changing the option to -Wl,--whole-archive works on gcc 4.6.0
but fails for the system cc on NetBSD 5.1/x64.
Karl Williamson [Wed, 13 Apr 2011 01:49:19 +0000 (19:49 -0600)]
perlrebackslash: Update for 5.14 changes
Karl Williamson [Thu, 31 Mar 2011 18:00:13 +0000 (12:00 -0600)]
perlretut: Update for 5.14 /a, /u
Karl Williamson [Fri, 1 Apr 2011 19:40:23 +0000 (13:40 -0600)]
perlrecharclass: Update for 5.14 changes
Karl Williamson [Mon, 11 Apr 2011 00:05:52 +0000 (18:05 -0600)]
perlre.pod: Update for 5.14
David Mitchell [Tue, 12 Apr 2011 20:39:21 +0000 (21:39 +0100)]
reg_eval_scope.t: skip coring tests on all arches
Some TODO tests that were known to core dump are already skipped on
Windows on production releases. Extend this to all platforms,
to avoid scaring the punters with spurious 'Aborted' messages in the
test harness output.
David Mitchell [Tue, 12 Apr 2011 20:22:46 +0000 (21:22 +0100)]
add tests for $tied op= $tied
The tests for C<$tied op $tied> didn't include the mutator
variants of the ops (e.g. +=).
David Mitchell [Tue, 12 Apr 2011 16:33:14 +0000 (17:33 +0100)]
add $tied ^ $tied test
when tests were added for C<$tied op $tied>, the '^' op was missed
Karl Williamson [Sat, 9 Apr 2011 22:05:09 +0000 (16:05 -0600)]
perlop: Update for 5.14 additions
Karl Williamson [Tue, 12 Apr 2011 17:50:06 +0000 (11:50 -0600)]
regcomp: Improve error message for (?-d:...)
As agreed, this improvement is going into 5.14. A customized
message is output, instead of a generic one.
Karl Williamson [Tue, 12 Apr 2011 17:25:37 +0000 (11:25 -0600)]
PATCH: [perl #86972]: Tweak error messages
An earlier commit in this series changed some error messages.
I realized that it did not make sense really to use "/a" for the regex
modifier, when the message was for the infix form "(?a:", so this
just removes the slash.
Karl Williamson [Tue, 12 Apr 2011 17:18:36 +0000 (11:18 -0600)]
perldelta: Typo
Karl Williamson [Sat, 9 Apr 2011 22:33:07 +0000 (16:33 -0600)]
perlreapi: Update as little as possible for 5.14
This keeps the docs at parity with earlier Perls.
Nicholas Clark [Tue, 12 Apr 2011 14:00:51 +0000 (15:00 +0100)]
Fix eval.t under minitest, inadvertently broken by
0d804ff61f3a2df2
That change attempted to skip if use Devel::Peek failed with a skip message of
of $@. Unfortunately, in this situation, $@ has multiple lines, which is not
valid as a skip message. So instead skip if we're miniperl, or we haven't built
Devel::Peek, otherwise attempt to run the test.
Karl Williamson [Mon, 11 Apr 2011 18:11:06 +0000 (12:11 -0600)]
Add test for [perl #87812]
This makes sure that no case insensitive match of a Latin1 character
causes the utf8_heavy code to be loaded.
Karl Williamson [Mon, 11 Apr 2011 17:06:05 +0000 (11:06 -0600)]
PATCH: final [perl #86972]: Allow /(?aia)/
This fixes "use re '/aia'", and completes the sequence of commits
for this ticket.
David Leadbeater [Fri, 8 Apr 2011 20:33:20 +0000 (21:33 +0100)]
Require IO::File in IO::Handle
Since 15e6cdd IO::File has been loaded automatically. However this
automatic loading would not happen in all cases if IO::Handle was
loaded previously. This is due to the @ISA for IO::File being
initialised by the core (see the discussion in [perl #87940]).
By ensuring IO::File is loaded if IO::Handle is the indeterminate
state cannot occur.
Karl Williamson [Sun, 10 Apr 2011 22:21:55 +0000 (16:21 -0600)]
PATCH: partial [perl #86972]: Allow /(?aia)/
This allows a second regex 'a' modifier in the infix form to not have to
be contiguous with the first, and improves the message if there are extra
modifiers.
Karl Williamson [Sun, 10 Apr 2011 20:59:41 +0000 (14:59 -0600)]
PATCH: partial [perl #86972]: Allow /aia
This allows a second /a modifier to not have to be contiguous with the
first. This patch changes only the part in toke.c where the modifiers
are in suffix form.
Karl Williamson [Sat, 9 Apr 2011 17:03:37 +0000 (11:03 -0600)]
PATCH: [perl #87812] BBC breaks Pod::Coverage::TrustPod
This patch completes the fixing of this problem. The problem is that
the failing .t set @INC to exclude lib, and hence couldn't find utf8.pm,
which 5.14 was requiring in places where it previously didn't. This
patch finishes the job of not requiring utf8.pm in so many places as
were inadvertently added in 5.14. Commit
3ad98780b4bded02c371c83a668dc8f323e57718 started the job.
This patch changes regcomp.c to not set ANYOF_NONBITMAP_NON_UTF8 where
it inappropriately was. I don't know what I was thinking when I
originally did what this changes. In order to match outside the bitmap,
these characters all must match something that requires utf8, such as a
LIGATURE FI.
Karl Williamson [Sat, 9 Apr 2011 16:42:15 +0000 (10:42 -0600)]
regcomp.c: Shun ANYOF_NONBITMAP_NON_UTF8
As noted in the comments in the code for this commit, this flag has
higher consequences than others when it is inappropriately set in the
synthetic start class. This patch causes it to not be set unless there
is some path in the regex engine that needs it, but once set it is never
cleared. This results in a different set of false positives than
currently, but the current set can have this set even if there is no
path in the engine that needs it.
Father Chrysostomos [Sat, 9 Apr 2011 05:04:01 +0000 (22:04 -0700)]
perldelta: Move the XIDStart change from bugs to incompat.
and reword it.
This is probably not the best wording. If someone else is actually
reading this, please feel free to improve it.
Father Chrysostomos [Sat, 9 Apr 2011 01:12:42 +0000 (18:12 -0700)]
perldelta for [perl #87708]
In fixing the regression that #87708 represents, I could not avoid
also fixing this swapped-operand bug, so it needs a perldelta entry.
I also fixed a tiny formatting error.
Father Chrysostomos [Fri, 8 Apr 2011 20:03:56 +0000 (13:03 -0700)]
Revert parts of c31c291..96b6b87
This restores the old definition of dPOPTOPiirl_nomg from
before 96b6b87 and the old definition of dPOPXiirl_ul_nomg from
before e62ca0f (except for a bug fix: POPi cannot be used since
it’s magical). It also reverts most of c31c291.
This does mean that uninitialized warnings for various operators are
back in reverse order. So I am reinstating a bug with this commit. But
that bug was never a 5.14 blocker and so should never have been fixed
during code freeze (and there is the slight possibility that the fix
would break sensitive test suites). It was only fixed ‘for free’ as a
side effect of fixing [perl #87708], but that bug turned out to have a
better fix (commit 75ea7a1) that allows these changes to be reverted.
Father Chrysostomos [Fri, 8 Apr 2011 16:08:02 +0000 (09:08 -0700)]
Revert "[perl #87708] $tied / $tied under use integer"
This reverts most of commit
76422f81b675011beffbdb66c981a36b6fbf4a6b.
It is now unnecessary as of commit 75ea7a1.
Father Chrysostomos [Fri, 8 Apr 2011 16:05:38 +0000 (09:05 -0700)]
Remove unnecessary code from pp_add
This code, added recently in 4c3ac4b and amended in 837c879, has been
unnecessary since commit 75ea7a1.
Father Chrysostomos [Fri, 8 Apr 2011 16:04:13 +0000 (09:04 -0700)]
Remove unnecessary code from pp_eq
This code, added recently in 7d779b2, has been unnecessary since com-
mit 75ea7a1.
Father Chrysostomos [Fri, 8 Apr 2011 16:01:55 +0000 (09:01 -0700)]
Correct the skip count in stash.t
This has been wrong since 57f45d7.
Father Chrysostomos [Fri, 8 Apr 2011 06:02:35 +0000 (23:02 -0700)]
[perl #87708] Fix ‘$tied binop $tied’
The short story: In 5.13.1 or .2 these ops started calling get-magic
just once if the same gmagical scalar was used for both operands. Then
the same value would be used on both sides. In 5.12 FETCH would be
called twice with both return values used, but they would be swapped
in most cases (so $t/$t would return 1.5 if $t returned 2 and then
3). Now FETCH is called twice and the two operands are used in the
right order.
Up till now there have been patches to fix specific ops, but I real-
ised that the same ten or so lines of code would have to be added to
the rest of the 20+ pp_ functions, all of which use tryAMAGICbin_MG
(which calls Perl_try_amagic_bin in gv.c), so it made sense to add the
code to Perl_try_amagic_bin instead. This fixes all the ops in one
fell swoop.
The code in question checks whether the left and right operands are
the same gmagical scalar. If so, it copies the scalar into a new mor-
tal one, and then calls get-magic on the original operand to get its
new value (for the rhs). The new scalar is placed just below the top
of the stack, so it becomes the left operand.
This does slow down the bitwise integer ops slightly, but only in this
rare edge case. And the simplification of the code seems worth it.
Forthcoming are commits that revert some of the changes already made,
as this commit renders them unnecessary.
Father Chrysostomos [Thu, 7 Apr 2011 18:44:15 +0000 (11:44 -0700)]
[perl #87708] $tied == $tied
This is only part of #87708.
This fixes the + operator outside of any ‘use integer’ scope when the
same tied scalar is used for both operands and returns two different
values. Before this commit, get-magic would be called only once and
the same value used. In 5.12.x it just worked.
I tried modifying pp_eq throughout to take this case into account,
but it made the most common cases slightly slower, presumably because
of the extra checks. So this follows the same temp sv method that I
used for pp_add (in 4c3ac4b and 837c879), which, though slowing down
this edge cases due to the extra allocation, leaves the most common
cases just as fast. (And, in case my benchmarks were unreliably [not
unlikely], this method is also safer, as it has less chance of getting
different code paths wrong.)
Leon Timmermans [Thu, 7 Apr 2011 10:33:21 +0000 (12:33 +0200)]
Make :utf8 and :bytes MULTIARG
PerlIO layer types have this property that flags if they can accept
multiple arguments or only one. Unfortunately, this always checks the
uppermost layer that has an Open method defined. This causes issues when
used with utf8 or bytes on top of a layer that uses multiple arguments.
For 5.15 I think abolishing this feature may make most sense. It's just
flat out wrong IMO, it's the layer that uses the arguments that should
validate them, not the topmost, which may not even touch them. In the
mean time adding the multiargs flag to :utf8 and :bytes is a reasonable
stop-gap.
This patch makes perl slightly more permissive, so it shouldn't break
any working code out there.
Karl Williamson [Thu, 7 Apr 2011 14:36:51 +0000 (08:36 -0600)]
PATCH: [perl #87810] BBC Text::MultiMarkdown
A statement should have been outside a block but was inside it.
The indentation was correct, and in a number of times reading
the code I still missed it.
I'm having trouble distilling down the failure scenario into
a simple test case, and am short on tuits right now, so a test
will be committed later.
Father Chrysostomos [Thu, 7 Apr 2011 05:44:28 +0000 (22:44 -0700)]
[perl #87388] bless[], "main::" crashes
As mention in the ticket, this was caused by b4dd662, which removed
‘dead’ code from gv_stashpvn:
commit
b4dd66232df8f0d1c00796970dec7fc37fbe9edf
Author: Nicholas Clark <nick@ccl4.org>
Date: Fri Oct 8 21:33:29 2010 +0100
Remove dead code from Perl_gv_stashpvn().
GvHV() and HvNAME() will both always already be set, as gv_fetchpvn_flags()
will initialise these as it walks the string in its initial loop to locate the
correct stash, then return early because name == name_end.
This code has been dead since it was added in 5.000.
--- a/gv.c
+++ b/gv.c
@@ -927,11 +927,9 @@ Perl_gv_stashpvn(pTHX_ const char *name, U32 namelen, I32 flags)
Safefree(tmpbuf);
if (!tmpgv)
return NULL;
- if (!GvHV(tmpgv))
- GvHV(tmpgv) = newHV();
stash = GvHV(tmpgv);
- if (!HvNAME_get(stash))
- hv_name_set(stash, name, namelen, 0);
+ assert(stash);
+ assert(HvNAME_get(stash));
return stash;
}
This routine, before the snippet shown, adds two colons to the end of
the name and then passes "main::::" to gv_fetch_pvn_flags.
gv_fetch_pvn_flags, when it parses a "::", sets the next subname to
point to the character after the second colon, and then continues
scanning from the next character *after* that. So foo::::bar becomes
$foo::{"::bar"} and main:::: becomes $main::{"::"}.
The code that assigns the name to the stash and the early exit are
both inside an if(we have a package separator) block, but the final ::
is not considered one, so a nameless hash is returned.
The easiest way to fix this is to revert just the changes to
lines that deal with the name (since the other deleted lines are
really dead).
Father Chrysostomos [Thu, 7 Apr 2011 05:03:33 +0000 (22:03 -0700)]
Correct stupidities in 4c3ac4b
Allocating an extra SV for rare edge cases...er...only needs to be
done in those rare edge cases.
Uninitialized warnings are only supposed to be enabled when they are.
Father Chrysostomos [Thu, 7 Apr 2011 00:43:29 +0000 (17:43 -0700)]
[perl #87708] $tied + $tied
This is just part of #87708.
This fixes the + operator outside of any ‘use integer’ when the same
tied scalar is used for both operands and returns two different val-
ues. Before this commit, get-magic would be called only once and the
same value used. In 5.12.x it worked.
David Mitchell [Wed, 6 Apr 2011 22:35:14 +0000 (23:35 +0100)]
make mg_clear() et al behave when RC==0
The functions S_save_magic() and S_restore_magic(), which are called by
mg_get(), mg_set(), mg_length(), mg_size() and mg_clear(),
are not robust when called with an SV whose reference count is zero.
Basically, one of the actions of S_save_magic() is to temporarily
increase the refcount of the SV, and then for S_restore_magic() to reduce
it again at the end, so that if any of the magic functions called
inbetween decrease the count, it won't be prematurely freed.
However, if the count starts at zero, then bumping it up and bringing it
back down to zero, triggers a spurious second freeing.
So, if its zero, just skip the whole bumping thing.
Now, we shouldn't really be calling these functions will a zero-refcount
SV, but these things happen, and its best to be robust.
In particular, this fixes RT #87860, which was ultimately triggered by a
bug in Set::Object 1.28 that managed to create an HV with null SvMAGIC
field, but with the RMG flag set.
When freeing that HV, sv_clear() skips doing mg_free() because SvMAGIC is
null, whereas later it calls Perl_hv_undef_flags, which calls mg_clear()
because it uses the test SvRMAGICAL(hv) (which is true).
Father Chrysostomos [Wed, 6 Apr 2011 20:12:59 +0000 (13:12 -0700)]
[perl #87708] $tied / $tied under use integer
This is just part of #87708.
This fixes the / operator under ‘use integer’ when the same tied sca-
lar is used for both operands and returns two different values. Before
this commit, get-magic would be called only once and the same value
used. In 5.12.x the operands were swapped.
Father Chrysostomos [Wed, 6 Apr 2011 20:04:26 +0000 (13:04 -0700)]
[perl #87708] $tied % $tied and $tied * $tied under use integer
This is just part of #87708.
This fixes the % and * operators under ‘use integer’ when the same
tied scalar is used for both operands and returns two different val-
ues. Before this commit, get-magic would be called only once and
the same value used. In 5.12.x * just worked but the operands were
swapped for %.
It turns out that every operator using the dPOPTOPiirl_nomg macro
needs exactly the same treatment, so this commit eliminates the
dPOPTOPiirl_halfmg macro added a few commits ago and modifies
dPOPTOPiirl_nomg to do was it was doing. This should be perfectly
safe, as dPOPTOPiirl_nomg has not been in a stable release (and is
only for internal use anyway).
Father Chrysostomos [Wed, 6 Apr 2011 19:40:44 +0000 (12:40 -0700)]
[perl #87708] $tied + $tied and $tied - $tied under ‘use integer’
This is just part of #87708.
This fixes + and - under ‘use integer’ when the same tied scalar is
used for both operands and returns two different values. Before this
commit, get-magic would be called only once and the same value used.
In 5.12.x + just worked but the operands were swapped for -.
Father Chrysostomos [Wed, 6 Apr 2011 13:28:01 +0000 (06:28 -0700)]
[perl #87708] use integer; $tied < $tied
This is just part of #87708.
This fixes < under ‘use integer’ when the same tied scalar is used for
both operands and returns two different values. Before this commit,
get-magic would be called only once and the same value used. In 5.12.x
the operands were swapped.
Father Chrysostomos [Wed, 6 Apr 2011 13:24:00 +0000 (06:24 -0700)]
[perl #87708] use integer; $tied > $tied
This is just part of #87708.
This fixes > under ‘use integer’ when the same tied scalar is used for
both operands and returns two different values. Before this commit,
get-magic would be called only once and the same value used. In 5.12.x
the operands were swapped.
Father Chrysostomos [Wed, 6 Apr 2011 13:21:32 +0000 (06:21 -0700)]
[perl #87708] use integer; $tied <= $tied
This is just part of #87708.
This fixes <= under ‘use integer’ when the same tied scalar is used
for both operands and returns two different values. Before this com-
mit, get-magic would be called only once and the same value used. In
5.12.x the operands were swapped.
Father Chrysostomos [Wed, 6 Apr 2011 13:20:25 +0000 (06:20 -0700)]
[perl #87708] use integer; $tied >= $tied
This is just part of #87708.
This fixes >= under ‘use integer’ when the same tied scalar is used
for both operands and returns two different values. Before this com-
mit, get-magic would be called only once and the same value used. In
5.12.x the operands were swapped.
Father Chrysostomos [Wed, 6 Apr 2011 13:18:18 +0000 (06:18 -0700)]
[perl #87708] use integer; $tied == $tied
This is just part of #87708.
This fixes == under ‘use integer’ when the same tied scalar is used
for both operands and returns two different values. Before this com-
mit, get-magic would be called only once and the same value used. In
5.12.x it just worked.
Father Chrysostomos [Wed, 6 Apr 2011 13:17:23 +0000 (06:17 -0700)]
[perl #87708] use integer; $tied != $tied
This is just part of #87708.
This fixes != under ‘use integer’ when the same tied scalar is used
for both operands and returns two different values. Before this com-
mit, get-magic would be called only once and the same value used. In
5.12.x it just worked.