platform/upstream/perl.git
11 years agodocument that it is the operator that determines the operation
Moritz Lenz [Sun, 21 Apr 2013 14:11:06 +0000 (16:11 +0200)]
document that it is the operator that determines the operation

In many other dynamic languages it is the operator plus the type of the
first operand, so it is worth mentioning.

11 years agoIncrease $if::VERSION to 0.0603
Father Chrysostomos [Wed, 26 Jun 2013 06:31:34 +0000 (23:31 -0700)]
Increase $if::VERSION to 0.0603

11 years agoAdded example usage and SEE ALSO links to similar modules in doc for if.pm
Neil Bowers [Mon, 24 Jun 2013 23:51:49 +0000 (00:51 +0100)]
Added example usage and SEE ALSO links to similar modules in doc for if.pm

11 years agoop.c:S_simplify_sort: remove redundant OPf_STACKED check
Father Chrysostomos [Wed, 26 Jun 2013 05:06:57 +0000 (22:06 -0700)]
op.c:S_simplify_sort: remove redundant OPf_STACKED check

S_simplify_sort is only called from one spot and only when the
OPf_STACKED flag is not set.

11 years agoop.c:ck_sort: Restore HINT_LOCALIZE_HH check
Father Chrysostomos [Wed, 26 Jun 2013 04:47:44 +0000 (21:47 -0700)]
op.c:ck_sort: Restore HINT_LOCALIZE_HH check

I remove this by mistake in commit 354dd559d99.  It makes no
difference to the behaviour.  This check is just for efficiency.

11 years agoRevert "Use UTF8f in more places"
Karl Williamson [Wed, 26 Jun 2013 00:42:45 +0000 (18:42 -0600)]
Revert "Use UTF8f in more places"

This reverts commit acc19697c67fa63c10e07491b670a26c48f4175f.

This and the other UTF8f patch are causing significant problems on some
configurations on 32-bit platforms.  We've decided to revert them until
they can be resubmitted after the kinks get ironed out.

11 years agoRevert "UTF8f"
Karl Williamson [Wed, 26 Jun 2013 00:40:42 +0000 (18:40 -0600)]
Revert "UTF8f"

This reverts commit 670610ebb17508101065cc5f5ecfe616aace5335.

This and the other UTF8f patch are causing significant problems on some
configurations on 32-bit platforms.  We've decided to revert them until
they can be resubmitted after the kinks get ironed out.

11 years agoAdd tests for a backreference following a literal, which is a different codepath
Yves Orton [Tue, 25 Jun 2013 22:59:09 +0000 (00:59 +0200)]
Add tests for a backreference following a literal, which is a different codepath

/\87/ is parsed through a different code path than /foo\87/ so we
test that they both work properly when there are sufficient capture
buffers defined. We test the fail cases in the re/re_tests corpus,
but the success cases are easier managed in re/pat.t.

11 years agoFix rules for parsing numeric escapes in regexes
Yves Orton [Tue, 25 Jun 2013 19:01:27 +0000 (21:01 +0200)]
Fix rules for parsing numeric escapes in regexes

Commit 726ee55d introduced better handling of things like \87 in a
regex, but as an unfortunate side effect broke latex2html.

The rules for handling backslashes in regexen are a bit arcane.

Anything starting with \0 is octal.

The sequences \1 through \9 are always backrefs.

Any other sequence is interpreted as a decimal, and if there
are that many capture buffers defined in the pattern at that point
then the sequence is a backreference. If however it is larger
than the number of buffers the sequence is treated as an octal digit.

A consequence of this is that \118 could be a backreference to
the 118th capture buffer, or it could be the string "\11" . "8". In
other words depending on the context we might even use a different
number of digits for the escape!

This also left an awkward edge case, of multi digit sequences
starting with 8 or 9 like m/\87/ which would result in us parsing
as though we had seen /87/ (iow a null byte at the start) or worse
like /\x{00}87/ which is clearly wrong.

This patches fixes the cases where the capture buffers are defined,
and causes things like the \87 or \97 to throw the same error that
/\8/ would. One might argue we should complain about an illegal
octal sequence, but this seems more consistent with an error like
/\9/ and IMO will be less surprising in an error message.

This patch includes exhaustive tests of patterns of the form
/(a)\1/, /((a))\2/ etc, so that we dont break this again if we
change the logic more.

11 years agoDocument and clean up -s option to xsubpp
Steffen Mueller [Mon, 24 Jun 2013 05:59:30 +0000 (07:59 +0200)]
Document and clean up -s option to xsubpp

At the same time, discourage its use. It's an obscure option that, most
of the time, does the opposite of what people actually need. If nothing
else, it should be a feature of XS instead of xsubpp.

