platform/upstream/perl.git
10 years agoStop reset from clearing aliases to globs
Father Chrysostomos [Tue, 13 Aug 2013 12:55:12 +0000 (05:55 -0700)]
Stop reset from clearing aliases to globs

If $z has been aliased to *foo, then reset("z") would turn off the
SvOK flags on *foo, putting it in an inconsistent state.  This could
cause crashes.

10 years agoperldelta for 045071e
Father Chrysostomos [Tue, 13 Aug 2013 05:11:24 +0000 (22:11 -0700)]
perldelta for 045071e

10 years agoperldelta for 5f213d9
Father Chrysostomos [Tue, 13 Aug 2013 05:08:34 +0000 (22:08 -0700)]
perldelta for 5f213d9

10 years agoperldelta for 9bcf803 and 376ccf8
Father Chrysostomos [Tue, 13 Aug 2013 05:07:51 +0000 (22:07 -0700)]
perldelta for 9bcf803 and 376ccf8

10 years agoperldelta for 85b7d9b
Father Chrysostomos [Tue, 13 Aug 2013 05:06:27 +0000 (22:06 -0700)]
perldelta for 85b7d9b

10 years agoperldelta for 48120f8
Father Chrysostomos [Tue, 13 Aug 2013 05:05:16 +0000 (22:05 -0700)]
perldelta for 48120f8

10 years agoperldelta for 3b68edc
Father Chrysostomos [Tue, 13 Aug 2013 05:02:52 +0000 (22:02 -0700)]
perldelta for 3b68edc

10 years agoperldelta: another to-do
Father Chrysostomos [Tue, 13 Aug 2013 05:00:46 +0000 (22:00 -0700)]
perldelta: another to-do

10 years agoperldelta for a547fd2
Father Chrysostomos [Tue, 13 Aug 2013 04:43:09 +0000 (21:43 -0700)]
perldelta for a547fd2

10 years agoperldelta for 9e0ea7f
Father Chrysostomos [Tue, 13 Aug 2013 04:28:07 +0000 (21:28 -0700)]
perldelta for 9e0ea7f

The thing about locking hash keys inside the substitution and
vivifying globs is too hard to explain clearly and concisely.
This section is entitled ‘*Selected* Bug Fixes’, after all.

10 years agoperldelta for 649c173
Father Chrysostomos [Tue, 13 Aug 2013 04:26:03 +0000 (21:26 -0700)]
perldelta for 649c173

10 years agoperldelta: another to-do
Father Chrysostomos [Tue, 13 Aug 2013 04:23:43 +0000 (21:23 -0700)]
perldelta: another to-do

10 years agoperldelta for 51da40e
Father Chrysostomos [Tue, 13 Aug 2013 03:42:54 +0000 (20:42 -0700)]
perldelta for 51da40e

10 years agoperldelta for 6b35226
Father Chrysostomos [Tue, 13 Aug 2013 03:27:06 +0000 (20:27 -0700)]
perldelta for 6b35226

10 years agoperldelta for 3df32bd
Father Chrysostomos [Tue, 13 Aug 2013 03:25:38 +0000 (20:25 -0700)]
perldelta for 3df32bd

10 years agoperldelta for 1311cfc
Father Chrysostomos [Tue, 13 Aug 2013 03:24:23 +0000 (20:24 -0700)]
perldelta for 1311cfc

10 years agoperldelta: anither to-do
Father Chrysostomos [Tue, 13 Aug 2013 03:22:03 +0000 (20:22 -0700)]
perldelta: anither to-do

10 years agoperldelta for c30fc27
Father Chrysostomos [Tue, 13 Aug 2013 03:19:01 +0000 (20:19 -0700)]
perldelta for c30fc27

The first part was stolen from 72251ce78c061 on the maint-5.18 branch.

10 years agoperldelta: missing =item
Father Chrysostomos [Tue, 13 Aug 2013 03:16:06 +0000 (20:16 -0700)]
perldelta: missing =item