But it exists, so documenting it with a warning is the right thing to
do.

11 years agoStop "sv_2mortal(&PL_sv_yes)" and "(void)sv_newmortal()" in ParseXS
Daniel Dragan [Sat, 25 May 2013 16:06:27 +0000 (18:06 +0200)]
Stop "sv_2mortal(&PL_sv_yes)" and "(void)sv_newmortal()" in ParseXS

This problem was brought up in #115796.  Both of those lines of code that
ParseXS put out when dealing with T_BOOL were unnecessary, and caused a
some inefficiencies (extra calls). Since typemaps can have complicated
evaluation and include Perl code, see commit    9712754a3e, it is best to
eval the typemap entry first, then regexp it to see what it looks like,
not regexp the unevaled entry possibly containing Perl. In case a typemap
entry is maintaining state inside ParseXS (venturing into the undocumented
and unsupported), (I've never seen it done) don't eval it twice if it can
be avoided. Someone might want to change the typemap entry to multiple
eval in the future, but don't introduce it now if it can be avoided.

Using T_BOOL by name to see an immortal is a bad idea, since any XS module
can reuse the typemap entry, so best to regexp for something that looks
like it would return an immortal, "= &PL_sv_* ;" or "= boolSV(". In the
future someone might want to introduce a macro that does nothing, except
gives a signal to ParseXS that an expression returns an immortal or an
already mortaled SV, to suppress the sv_2mortal call.

The tests in 001-basic.t might break in the future with changes to ParseXS
or the Perl API, but I assume they will be fixed at that point in time.

Note: This patch was amended by the committer to apply cleanly to a
newer version of ExtUtils::ParseXS and to include all necessary test
changes.

11 years agoEU::ParseXS: Test cleanup
Steffen Mueller [Wed, 22 May 2013 20:08:42 +0000 (22:08 +0200)]
EU::ParseXS: Test cleanup

Lots of dead code and some inflexibilities wrt. running tests from / or
t/.

11 years agoEU::ParseXS: Move several constants out of the runtime object
Steffen Mueller [Wed, 22 May 2013 20:07:59 +0000 (22:07 +0200)]
EU::ParseXS: Move several constants out of the runtime object

11 years agoEU::ParseXS: Cosmetics; more explicitness in *_handler
Steffen Mueller [Wed, 22 May 2013 20:07:10 +0000 (22:07 +0200)]
EU::ParseXS: Cosmetics; more explicitness in *_handler

Basically, using named lexical beats $_ by a long shot since they don't
magically propagate into functions called.

11 years agoEU::ParseXS: Use OO version of ExtUtils::ParseXS in test
Steffen Mueller [Wed, 22 May 2013 20:04:51 +0000 (22:04 +0200)]
EU::ParseXS: Use OO version of ExtUtils::ParseXS in test

Sort of. Breaking encapsulation, but that's better than not even having
a blessed object at all.

11 years agoEU::ParseXS: Simplify output typemap code generation (targetable)
Steffen Mueller [Wed, 22 May 2013 20:03:38 +0000 (22:03 +0200)]
EU::ParseXS: Simplify output typemap code generation (targetable)

11 years agoEU::ParseXS: Cosmetics; better variable naming
Steffen Mueller [Wed, 22 May 2013 20:00:48 +0000 (22:00 +0200)]
EU::ParseXS: Cosmetics; better variable naming

11 years agoEU::ParseXS: Fix targetable size detection
Steffen Mueller [Wed, 22 May 2013 19:57:59 +0000 (21:57 +0200)]
EU::ParseXS: Fix targetable size detection

Adds new / vastly improved tests for 'targetable'.
Also improves targetable documentation.

11 years agoEU::ParseXS: Drop dup'd code: make_targetable moves to EU::Typemaps
Steffen Mueller [Wed, 22 May 2013 19:53:44 +0000 (21:53 +0200)]
EU::ParseXS: Drop dup'd code: make_targetable moves to EU::Typemaps

The make_targetable function in ExtUtils::ParseXS::Utilities now lives
in ExtUtils::Typemaps::OutputMap as method 'targetable' since the code
was quite duplicated before. Makes very minor adjustments to
'targetable'.

Removes the flawed make_targetable tests. Improved tests in lieu of the
old ones will be added asap.

11 years agoEU::ParseXS: Update changelog
Steffen Mueller [Wed, 22 May 2013 19:51:55 +0000 (21:51 +0200)]
EU::ParseXS: Update changelog

11 years agoEU::ParseXS: Attempt to canonicalize C++ types in tidy_type
Steffen Mueller [Wed, 22 May 2013 19:49:06 +0000 (21:49 +0200)]
EU::ParseXS: Attempt to canonicalize C++ types in tidy_type

Includes moving tidy_type to ExtUtils::Typemaps where it seems to
belong. It's a pretty poor canonicalizer, but better than nothing!

11 years agoEU::ParseXS: Update Changelog
Steffen Mueller [Mon, 15 Apr 2013 06:48:07 +0000 (08:48 +0200)]
EU::ParseXS: Update Changelog

11 years agoEU::Typemaps: Document special typemap variables
Steffen Mueller [Mon, 15 Apr 2013 06:47:23 +0000 (08:47 +0200)]
EU::Typemaps: Document special typemap variables

For better or for worse, these are likely to stay. Don't cry if they
don't.

11 years agoEU::ParseXS: Stop using global state; an OO interface
Steffen Mueller [Mon, 15 Apr 2013 06:31:53 +0000 (08:31 +0200)]
EU::ParseXS: Stop using global state; an OO interface

This stops ExtUtils::ParseXS from using global state (unless using the
functional interface which uses a singleton for compatibility). It also
makes the interface more or less properly OO.

Includes tests & docs; migrates xsubpp to use the OO interface.

11 years agoEU::ParseXS: Don't inherit from Exporter; import 'import' instead
Steffen Mueller [Mon, 15 Apr 2013 06:01:36 +0000 (08:01 +0200)]
EU::ParseXS: Don't inherit from Exporter; import 'import' instead

11 years agoEU::ParseXS: Only initialize some parser regexps once
Steffen Mueller [Mon, 15 Apr 2013 05:59:28 +0000 (07:59 +0200)]
EU::ParseXS: Only initialize some parser regexps once

11 years agoEU::Typemaps: Implement API for typemap cloning
Steffen Mueller [Mon, 15 Apr 2013 05:56:41 +0000 (07:56 +0200)]
EU::Typemaps: Implement API for typemap cloning

The docs used to suggest cloning, but never provided an API.

11 years agoExtUtils::ParseXS version bump to 3.21
Steffen Mueller [Mon, 15 Apr 2013 05:56:17 +0000 (07:56 +0200)]
ExtUtils::ParseXS version bump to 3.21

11 years ago[perl #75186] Remove obsolete references to vi support
Tony Cook [Tue, 25 Jun 2013 05:36:09 +0000 (15:36 +1000)]
[perl #75186] Remove obsolete references to vi support

11 years ago[perl #118561] failures loading modules are ignored when sub-package exists
Graham Knop [Mon, 24 Jun 2013 21:58:46 +0000 (17:58 -0400)]
[perl #118561] failures loading modules are ignored when sub-package exists

11 years agoRemove spaces from a (copy of) a proto when used. The logic that uses prototypes...
Peter Martini [Mon, 24 Jun 2013 21:58:46 +0000 (17:58 -0400)]
Remove spaces from a (copy of) a proto when used. The logic that uses prototypes assumes spaces were already gone, which may not be true if they were added via XS / set_prototype.

11 years agopodcheck.t: Re-enable --add_link
Karl Williamson [Mon, 24 Jun 2013 23:50:32 +0000 (17:50 -0600)]
podcheck.t: Re-enable --add_link

Commit 83ced756 broke the --add_link option to podcheck.t.  Now fixed

11 years agoUpdate B's size/offset for CvFLAGS to U32, following commit 51c78f1b91bbcd7a.
Nicholas Clark [Sat, 22 Jun 2013 21:25:26 +0000 (14:25 -0700)]
Update B's size/offset for CvFLAGS to U32, following commit 51c78f1b91bbcd7a.

B.xs contains a table of offsets and sizes for members of the various SV
structures. This needs updating as 51c78f1b91bbcd7a changed CvFLAGS from
U16 to U32. This ommision won't be noticed on little endian platforms, but on
big endian platforms B::CV::CvFLAGS will return 0 instead of the true value.

For: RT #118603

11 years agoUpdate autodie to CPAN version 2.20
Chris 'BinGOs' Williams [Mon, 24 Jun 2013 11:07:20 +0000 (12:07 +0100)]
Update autodie to CPAN version 2.20

  [DELTA]

  2.20      2013-06-23 16:08:41 PST8PDT

        Many improvements from Niels Thykier, hero of the
        free people.  From GH #25:

        * SPEED / INTERNAL: Less time is spent computing prototypes

        * SPEED / INTERNAL: Leak guards are more efficient.

        * SPEED : Expanding tags (eg: qw(:all)) is now faster.
          This also improves the speed of checking autodying
          code with Perl::Critic.

        * INTERNAL: Expanding of tags is faster and preserves order.

11 years ago[perl #113926] fix a hash randomization bug
Tony Cook [Mon, 24 Jun 2013 03:19:44 +0000 (13:19 +1000)]
[perl #113926] fix a hash randomization bug

Through sheer sloppiness I managed to avoid actually running the new
test, sorry for the noise.

it compared [ keys %hasha ] and [ keys %hashb ] resulting in failure.

11 years ago[perl #113926] add tests for Pod::Html::anchorify()
James E Keenan [Mon, 24 Jun 2013 01:48:03 +0000 (11:48 +1000)]
[perl #113926] add tests for Pod::Html::anchorify()

11 years agoperldelta for changes to perlexperiment
Ricardo Signes [Mon, 24 Jun 2013 01:56:58 +0000 (21:56 -0400)]
perldelta for changes to perlexperiment

11 years agoperlexperiment: mark lvalue subroutines accepted
Ricardo Signes [Mon, 24 Jun 2013 01:26:54 +0000 (21:26 -0400)]
perlexperiment: mark lvalue subroutines accepted

11 years agoperlexperiment: (?{}) and (??{}) are not experimental
Ricardo Signes [Fri, 21 Jun 2013 02:33:15 +0000 (22:33 -0400)]
perlexperiment: (?{}) and (??{}) are not experimental

...but we need some more explanation of its limitations.  This text
was provided by Yves Orton on perl5-porters in message
<CANgJU+UXO7tKZgOvbwufFxAjupOcKVPdDBNkRrT7DWKdv9tBgw@mail.gmail.com>

11 years agoperlexperiment: mark regexp backtracking verbs as accepted
Ricardo Signes [Fri, 21 Jun 2013 01:43:30 +0000 (21:43 -0400)]
perlexperiment: mark regexp backtracking verbs as accepted

11 years agoQuote and indent %B::Concise::priv initialisation consistently
Dagfinn Ilmari Mannsåker [Sun, 23 Jun 2013 16:09:18 +0000 (17:09 +0100)]
Quote and indent %B::Concise::priv initialisation consistently

- use qw() for all word lists
- use double quotes for single strings (only) where necessary
- hanging indent after opening operator/paren

No difference in the resulting data structure, as verified with:

  ./perl -Ilib -MData::Dumper -MB::Concise -e 'package Data::Dumper {
    $Sortkeys = $Terse = $Useqq = $Deepcopy = 1; $Quotekeys = 0 }
    print Dumper(\%B::Concise::priv)'

Bump B::Concise $VERSION.

For: RT #118609.

11 years ago[perl #116781] several small changes to h2xs
Tony Cook [Mon, 24 Jun 2013 01:22:56 +0000 (11:22 +1000)]
[perl #116781] several small changes to h2xs

I don't think this requires a perldelta entry

11 years agoh2xs: place for license for META.* files
Alexandr Ciornii [Thu, 7 Feb 2013 11:09:20 +0000 (13:09 +0200)]
h2xs: place for license for META.* files

11 years agoh2xs: remove useless compatibility code (VERSION_FROM requires EU::MM from perl 5.5)
Alexandr Ciornii [Thu, 7 Feb 2013 11:05:21 +0000 (13:05 +0200)]
h2xs: remove useless compatibility code (VERSION_FROM requires EU::MM from perl 5.5)

11 years agoh2xs: dependency on XSLoader should be declared even when it is in core
Alexandr Ciornii [Thu, 7 Feb 2013 10:34:37 +0000 (12:34 +0200)]
h2xs: dependency on XSLoader should be declared even when it is in core

11 years agoh2xs: remove indirect object notation
Alexandr Ciornii [Thu, 7 Feb 2013 10:18:28 +0000 (12:18 +0200)]
h2xs: remove indirect object notation

11 years agoperldiag: Correct ‘Unknown Unicode option value’
Father Chrysostomos [Sun, 23 Jun 2013 23:25:54 +0000 (16:25 -0700)]
perldiag: Correct ‘Unknown Unicode option value’

11 years agoperldiag: Document ‘SWASHNEW didn't return an HV ref’
Father Chrysostomos [Sun, 23 Jun 2013 23:17:56 +0000 (16:17 -0700)]
perldiag: Document ‘SWASHNEW didn't return an HV ref’

11 years agoperldiag: Correct ‘Repeated format line...’
Father Chrysostomos [Sun, 23 Jun 2013 22:48:41 +0000 (15:48 -0700)]
perldiag: Correct ‘Repeated format line...’

The perldiag entry has differed from the actual error since both were
added in a1b950687051c.

11 years agoperldiag: Correct ‘Perl %s required’
Father Chrysostomos [Sun, 23 Jun 2013 22:44:08 +0000 (15:44 -0700)]
perldiag: Correct ‘Perl %s required’

11 years agoperldiag: Correct ‘Pattern subroutine nesting...’
Father Chrysostomos [Sun, 23 Jun 2013 22:42:51 +0000 (15:42 -0700)]
perldiag: Correct ‘Pattern subroutine nesting...’

11 years agodiag.t: Tolerate trailing spaces in C code
Father Chrysostomos [Sun, 23 Jun 2013 22:41:22 +0000 (15:41 -0700)]
diag.t: Tolerate trailing spaces in C code

11 years agoperldiag: Document mprotect errors
Father Chrysostomos [Sun, 23 Jun 2013 22:26:23 +0000 (15:26 -0700)]
perldiag: Document mprotect errors

11 years agoperldiag: Correct ‘length() used on %s’
Father Chrysostomos [Sun, 23 Jun 2013 22:20:07 +0000 (15:20 -0700)]
perldiag: Correct ‘length() used on %s’

11 years agoperldiag: Document ‘internal %<num>p might conflict’
Father Chrysostomos [Sun, 23 Jun 2013 22:12:17 +0000 (15:12 -0700)]
perldiag: Document ‘internal %<num>p might conflict’

11 years agoperldiag: Correct ‘Infinite recursion in regex’
Father Chrysostomos [Sun, 23 Jun 2013 22:01:48 +0000 (15:01 -0700)]
perldiag: Correct ‘Infinite recursion in regex’

11 years agosv.c: Allow COWs through sv_magic unscathed
Father Chrysostomos [Sun, 23 Jun 2013 21:38:32 +0000 (14:38 -0700)]
sv.c: Allow COWs through sv_magic unscathed

There is no need to run COWs through sv_force_normal when
attaching magic to them via sv_magic.  (I don’t know about
PERL_OLD_COPY_ON_WRITE, but I left it in, just to be sure.)

Before this, only sv_magicext could attach magic to SVs that were
already COWs.  That meant pos($cow)=7 would leave it as a COW, but
copy-on-write would never happen with tainted strings.

11 years agoperldiag: Correct ‘Don't know how to handle magic’
Father Chrysostomos [Sun, 23 Jun 2013 21:32:39 +0000 (14:32 -0700)]
perldiag: Correct ‘Don't know how to handle magic’

11 years agoperldiag: Add the elliptical variant of strict refs error
Father Chrysostomos [Sun, 23 Jun 2013 20:53:36 +0000 (13:53 -0700)]
perldiag: Add the elliptical variant of strict refs error

So that diagnostics.pm can find it.

11 years agoStop undef &foo from crashing on lex subs
Father Chrysostomos [Sun, 23 Jun 2013 19:06:11 +0000 (12:06 -0700)]
Stop undef &foo from crashing on lex subs

11 years agoop.c: Refactor calls to bad_type_sv
Father Chrysostomos [Sun, 23 Jun 2013 13:49:17 +0000 (06:49 -0700)]
op.c: Refactor calls to bad_type_sv

Every single caller passes gv_ename(namegv), so make it accept a GV
instead and have *it* call gv_ename(namegv).

11 years agogv.c:gv_fetchmethod_pvn_flags: Avoid unnecessary extra SV
Father Chrysostomos [Sun, 23 Jun 2013 13:43:25 +0000 (06:43 -0700)]
gv.c:gv_fetchmethod_pvn_flags: Avoid unnecessary extra SV

11 years agoUse UTF8f in more places
Father Chrysostomos [Sun, 23 Jun 2013 13:27:35 +0000 (06:27 -0700)]
Use UTF8f in more places

This saves having to allocate as many SVs.

11 years agoDocument scalarref retvals of @INC hook
Father Chrysostomos [Sun, 23 Jun 2013 07:04:57 +0000 (00:04 -0700)]
Document scalarref retvals of @INC hook

Or: Reinstate documentation removed by cec0e1a713ccb.

That commit’s message says ‘Change the documentation of the return
values of @INC-hooks to match what is tested to work.’  But commit
34113e50d, which came before it, had already tested scalar refs.

In any case, this feature has been here for a long time, is well
tested, ain’t going anywhere, and hence needs to be documented.

11 years agoregcomp.c:regdump_intflags: rem unused var
Father Chrysostomos [Sun, 23 Jun 2013 06:56:40 +0000 (23:56 -0700)]
regcomp.c:regdump_intflags: rem unused var

11 years ago[Merge] Fix bugs involving compilation and ro SVs
Father Chrysostomos [Sun, 23 Jun 2013 06:17:21 +0000 (23:17 -0700)]
[Merge] Fix bugs involving compilation and ro SVs

There was an exception in sv_force_normal_flags that allowed read-only
scalars to be modified at compile time (present since 8990e30710, aka
\perl 5.0 alpha 6), which is convenient for modifying op trees.

Unfortunately, much of the code relying on it was simply buggy.  So
this commit fixes those bugs and removes the exception.  In some cases
the bug fixes led to other bug fixes, not necessarily related to
sv_force_normal/SvREADONLY.

11 years agoRemove ‘Can't coerce readonly %s’ error
Father Chrysostomos [Sun, 23 Jun 2013 00:40:04 +0000 (17:40 -0700)]
Remove ‘Can't coerce readonly %s’ error

$ ./perl -Ilib -e 'for(\1){ vec($_,0,1)=1 }'
Can't coerce readonly REF to string in sassign at -e line 1.

Why not ‘Modification of a read-only value’ as elsewhere?

The code in question, in sv_pvn_force_flags, allows references to
bypass the initial read-only check.  (This has been the case since
perl-5.005_02-1047-g6fc9266.  I think it was a mistake.)  Then there
is a check further down that croaks with this error, unless called as
SvPV_force_mutable (i.e., with the SV_MUTABLE_RETURN flag).

So that means read-only references can silently be flattened, regard-
less of the read-only flag, if the caller uses SvPV_force_mutable.
Fortunately, the only use of that macro in the core is in fbm_compile,
which I recently modified so that it wouldn’t touch references at all.

I don’t understand the logic that allows read-only thingies to be mod-
ified in the presence of the SV_MUTABLE_RETURN flag, but not other-
wise.  As of the previous commit, which removed the exception for
read-only scalars at compile time, nothing can reach that code except
read-only references.

This commit restores the logic inadvertently changed by 6fc9266 and
removes the code that becomes unreachable as a result.

11 years agosv.c: Make sv_force_normal always croak on ro SVs
Father Chrysostomos [Sat, 22 Jun 2013 23:14:24 +0000 (16:14 -0700)]
sv.c: Make sv_force_normal always croak on ro SVs

Commit 8990e30710 (perl 5.0 alpha 6) changed several SvREADONLY checks
to apply only to run time.  This is convenient when it comes to modify-
ing op trees, whose SVs are, for the most part, marked read-only.

But several pieces of code that relied on this were buggy when dealing
with constants created by ‘use constant’.  To make it harder to add
such bugs, I have changed all code that relies on this exception and
am now removing it.

11 years agoIncrease $B::Deparse::VERSION to 1.22
Father Chrysostomos [Sat, 22 Jun 2013 19:43:09 +0000 (12:43 -0700)]
Increase $B::Deparse::VERSION to 1.22

11 years agotoke.c: Don’t depend on sv_force_normal’s good graces
Father Chrysostomos [Sat, 22 Jun 2013 19:09:07 +0000 (12:09 -0700)]
toke.c: Don’t depend on sv_force_normal’s good graces

when parsing ‘keyword =>’ with comments or line breaks before the =>.

sv_force_normal will allow modification of read-only values at compile
time.  While this might be convenient, it has resulted in many bugs
elsewhere, so I am trying to change that.  This is a necessary pre-
requisite.

11 years agoCopy scalar refs returned from @INC filters
Father Chrysostomos [Sat, 22 Jun 2013 08:16:22 +0000 (01:16 -0700)]
Copy scalar refs returned from @INC filters

This commit:

4464f08ea532be08ea7f0c44d0eb6e285a0c36fb is the first bad commit
commit 4464f08ea532be08ea7f0c44d0eb6e285a0c36fb
Author: Nicholas Clark <nick@ccl4.org>
Date:   Fri Oct 23 16:54:10 2009 +0100

    S_run_user_filter() can use the filter GV itself for the cache buffer.

    This saves allocating an extra SV head and body.

caused this:

$ perl -e '@INC = sub { \$_ }; eval { require foo }; $a = $_;'
Bizarre copy of IO in sassign at -e line 1.

Well, passing the existing string to filter_add causes that string
*itself* to be upgraded to SVt_PVIO, which is clearly not a good thing
if the caller can still reference it.  So we end up with $ bound to an
IO thingy.

And if the referent is a REGEXP, we get a crash during global destruc-
tion, or at least we did until the previous commit, which stopped
REGEXP->PVIO upgrades from being legal.  (Clearly they don’t work.)

The easiest way to fix this is to copy the string into a new scalar,
which then gets upgraded to PVIO.

11 years agoStop SVt_REGEXPs from being upgraded.
Father Chrysostomos [Sat, 22 Jun 2013 07:51:14 +0000 (00:51 -0700)]
Stop SVt_REGEXPs from being upgraded.

Any code that is going to write over a REGEXP will call
sv_force_normal first, which converts it to

This code started crashing in 5.12:

$_ = qr//;
@INC = sub { $_ };
require foo;

Search pattern not terminated at /loader/0x7fe3b082c2e8/foo.pm line 1.
Compilation failed in require at - line 4.
Segmentation fault: 11

With current bleadperl:

foo.pm did not return a true value at - line 4.
Segmentation fault: 11

This change makes it like this instead:

Can't upgrade REGEXP (8) to 15 at - line 3.

which is certainly an improvement.  We shouldn’t be getting any error
at all (OK, just a syntax error because (?^:) is not a valid expres-
sion), and the next commit will fix that, but this commit at least
turns a crash into a panic, in case future changes accidentally send a
regexp through sv_upgrade(sv, SVt_PVIO).

11 years agodump.c: Dump PV fields of SVt_PVIOs
Father Chrysostomos [Sat, 22 Jun 2013 01:18:33 +0000 (18:18 -0700)]
dump.c: Dump PV fields of SVt_PVIOs

Yes, these can hold PVs when source filters are involved.

11 years agoutil.c: Stop ck_index/fbm_compile from abusing readonliness
Father Chrysostomos [Fri, 21 Jun 2013 21:19:54 +0000 (14:19 -0700)]
util.c: Stop ck_index/fbm_compile from abusing readonliness

There is currently a convenient exception in sv_force_normal that
allows read-only scalars to be modified at compile time.

I want to get rid of it, since most code that relies on it is buggy.

So stop ck_index from relying on that when it calls fbm_compile by
stopping fbm_compile from triggering the error by forcing stringifica-
tion of variables that are already strings.

11 years agoStop ck_index from flattening other people’s SVs
Father Chrysostomos [Fri, 21 Jun 2013 21:14:08 +0000 (14:14 -0700)]
Stop ck_index from flattening other people’s SVs

By passing to fbm_compile the SV that is the second argument to
index(), ck_index causes it to be stringified.

That means, for example, that dualvars will lose their numeric
representation and regexps will be flattened (affecting regexp
code blocks).

This patch allows POK-only SVs to be compiled into BMs in place, as
it just adds magic and does not otherwise affect them.  Other SVs get
copied first.

Also, I avoided a compile-time uninitialized warning by not running
fbm_compile on undef SVs.

11 years agosv.h: Correct assertion in BmUSEFUL
Father Chrysostomos [Fri, 21 Jun 2013 20:26:54 +0000 (13:26 -0700)]
sv.h: Correct assertion in BmUSEFUL

BmUSEFUL uses the NV slot, not the IV slot.  So asserting that it is
not IOK is not all that useful.

11 years agoStop fbm_compile from flattening refs
Father Chrysostomos [Fri, 21 Jun 2013 19:54:53 +0000 (12:54 -0700)]
Stop fbm_compile from flattening refs

References can change their stringification any time, so flattening
them ahead of time for efficiency gives incorect results.

Also, using a reference constant as the second argument to index
would result in the constant itself being flattened, even when used
elsewhere.

11 years agoindex.t: Comment final brace
Father Chrysostomos [Fri, 21 Jun 2013 04:59:40 +0000 (21:59 -0700)]
index.t: Comment final brace

otherwise it can be quite confusing

11 years agoStop split from mangling constants
Father Chrysostomos [Fri, 21 Jun 2013 04:44:00 +0000 (21:44 -0700)]
Stop split from mangling constants

At compile time, if split occurs on the right-hand side of an assign-
ment to a list of scalars, if the limit argument is a constant con-
taining the number 0 then it is modified in place to hold one more
than the number of scalars.

This means ‘constants’ can change their values, if they happen to be
in the wrong place at the wrong time:

$ ./perl -Ilib -le 'use constant NULL => 0; ($a,$b,$c) = split //, $foo, NULL; print NULL'
4

I considered checking the reference count on the SV, but since XS code
could create its own const ops with weak references to the same cons-
tants elsewhere, the safest way to avoid modifying someone else’s SV
is to mark the split op in ck_split so we know the SV belongs to that
split op alone.

Also, to be on the safe side, turn off the read-only flag before modi-
fying the SV, instead of relying on the special case for compile time
in sv_force_normal.

11 years agoIncrease $DBM_Filter::utf8::VERSION to 0.03
Father Chrysostomos [Sun, 23 Jun 2013 05:02:20 +0000 (22:02 -0700)]
Increase $DBM_Filter::utf8::VERSION to 0.03

11 years agoIncrease perl5db.pl’s $VERSION to 1.41
Father Chrysostomos [Sun, 23 Jun 2013 05:01:46 +0000 (22:01 -0700)]
Increase perl5db.pl’s $VERSION to 1.41

11 years agoIncrease $integer::VERSION to 1.01
Father Chrysostomos [Sun, 23 Jun 2013 05:01:03 +0000 (22:01 -0700)]
Increase $integer::VERSION to 1.01

11 years agoIncrease $deprecate::VERSION to 0.03
Father Chrysostomos [Sun, 23 Jun 2013 05:00:43 +0000 (22:00 -0700)]
Increase $deprecate::VERSION to 0.03

11 years agoIncrease $Tie::Scalar::VERSION to 1.03
Father Chrysostomos [Sun, 23 Jun 2013 05:00:26 +0000 (22:00 -0700)]
Increase $Tie::Scalar::VERSION to 1.03

11 years agoIncrease $Tie::Hash::VERSION to 1.05
Father Chrysostomos [Sun, 23 Jun 2013 05:00:03 +0000 (22:00 -0700)]
Increase $Tie::Hash::VERSION to 1.05

11 years agoIncrease $Tie::Array::VERSION to 1.06
Father Chrysostomos [Sun, 23 Jun 2013 04:59:42 +0000 (21:59 -0700)]
Increase $Tie::Array::VERSION to 1.06

11 years agoIncrease $Getopt::Std::VERSION to 1.09
Father Chrysostomos [Sun, 23 Jun 2013 04:59:14 +0000 (21:59 -0700)]
Increase $Getopt::Std::VERSION to 1.09

11 years agoIncrease $File::Basename::VERSION to 2.85
Father Chrysostomos [Sun, 23 Jun 2013 04:58:27 +0000 (21:58 -0700)]
Increase $File::Basename::VERSION to 2.85

11 years agoIncrease $ExtUtils::XSSymSet::VERSION to 1.3
Father Chrysostomos [Sun, 23 Jun 2013 04:58:02 +0000 (21:58 -0700)]
Increase $ExtUtils::XSSymSet::VERSION to 1.3

11 years agoIncrease $English::VERSION to 1.07
Father Chrysostomos [Sun, 23 Jun 2013 04:56:51 +0000 (21:56 -0700)]
Increase $English::VERSION to 1.07

11 years agoIncrease $DBM_Filter::null::VERSION to 0.03
Father Chrysostomos [Sun, 23 Jun 2013 04:56:30 +0000 (21:56 -0700)]
Increase $DBM_Filter::null::VERSION to 0.03

11 years agoIncrease $DBM_Filter::int32::VERSION to 0.03
Father Chrysostomos [Sun, 23 Jun 2013 04:56:08 +0000 (21:56 -0700)]
Increase $DBM_Filter::int32::VERSION to 0.03

11 years agoIncrease $DBM_Filter::encode::VERSION to 0.03
Father Chrysostomos [Sun, 23 Jun 2013 04:55:49 +0000 (21:55 -0700)]
Increase $DBM_Filter::encode::VERSION to 0.03

11 years agoIncrease $DBM_Filter::compress::VERSION to 0.03
Father Chrysostomos [Sun, 23 Jun 2013 04:55:32 +0000 (21:55 -0700)]
Increase $DBM_Filter::compress::VERSION to 0.03

11 years agoIncrease $DBM_Filter::VERSION to 0.06
Father Chrysostomos [Sun, 23 Jun 2013 04:54:52 +0000 (21:54 -0700)]
Increase $DBM_Filter::VERSION to 0.06

11 years agoIncrease $DB::VERSION to 1.07
Father Chrysostomos [Sun, 23 Jun 2013 04:54:23 +0000 (21:54 -0700)]
Increase $DB::VERSION to 1.07

11 years agoIncrease $Class::Struct::VERSION to 0.65
Father Chrysostomos [Sun, 23 Jun 2013 04:53:12 +0000 (21:53 -0700)]
Increase $Class::Struct::VERSION to 0.65

11 years agoIncrease $Benchmark::VERSION to 1.17
Father Chrysostomos [Sun, 23 Jun 2013 04:52:11 +0000 (21:52 -0700)]
Increase $Benchmark::VERSION to 1.17

11 years agoIncrease $XS::APItest::VERSION to 0.54
Father Chrysostomos [Sun, 23 Jun 2013 04:51:42 +0000 (21:51 -0700)]
Increase $XS::APItest::VERSION to 0.54

11 years agoIncrease $I18N::Langinfo::VERSION to 0.11
Father Chrysostomos [Sun, 23 Jun 2013 04:51:07 +0000 (21:51 -0700)]
Increase $I18N::Langinfo::VERSION to 0.11