10 years ago[perl #45667] Apply tests from #119125 in reverse
Father Chrysostomos [Tue, 13 Aug 2013 03:07:33 +0000 (20:07 -0700)]
[perl #45667] Apply tests from #119125 in reverse

Ticket #119125 represents the breakage caused by c30fc27b4df65a, which
fixed #45667 (/[#]$not_interpolated/x; a regression from 5.000) as a
side-effect of fixing /[#](?{this is not a code block})/x (a regres-
sion from 5.16.0).

It was backported to maint-5.18, which broke several modules, because
bug #45667 is *old*, and many modules depend on it.

So 02682386fe3e on the maint branch modified the fix to apply only to
code blocks, and added tests to make sure that #45667 wasn’t fixed.

#45667 is fixed in blead, but is untested, so grab the tests from
02682386fe3e and reverse the logic of the second one.

10 years agomg.c: Fix U32-to-bool assignment
Father Chrysostomos [Mon, 12 Aug 2013 22:52:23 +0000 (15:52 -0700)]
mg.c: Fix U32-to-bool assignment

This was caused by 3805b5fb04.  This commit restores the !=0 that
was there before 2fd13eccf0.

Thanks to Steve Hay for helping to track down the smoke failures.

10 years agoperldelta for #118213/5b0e71e
Father Chrysostomos [Mon, 12 Aug 2013 23:15:47 +0000 (16:15 -0700)]
perldelta for #118213/5b0e71e

10 years agoperldelta: more to-do items
Father Chrysostomos [Mon, 12 Aug 2013 23:12:04 +0000 (16:12 -0700)]
perldelta: more to-do items

10 years agoperldelta: begin a to-do list
Father Chrysostomos [Mon, 12 Aug 2013 23:00:26 +0000 (16:00 -0700)]
perldelta: begin a to-do list

10 years agoperldelta for 1913067
Father Chrysostomos [Mon, 12 Aug 2013 21:34:30 +0000 (14:34 -0700)]
perldelta for 1913067

10 years agoperldelta for 5d71919
Father Chrysostomos [Mon, 12 Aug 2013 21:31:29 +0000 (14:31 -0700)]
perldelta for 5d71919

10 years agoperldelta for #79908/137da2b
Father Chrysostomos [Mon, 12 Aug 2013 21:29:16 +0000 (14:29 -0700)]
perldelta for #79908/137da2b

10 years agoperldelta for mutable inlining & folding
Father Chrysostomos [Mon, 12 Aug 2013 21:27:36 +0000 (14:27 -0700)]
perldelta for mutable inlining & folding

2484f8d Stop folding of ops from changing mutability
94d5c17 Stop constant.pm from (ab)using subs for scalars
6f1b3ab Allow stash elems to be array refs
f815dc1 Inline list constants
c5a2441 Update constant.pm to reflect list inlinement
08f3c42 Tweak optree_constants.t for inlined list consts
d244020 Make sub(){42} return a mutable value
0ad6fa3 Stop op freeing from interfering with sub(){42} mutability

10 years agoperldelta for #3105/5608dcc
Father Chrysostomos [Mon, 12 Aug 2013 21:24:18 +0000 (14:24 -0700)]
perldelta for #3105/5608dcc

10 years agoperldelta for \$_.\$_ no longer giving 2 addresses
Father Chrysostomos [Mon, 12 Aug 2013 21:21:25 +0000 (14:21 -0700)]
perldelta for \$_.\$_ no longer giving 2 addresses

325e181 pad.c: Use &PL_sv_no for const pad names
82b84d0 op.c: Stop copying constants under ithreads
4891fdf pad.c: cast before comparing signed with unsigned
a0ed822 [perl #78194] Make grep/map copy pad tmps
b479c9f [perl #78194] Make sub calls copy pad tmps
8e079c2 [perl #78194] Make foreach copy pad tmps
706a6eb [perl #78194] Make list slices copy PADTMPs in lv cx
da9e430 [perl #78194] Make x copy PADTMPs in lv cx
2b66f6d [perl #78194] Make sort copy PADTMPs
82c2360 [perl #78194] Make re-evals copy PADTMPs
fb09017 pad.c apidocs: Clarify use of &PL_sv_no

10 years agoperldelta for ef54055
Father Chrysostomos [Mon, 12 Aug 2013 21:10:17 +0000 (14:10 -0700)]
perldelta for ef54055

10 years agoperldelta for #72766/6174b39
Father Chrysostomos [Mon, 12 Aug 2013 21:08:38 +0000 (14:08 -0700)]
perldelta for #72766/6174b39

10 years agoUpdate t/porting/customized.dat for cpan/libnet/Makefile.PL
Steve Hay [Mon, 12 Aug 2013 23:43:56 +0000 (00:43 +0100)]
Update t/porting/customized.dat for cpan/libnet/Makefile.PL

10 years agoUpgrade Time::Piece from 1.21 to 1.22
Steve Hay [Mon, 12 Aug 2013 23:04:41 +0000 (00:04 +0100)]
Upgrade Time::Piece from 1.21 to 1.22

10 years agoUpgrade IO::Compress::* and Compress::Raw::* from 2.061 to 2.062
Steve Hay [Mon, 12 Aug 2013 23:03:39 +0000 (00:03 +0100)]
Upgrade IO::Compress::* and Compress::Raw::* from 2.061 to 2.062

10 years agoUpgrade libnet from 1.22_02 to 1.23
Steve Hay [Mon, 12 Aug 2013 22:41:35 +0000 (23:41 +0100)]
Upgrade libnet from 1.22_02 to 1.23

Changed my mind over the UPSTREAM status too: 'cpan' is probably better
after all. As long as someone (currently me) is responsive in rolling new
CPAN releases then any patches from core can safely go to rt.cpan.org
without getting stuck on a pile for a long time. Meanwhile, other patches
sent to rt.cpan.org may also get applied, and hopefully one day a more
active maintainer may be found. This also saves having to move it from
cpan/ to dist/.

10 years agoSync version of Module-CoreList
Chris 'BinGOs' Williams [Mon, 12 Aug 2013 20:59:55 +0000 (21:59 +0100)]
Sync version of Module-CoreList

10 years agoFix MANIFEST and update Changes in Module-CoreList
Chris 'BinGOs' Williams [Mon, 12 Aug 2013 20:59:02 +0000 (21:59 +0100)]
Fix MANIFEST and update Changes in Module-CoreList

10 years agolib/locale.t: Make suitable for testing locales sanity
Karl Williamson [Thu, 8 Aug 2013 03:30:01 +0000 (21:30 -0600)]
lib/locale.t: Make suitable for testing locales sanity

This just adds some more explanatory text to the output when errors are
encountered, and causes it to not generate TODOs for failing tests under
debug mode.  These TODOs were generated when only a small percentage of
the locales have failures, thus indicating that the fault is in those
locale definitions and not Perl itself, and hence we shouldn't fail the
build because somebody's system has a few bad locale definitions.

This commit causes the failures to be real failures when under debug
mode.  Given this and the new explanatory text, this .t is suitable for
testing locales for sanity.  I'll ask p5p whether we should advertise
that fact or not.

10 years agolib/locale.t: Move advice output to end
Karl Williamson [Thu, 8 Aug 2013 02:44:32 +0000 (20:44 -0600)]
lib/locale.t: Move advice output to end

This just moves a block so that the messages it generates are displayed
at the end of the locale.t output, instead of in the middle.  This makes
them more likely to be noticed.

10 years agolocale.t: Don't show 100% pass when there are failures
Karl Williamson [Thu, 8 Aug 2013 02:05:27 +0000 (20:05 -0600)]
locale.t: Don't show 100% pass when there are failures

This was because it only rounded to the nearest percent.  Rounding to
the nearest .1% should eliminate the problem, as there are fewer than
1000 possible locales.

10 years agolocale.c: Rmv unused variable
Karl Williamson [Sun, 28 Jul 2013 04:05:14 +0000 (22:05 -0600)]
locale.c: Rmv unused variable

10 years agolib/locale.t: White-space only
Karl Williamson [Mon, 12 Aug 2013 19:15:27 +0000 (13:15 -0600)]
lib/locale.t: White-space only

This outdents text and reflows comments in a now-removed block

10 years agolib/locale.t: Don't skip certain tests
Karl Williamson [Mon, 12 Aug 2013 18:47:50 +0000 (12:47 -0600)]
lib/locale.t: Don't skip certain tests

The removed code caused tests to be skipped when the locale doesn't add
any \w characters beyond the C locale.  That meant in practice these
tests were likely skipped only for the C and POSIX locales.  The problem
is that doing this required extra complexity in figuring out how many
tests to skip.  Removing this makes the code easier to understand and
maintain.

10 years agolib/locale.t: Remove useless test.
Karl Williamson [Sat, 27 Jul 2013 19:53:12 +0000 (13:53 -0600)]
lib/locale.t: Remove useless test.

This test verified that certain things matched \w.  However the list of
those things was assembled by matching \w in the first place.  So it
tested nothing new.

10 years agolib/locale.t: Add a bunch of tests.
Karl Williamson [Sat, 27 Jul 2013 19:48:33 +0000 (13:48 -0600)]
lib/locale.t: Add a bunch of tests.

These test that various relationships that POSIX specifies are met in
each locale, including that a class and its complement are mutually
exclusive, that some classes are subsets of another (like [:upper:]
being a subset of [:alpha:]), and that some things can't be in two
conflicting classes (such as [:print:] and [:cntrl:]).

The tests are marked as TODO, like similar existing tests, if only a
small percentage of locales fail them.  This indicates that those
locales are defective, while Perl and most other locales are ok.

10 years agolib/locale.t: Better debug output
Karl Williamson [Sat, 27 Jul 2013 19:43:50 +0000 (13:43 -0600)]
lib/locale.t: Better debug output

This adds infrastructure and uses it to report the individual characters
that fail tests.

10 years agolib/locale.t: Add test name to debug output
Karl Williamson [Sat, 27 Jul 2013 19:38:18 +0000 (13:38 -0600)]
lib/locale.t: Add test name to debug output

This makes it easier to understand what is going wrong.

10 years agolib/locale.t: Add omitted test cases
Karl Williamson [Sat, 20 Jul 2013 18:12:01 +0000 (12:12 -0600)]
lib/locale.t: Add omitted test cases

The tests were failing to include caseless alphabetic characters;
many languages are not cased..

10 years agolib/locale.t: Rename some internal elements
Karl Williamson [Sat, 20 Jul 2013 18:03:11 +0000 (12:03 -0600)]
lib/locale.t: Rename some internal elements

I have never understood what 'neoalpha' meant.  I believe it is actually
neo - alpha, But when I read it, I don't notice the 'a' and see it as
"n-end-of-line".  This renames it to something I can understand.

10 years agolib/locale.t: Add comments; clarify some test names
Karl Williamson [Sat, 20 Jul 2013 17:49:01 +0000 (11:49 -0600)]
lib/locale.t: Add comments; clarify some test names

I had to really study what these tests were doing; the new names are
clearer.

10 years agolib/locale.t: Allow turning on debug via env
Karl Williamson [Sat, 20 Jul 2013 17:37:55 +0000 (11:37 -0600)]
lib/locale.t: Allow turning on debug via env

Instead of having to edit the file to turn on debug mode, additionally
allow the use of an environment variable.  This makes it more
convenient to ask someone in the field to run the test.

10 years agoAssume UTF-8 locale if that string occurs anywhere in name
Karl Williamson [Sat, 13 Jul 2013 19:43:31 +0000 (13:43 -0600)]
Assume UTF-8 locale if that string occurs anywhere in name

When a platform doesn't have nl_langinfo(), heuristics are employed
to see if a locale is UTF-8 .  The first heuristic is looking at the
return value of setlocale(), which generally is the locale name.
However, in actuality the return value is opaque and can't be relied on
to signify the locale.  Nevertheless if it contains the string UTF-8
(ignoring case, and with the hyphen optional), it is a safe bet that the
locale is indeed UTF-8.  Prior to this patch, we only looked at the end
of the name for "UTF-8".  This patch makes it not have to be
right-anchored.  There are UTF-8 locales on our dromedary machine with
UTF-8 in the middle of their names.

10 years agoExtUtils-ParseXS is now version 3.21
Steve Hay [Mon, 12 Aug 2013 17:01:43 +0000 (18:01 +0100)]
ExtUtils-ParseXS is now version 3.21

10 years agoimport CoreList changes from v5.18.1
Ricardo Signes [Mon, 12 Aug 2013 15:18:12 +0000 (11:18 -0400)]
import CoreList changes from v5.18.1

10 years agoTypo fix in comment
Smylers [Thu, 8 Aug 2013 10:43:47 +0000 (11:43 +0100)]
Typo fix in comment

10 years agoPeek.t: Fix a test
Father Chrysostomos [Mon, 12 Aug 2013 15:24:46 +0000 (08:24 -0700)]
Peek.t: Fix a test

This scalar can end up becoming a COW with standard builds, but not
with threads+mad.

10 years agoepigraphs: replace E<0x2014> with literal U+2014 to avoid podchecker error
Ricardo Signes [Mon, 12 Aug 2013 14:49:11 +0000 (10:49 -0400)]
epigraphs: replace E<0x2014> with literal U+2014 to avoid podchecker error

10 years agoadd epigraphs from v5.18.1
Ricardo Signes [Mon, 12 Aug 2013 14:46:05 +0000 (10:46 -0400)]
add epigraphs from v5.18.1

10 years agoIgnore directories when checking POD encoding
Steve Hay [Mon, 12 Aug 2013 12:56:22 +0000 (13:56 +0100)]
Ignore directories when checking POD encoding

10 years ago[perl #92260] Devel::Peek::fill_mstats and non-PVs
Father Chrysostomos [Sun, 11 Aug 2013 23:09:19 +0000 (16:09 -0700)]
[perl #92260] Devel::Peek::fill_mstats and non-PVs

Devel::Peek::fill_mstats assumed that the argument was >= SVt_PV so
it crashed on brand new undef scalars.  Use sv_grow, instead of
SvGROW.  Since sv_grow also handles COWs, we can remove the special
COW check.

10 years agoconstant.pm: Note that list constants are not
Father Chrysostomos [Sun, 11 Aug 2013 21:10:54 +0000 (14:10 -0700)]
constant.pm: Note that list constants are not

10 years agoMark COWable constants as COWable at compile time
Father Chrysostomos [Sun, 11 Aug 2013 07:02:34 +0000 (00:02 -0700)]
Mark COWable constants as COWable at compile time

This allows ‘$_ = "hello"’ to do COW without having to copy
that constant.

The reason this did not work before is that we never do copy-on-write
with existing read-only scalars that are not already marked COW, as
doing so modifies the string buffer, which the read-only flag may be
intended to protect.

At compile time, most constants start out mutable and are made read-
only in ck_svconst.  So there we can check that the constant is indeed
still mutable (and COWable) and mark it as a COW scalar before making
it read-only.

10 years agoMake Storable support read-only COWs
Father Chrysostomos [Sun, 11 Aug 2013 21:46:55 +0000 (14:46 -0700)]
Make Storable support read-only COWs

Unfortunately, the historical double meaning of SvREADONLY makes
it hard to do the correct thing under all perl versions.

If this proves too problematic for other XS modules, we might need
to forbid read-only COWs, which would be unfortunate, since they
speed things up.

However, a CPAN search reveals nothing outside core for
READONLY.*?(IsCOW|FAKE).

10 years agosv.c:sv_grow: accept read-only COWs
Father Chrysostomos [Sun, 11 Aug 2013 21:38:08 +0000 (14:38 -0700)]
sv.c:sv_grow: accept read-only COWs

sv_grow has long been permitted on read-only scalars.  This stopped
being the case all the time when 9a0a85075 and 1620522e4 allowed read-
nly copy-on-write scalars.  Because sv_force_normal has multiple
uses, sv_grow ended up croaking on *these* read-only scalars, but
not others.

This commit makes things consistent with the way they used to be.

10 years agoDevel::PPPort: force string when testing SvPV_renew
Father Chrysostomos [Sun, 11 Aug 2013 18:15:27 +0000 (11:15 -0700)]
Devel::PPPort: force string when testing SvPV_renew

Otherwise we could be reallocating a buffer shared by another scalar.

10 years agoTest multiline links in diagnostics.t
Father Chrysostomos [Mon, 12 Aug 2013 07:30:51 +0000 (00:30 -0700)]
Test multiline links in diagnostics.t

10 years agoAlphabetise perldiag
Father Chrysostomos [Mon, 12 Aug 2013 07:28:31 +0000 (00:28 -0700)]
Alphabetise perldiag

10 years agoIncrease $diagnostics::VERSION to 1.32
Father Chrysostomos [Mon, 12 Aug 2013 07:28:07 +0000 (00:28 -0700)]
Increase $diagnostics::VERSION to 1.32

10 years agodiagnostics: don’t truncate wrapped links
Father Chrysostomos [Mon, 12 Aug 2013 07:27:14 +0000 (00:27 -0700)]
diagnostics: don’t truncate wrapped links

10 years ago[perl #117355] [lu]cfirst don't respect 'use bytes'
Tony Cook [Mon, 12 Aug 2013 05:28:14 +0000 (15:28 +1000)]
[perl #117355] [lu]cfirst don't respect 'use bytes'

10 years ago[perl #117355] unTODO the [lu]cfirst under bytes tests
Tony Cook [Mon, 15 Jul 2013 06:16:22 +0000 (16:16 +1000)]
[perl #117355] unTODO the [lu]cfirst under bytes tests

10 years agoXXX Patch for discussion: [perl #117355] [lu]cfirst don't respect 'use bytes'
Karl Williamson [Sun, 5 May 2013 02:42:48 +0000 (20:42 -0600)]
XXX Patch for discussion: [perl #117355] [lu]cfirst don't respect 'use bytes'

10 years ago[perl #117355] very basic tests for [ul]c(first)? under use bytes
Tony Cook [Mon, 15 Jul 2013 06:06:46 +0000 (16:06 +1000)]
[perl #117355] very basic tests for [ul]c(first)? under use bytes

the [lu]cfirst tests are TODO due to #117355

10 years ago[perl #3330] warn on increment of an non number/non-magically incable value
Tony Cook [Mon, 12 Aug 2013 02:02:51 +0000 (12:02 +1000)]
[perl #3330] warn on increment of an non number/non-magically incable value

10 years agofix several problems in the MY_CXT example in perlxs.pod
Tony Cook [Mon, 12 Aug 2013 03:21:18 +0000 (13:21 +1000)]
fix several problems in the MY_CXT example in perlxs.pod

- duplicate declaration of name for newMouse

- missing OUTPUT clauses

- use of a member of the context object that doesn't exist in
  get_mouse_name()

- incorrect type assigned to RETVAL in get_mouse_name

- inconsistent indentation

- B<> to mark a heading instead of =headN

10 years agoForgot d_semctl in a429ddf7a2c14d.
Craig A. Berry [Sun, 11 Aug 2013 20:04:52 +0000 (15:04 -0500)]
Forgot d_semctl in a429ddf7a2c14d.

10 years agoadd Alexander Voronov to AUTHORS file
Ricardo Signes [Mon, 12 Aug 2013 00:33:08 +0000 (20:33 -0400)]
add Alexander Voronov to AUTHORS file

10 years agoUpdate perlipc.pod
Alexander Voronov [Thu, 28 Feb 2013 12:25:55 +0000 (16:25 +0400)]
Update perlipc.pod

10 years agoadd Viktor Turskyi to the AUTHORS file
Ricardo Signes [Sun, 11 Aug 2013 23:22:20 +0000 (19:22 -0400)]
add Viktor Turskyi to the AUTHORS file

10 years agoFixed typo (protoytpe => prototype)
Viktor Turskyi [Sun, 19 May 2013 14:19:34 +0000 (17:19 +0300)]
Fixed typo (protoytpe => prototype)

10 years ago[Merge] Fixes to reset("...")
Father Chrysostomos [Sun, 11 Aug 2013 20:45:06 +0000 (13:45 -0700)]
[Merge] Fixes to reset("...")

I tried to make copy-on-write more pervasive, and reset.t started
failing.  So I found myself reworking sv_resetpvn (i.e., deleting
parts of it).

10 years agoDon’t taint undef in reset
Father Chrysostomos [Sun, 11 Aug 2013 20:43:57 +0000 (13:43 -0700)]
Don’t taint undef in reset

reset was tainting undef if the internal SV type happened to be SVt_PV
or higher.  This has got to have been a mistake.  Tainting undef or
what is known to be an empty string does not make sense, even in a
tainted expression.  Tainting it based on the internal type does not
make sense either, and results in inconsistencies in behaviour (taint
it if it *was* a string, even though it isn’t now, but not if it was a
number, unless that number was tied, or had pos() set, etc.).

This tainting has been here since perl 3.0 (commit a687059cb), which I
think was when tainting was introduced.

Applying the tainting based on the internal type has happened since
79072805bf6 (perl 5.0 alpha 2), which introduced different internal
SV types.

10 years agoRemove special string handling from sv.c:sv_reset
Father Chrysostomos [Sun, 11 Aug 2013 20:14:03 +0000 (13:14 -0700)]
Remove special string handling from sv.c:sv_reset

Once upon a time, "" and undef were equivalent, and str_reset (as it
was called) would turn a scalar into an empty string.

Since commit 79072805bf6 (perl 5.0 alpha 2), sv_reset has set sca-
lars to undef.

Setting SvCUR to 0 and *SvPVX to '\0' (converted from str->cur and
str->ptr[0] by the same commit 79072805bf6) has not been neces-
sary since.

10 years agosv.c:sv_reset: Remove %ENV handling; fix for VMS
Father Chrysostomos [Sun, 11 Aug 2013 19:51:10 +0000 (12:51 -0700)]
sv.c:sv_reset: Remove %ENV handling; fix for VMS

The special env handling (calling my_clearenv) in sv_reset is com-
pletely unnecessary, because
 • sv_reset calls hv_clear
 • hv_clear calls mg_clear for magical arrays
 • mg_clear calls magic_set_all_env for %ENV
 • magic_set_all_env calls my_clearenv
so it gets called twice (confirmed with gdb breakpoints).

The VMS handling in sv_reset was wrong, because it was not even inside
the if(gv==PL_envgv) condition.  It was croaking for any hash, not
just %ENV (the fault of commit b0269e46d).  (This was based on code
inspection; not actually tested.)

Handling %ENV specially in sv_reset has been unnecessary since ‘clear’
magic was added to %ENV in commit fb73857aa (inseparable changes from
patch to perl 5.004_04).

10 years agoStop reset from skipping @ % if $ is read-only
Father Chrysostomos [Sun, 11 Aug 2013 19:29:31 +0000 (12:29 -0700)]
Stop reset from skipping @ % if $ is read-only

reset has been wrongly skipping arrays and hashes in the same glob as
read-only scalars since commit 9e35f4b3b4.

10 years agoreset.t: Basic tests for resetting aggregates
Father Chrysostomos [Sun, 11 Aug 2013 19:21:40 +0000 (12:21 -0700)]
reset.t: Basic tests for resetting aggregates

This probably incorrectly dies on VMS, based on code inspection.  Com-
mit  b0269e46d appears to have added the VMS-specific code in the
wrong place.

10 years agosv_reset: Don’t skip THINKFIRST items
Father Chrysostomos [Sun, 11 Aug 2013 18:52:35 +0000 (11:52 -0700)]
sv_reset: Don’t skip THINKFIRST items

Commit 9e35f4b3b4 made sv_reset skip SVs other than refs that had
SvTHINKFIRST set.  Back then SvTHINKFIRST was only true for refe-
rences and read-only variables, so this change was technically cor-
rect (except for skipping arrays and hashes, which this commit
does not fix).

But SvTHINKFIRST was expanded later (beginning in commit 6fc926691,
by the author of 9e35f4b3b4), making this code in sv_reset wrong.

In all fairness, it was already wrong before for things marked FAKE,
just differently wrong.

10 years agoFix threaded build broken by 823ac2c80
Father Chrysostomos [Sun, 11 Aug 2013 19:05:49 +0000 (12:05 -0700)]
Fix threaded build broken by 823ac2c80

10 years agoCall get-magic before rejecting non-refs in sv_bless
Father Chrysostomos [Sat, 10 Aug 2013 20:09:34 +0000 (13:09 -0700)]
Call get-magic before rejecting non-refs in sv_bless

Otherwise bless $tied_ref will die if FETCH hasn’t been called else-
where yet.

10 years agogv.c:newGP: assert that PL_curcop is not NULL
Father Chrysostomos [Sat, 10 Aug 2013 18:55:11 +0000 (11:55 -0700)]
gv.c:newGP: assert that PL_curcop is not NULL

It should never be null here, and we want to know if it is.  (It can
be set to null in op.c:S_cop_free, but it should always have been set
to something else by the time newGP is called.)

Nevertheless, we should leave the null checks in place, to avoid sabo-
taging non-debugging builds if there are any remaining bugs here.

10 years agogv.c:newGP: merge some threaded and non-threaded code
Father Chrysostomos [Sat, 10 Aug 2013 17:51:07 +0000 (10:51 -0700)]
gv.c:newGP: merge some threaded and non-threaded code

The previous commit cause the two alternate pieces of code to be
nearly identical.

10 years agoRestore NULL check to gv.c:newGP, removed by 19bad673
Father Chrysostomos [Sat, 10 Aug 2013 17:46:43 +0000 (10:46 -0700)]
Restore NULL check to gv.c:newGP, removed by 19bad673

1df5f7c195 added checks to newGP to account for PL_curcop being NULL.
19bad673 inadvertently removed the NULL check for non-threaded builds,
except in one spot.

Since S_cop_free now sets PL_curcop to NULL as of the previous commit
(something 1df5f7c195 was meant to do but didn’t), this check is a
good idea, even though PL_curcop is never NULL here.

See also <20130805200313.GS3729@plum.flirble.org>.

10 years agoSet PL_curcop to NULL in op.c:S_cop_free
Father Chrysostomos [Sat, 10 Aug 2013 17:41:11 +0000 (10:41 -0700)]
Set PL_curcop to NULL in op.c:S_cop_free

Having PL_curcop pointing to a freed op is a Bad Idea and something
that has caused bugs in the past.

The intent of commit 1df5f7c195 was to do this, but this part of
the commit was accidentally omitted.

See <20130805200313.GS3729@plum.flirble.org>.

10 years agoMake ++ handle regexps and vstrings
Father Chrysostomos [Sat, 10 Aug 2013 17:38:08 +0000 (10:38 -0700)]
Make ++ handle regexps and vstrings

$ ./perl -Ilib -e 'use Devel::Peek; $x = v97; ++$x; Dump $x'
SV = PVMG(0x7fbfa402b698) at 0x7fbfa402eed8
  REFCNT = 1
  FLAGS = (RMG,POK,pPOK)
  IV = 0
  NV = 0
  PV = 0x7fbfa3c066a8 "b"\0
  CUR = 1
  LEN = 24
  MAGIC = 0x7fbfa3c06348
    MG_VIRTUAL = 0
    MG_TYPE = PERL_MAGIC_vstring(V)
    MG_LEN = 3
    MG_PTR = 0x7fbfa3c13ee8 "v97"

The vstring magic is still attached (with something that does not
match the contents of the string), even after modifying it.  I
probably broke that in 5.18 after fixing it in 5.16, but I am too
lazy to check.

$ ./perl -le '$x = ${qr//}; $x++; print "$x"'
Assertion failed: (PL_valid_types_IVX[SvTYPE(_svivx) & SVt_MASK]), function Perl_sv_2pv_flags, file sv.c, line 2908.
Abort trap: 6

That I broke when I stopped regexps from being POK in perl 5.18.0.

It was creating a corrupt SV by setting the IOK flag on something of
type SVt_REGEXP.

10 years agoStop -- from crashing on regexps
Father Chrysostomos [Sat, 10 Aug 2013 17:01:06 +0000 (10:01 -0700)]
Stop -- from crashing on regexps

I mean dereferenced regexps, as returned by ${ qr// }.

It was creating a corrupt SV by setting the IOK flag on something
of type SVt_REGEXP.

This is something I broke when I stopped regexps from being POK
in perl 5.18.0.

10 years agoMake PL_hints an alias for PL_compiling.cop_hints
Father Chrysostomos [Sun, 11 Aug 2013 15:08:08 +0000 (08:08 -0700)]
Make PL_hints an alias for PL_compiling.cop_hints

PL_hints stores the hints at compile time that get copied into the
cop_hints field of each COP (in newSTATEOP).

Since perl-5.8.0-8053-gd5ec298, COPs have stored all the hints.

Before that, COPs used to store only some of the hints.  The hints
were copied here and there into PL_compiling, a static COP-shaped buf-
fer used during compilation, so that things like constant folding
would see the correct hints.  a0ed51b3 back in 1998 did that.

Now that COPs can store all the hints, we can just use
PL_compiling.cop_hints to avoid having to copy them from PL_hints from
time to time.

This simplifies the code and avoids creating bugs like those that
a547fd219 and 1c75beb82 fixed.

10 years agoModifying ${^OPEN} changes the value of $^H:
Father Chrysostomos [Sat, 10 Aug 2013 16:49:28 +0000 (09:49 -0700)]
Modifying ${^OPEN} changes the value of $^H:

$ ./perl -le 'BEGIN { print $^H; ${^OPEN} = "a\0b"; print $^H}'
256
917760

So changing $^H back should change the value of ${^OPEN} back to undef, right?

$ ./perl -le 'BEGIN { ${^OPEN} = "a\0b"; $^H=256; print ${^OPEN}//"undef"}'
ab
$ ./perl -le 'BEGIN { ${^OPEN} = "a\0b"; $^H=256;}BEGIN{ print ${^OPEN}//"undef"}'
undef

Apparently you have to hop from one BEGIN block to another to see
the changes.

This happens because compile-time hints are stored in PL_hints (which
$^H sets) but ${^OPEN} looks in PL_compiling.cop_hints.  Setting
${^OPEN} sets both.  The contents of PL_hints are assigned to
PL_compiling.cop_hints at certain points (the start of a BEGIN block
sees the right value because newSTATEOP sets it), but the two are not
always kept in synch.

The smallest fix here is to have $^H set PL_compiling.cop_hints as
well as PL_hints, but the ultimate fix--to come later--is to merge the
two and stop storing hints in two different places.

10 years agosv.c: Remove more ro exceptions that c72a4ee missed.
Father Chrysostomos [Sat, 10 Aug 2013 13:07:07 +0000 (06:07 -0700)]
sv.c: Remove more ro exceptions that c72a4ee missed.

10 years agoFix booleanness of regexps
Father Chrysostomos [Sat, 10 Aug 2013 12:30:41 +0000 (05:30 -0700)]
Fix booleanness of regexps

I broke this when I stopped regexps from being POK in 5.18.