platform/upstream/perl.git
10 years agotoke.c:S_tokeq: add comment
Father Chrysostomos [Fri, 1 Nov 2013 12:48:41 +0000 (05:48 -0700)]
toke.c:S_tokeq: add comment

10 years agotoke.c:S_tokeq: remove dead code
Father Chrysostomos [Fri, 1 Nov 2013 12:47:40 +0000 (05:47 -0700)]
toke.c:S_tokeq: remove dead code

The argument passed to tokeq is always a plain string owning its own
buffer.  I checked all the callers.

This code has been like this since perl 5.000.

10 years agoRemove ancient threads diagnostics from perldiag
Father Chrysostomos [Fri, 1 Nov 2013 12:44:20 +0000 (05:44 -0700)]
Remove ancient threads diagnostics from perldiag

for several reasons:
• The wording has changed, so nobody is using these entries anyway.
• The perldiag entries are clearly not being maintained.
• The threads module has its own list of diagnostics.
• The actual wording depends on the version of the threads module
  installed, not the version of perl.

10 years agoperlhack.pod: consistent spaces after dots
Father Chrysostomos [Fri, 1 Nov 2013 13:24:28 +0000 (06:24 -0700)]
perlhack.pod: consistent spaces after dots

10 years agoperllexwarn: consistent spaces after dots
Father Chrysostomos [Thu, 31 Oct 2013 12:52:24 +0000 (05:52 -0700)]
perllexwarn: consistent spaces after dots

10 years ago‘Attempt to bless into a ref’ with stale method caches
Father Chrysostomos [Thu, 31 Oct 2013 13:03:53 +0000 (06:03 -0700)]
‘Attempt to bless into a ref’ with stale method caches

As of v5.16.0-81-g234df27, SvAMAGIC has only meant potentially over-
loaded.  When method changes occur, the flag is turned on.  When over-
loading tables are calculated (the first time overloading is used),
the flag is turned off if it turns out there is no overloading.

At the time I did that, I assumed that all uses of SvAMAGIC were to
avoid the inefficient code path for non-overloaded objects.  What I
did not notice at the time was that SvAMAGIC is used in pp_bless to
determine whether an object used as a class name should be exempt from
‘Attempt to bless into a reference’.

Hence, the bizarre result:

$ ./perl -Ilib -e 'sub foo{} bless [], bless []'
$ ./perl -Ilib -e 'bless [], bless []'
Attempt to bless into a reference at -e line 1.

This commit makes both die consistently, as they did in 5.16.

10 years ago[perl #119809] Disallow bless($ref, $tied_ref)
Father Chrysostomos [Thu, 31 Oct 2013 12:13:25 +0000 (05:13 -0700)]
[perl #119809] Disallow bless($ref, $tied_ref)

There is no reason tied (or otherwise magical variables like $/)
should be exempt from the ‘Attempt to bless into a reference’ error.

10 years agobless.t: More explicit test
Father Chrysostomos [Thu, 31 Oct 2013 01:05:41 +0000 (18:05 -0700)]
bless.t: More explicit test

Not only does this prevent us from accidentally producing the wrong
error, it also makes it easy to grep and see that this error is
tested.

10 years agoUse tabs consistently in AUTHORS
Father Chrysostomos [Thu, 31 Oct 2013 00:57:28 +0000 (17:57 -0700)]
Use tabs consistently in AUTHORS

10 years agoDocumentation Patches from Tom Hukins
Tom Hukins [Tue, 29 Oct 2013 10:25:21 +0000 (03:25 -0700)]
Documentation Patches from Tom Hukins

Reported as [perl #120406].

tr is documented in perlop's "Quote-Like Operators" section, not its
"Quote and Quote-like Operators" section.

Don't describe PerlIO as "new".

10 years agoperllexwarn: typo, pod syntax
Father Chrysostomos [Thu, 31 Oct 2013 12:46:39 +0000 (05:46 -0700)]
perllexwarn: typo, pod syntax

10 years agoAdd a note that users of FATAL warnings are at risk during upgrades
Yves Orton [Thu, 31 Oct 2013 12:38:43 +0000 (13:38 +0100)]
Add a note that users of FATAL warnings are at risk during upgrades

Apparently it isn't obvious to all of our users that use of FATAL
warnings means that peoples code may break when they upgrade due
to the introduction of new warnings. Accordingly we document that
the use of FATAL warnings is entirely at the users risk, and that
we do not and will not consider the introduction of a warning as
an incompatible change, and that in particular the use of features
which are discouraged, unspecified, or whatnot may in the future
trigger new warnings, and thus under FATAL warnings break their code.

10 years agoIntroduce PERL_BOOL_AS_CHAR define
Father Chrysostomos [Wed, 30 Oct 2013 12:37:43 +0000 (05:37 -0700)]
Introduce PERL_BOOL_AS_CHAR define

This allows compilers that do support real booleans (C++ or anything
with stdbool.h) to emulate those that don’t.

See ticket #120314.

This patch incorporates suggestions from Craig Berry.

10 years agoperlre: Expand and clarify /x and (?# comment)
Karl Williamson [Thu, 31 Oct 2013 00:30:26 +0000 (18:30 -0600)]
perlre: Expand and clarify /x and (?# comment)

This pod omitted some of the details about how comments in regexes work.
I had to do some experimentation to find some of the answers.
I believe this clarifies things as well.

10 years agoFix broken qr/ \N* /x
Karl Williamson [Thu, 31 Oct 2013 00:22:04 +0000 (18:22 -0600)]
Fix broken qr/ \N* /x

Under /x, the parsing was skipping the character following a \N (when
meaning [^\n]).  In fact the parse pointer was already pointing to the
first non-white-space character, so advancing skipped the character.
That character could be the beginning of a (?#...) comment, all of which
should be skipped.

10 years agoregcomp.c: Clarify some comments
Karl Williamson [Wed, 30 Oct 2013 04:41:26 +0000 (22:41 -0600)]
regcomp.c: Clarify some comments

10 years agopad.h: Correct PadlistMAX docs
Father Chrysostomos [Wed, 30 Oct 2013 23:54:06 +0000 (16:54 -0700)]
pad.h: Correct PadlistMAX docs

They have been wrong since I added them.

10 years agoIncrease $B::Deparse::VERSION to 1.24
Father Chrysostomos [Wed, 30 Oct 2013 21:01:45 +0000 (14:01 -0700)]
Increase $B::Deparse::VERSION to 1.24

10 years ago[perl #119807] Deparse s//\(3)/e in a way that does not warn
Father Chrysostomos [Wed, 30 Oct 2013 21:01:15 +0000 (14:01 -0700)]
[perl #119807] Deparse s//\(3)/e in a way that does not warn

Code that does not warn should not be deparsed in a way that warns.
s//\3/e produces a warning about misuse of \3 where $3 is meant.
s//\(3)/e compiles to the same thing and produces no such warning.
So B::Deparse should parenthesize references to numbers in the rhs
of a substitution.

10 years agoEliminate ‘Can't use \1 to mean $1’ false positives
Father Chrysostomos [Wed, 30 Oct 2013 13:18:20 +0000 (06:18 -0700)]
Eliminate ‘Can't use \1 to mean $1’ false positives

We need to check that the quote-like operator we are parsing is a sub-
stitution (not just any quote-like operator) and that we are parsing
the right-hand side.

10 years agoenable LTO/LTCG/WPO for most Visual Cs
Daniel Dragan [Mon, 28 Oct 2013 05:28:41 +0000 (01:28 -0400)]
enable LTO/LTCG/WPO for most Visual Cs

All Win32 Visual C compilers except for VC 6/_MSC_VER == 1200 support LTCG.
LTCG generates slightly smaller and slightly faster binaries.

10 years ago[perl #120408] fix dist/ExtUtils-ParseXS/t/002-more.t
François Perrad [Tue, 29 Oct 2013 13:04:01 +0000 (06:04 -0700)]
[perl #120408] fix dist/ExtUtils-ParseXS/t/002-more.t

the plan is fragile 29 = 2 + 2 + 25

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
10 years ago'$! = EACCESS; require ...' could fail
David Mitchell [Mon, 28 Oct 2013 16:39:35 +0000 (16:39 +0000)]
'$! = EACCESS; require ...' could fail

When require is checking against a particular entry in @INC, it stats the
potential pathname, and does various checks like skipping if it's a
directory. In this case the stat succeeds, so $! is left unchanged.
Later however, pp_require() checks for $! being EACCES. So if $! was
already set before the require, this could influence require's behaviour.

10 years agoDon’t record cop address for unbreakable lines
Father Chrysostomos [Tue, 29 Oct 2013 04:22:14 +0000 (21:22 -0700)]
Don’t record cop address for unbreakable lines

The cop (control op) address for each statement is recorded in
${"_<$file"}[$line] so that breakpoints set on that line will flag the
op for that statement.

Then, at run time, pp_dbstate checks to see whether the op is flagged
as having a breakpoint, and calls the debugger if so.

Statements that are not breakable are nextstate, rather than dbstate
ops, and pp_nextstate ignores the flag on the op.

In some instances, the cop address was being recorded for nextstate
ops.  This would happen in preamble code (e.g., the PERL5DB envi-
ronment variable or the -M switch) and when $^P contained 0x400
but not 0x02.

Recording the cop address for a nextstate op serves no purpose and is
a waste of CPU cycles.

10 years ago[perl #119799] Set breakpoints without *DB::dbline
Father Chrysostomos [Mon, 28 Oct 2013 23:14:35 +0000 (16:14 -0700)]
[perl #119799] Set breakpoints without *DB::dbline

The elements of the %{"_<..."} hashes (where ‘...’ is the filename),
whose keys are line numbers, are used to set breakpoints on the given
lines.  The corresponding @{"_<..."} array contains the actual lines
of source code.

%{"_<..."} actually acts on the array of lines that @DB::dbline is
aliased to.  The assumption is that *DB::dbline = *{"_<..."} will have
taken place first.  Hence, all %{"_<..."} hashes are the same, when it
comes to writing to keys.

It is more useful for each %{"_<..."} hash to set breakpoints on its
corresponding file’s lines regardless of whether @DB::dbline has been
aliased, so that is what this commit does.

Each hash’s mg_obj pointer in its dbfile magic now points to the
array, and magic_setdbline uses it instead of PL_DBline.

10 years agopp.c:pp_undef: Don’t vivify the scalar slot
Father Chrysostomos [Mon, 28 Oct 2013 19:38:46 +0000 (12:38 -0700)]
pp.c:pp_undef: Don’t vivify the scalar slot

When PERL_DONT_CREATE_GVSV is defined, perl generally does not vivify
the scalar slot in every GV.  But it hides that implementation detail
by vivifying it when *foo{SCALAR} is accessed.

undef(*foo) was one exception to this.  It vivified the scalar in
the scalar slot regardless of whether PERL_DONT_CREATE_GVSV was
defined.

Until recently, it was not safe to remove this exception, because a
typeglob with no scalar could be a candidate for downgrading (see
gv.c:gv_try_downgrade), causing global pointers like PL_DBgv to point
to freed SVs.  Recent commits have fixed all those cases, so this
is now safe.

10 years agoMake PL_incgv fully refcounted
Father Chrysostomos [Mon, 28 Oct 2013 19:31:22 +0000 (12:31 -0700)]
Make PL_incgv fully refcounted

It was only reference-counted in the main thread:

$ ./perl -Ilib -e 'delete $::{INC}; eval q"my $foo : bar"'
$ ./perl -Ilib -e 'use threads; async {delete $::{INC}; eval q"my $foo : bar"}->join'
Assertion failed: (SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV), function S_apply_attrs_my, file op.c, line 2600.
Abort trap: 6

10 years agopat.t: suppress warning
Father Chrysostomos [Mon, 28 Oct 2013 19:26:17 +0000 (12:26 -0700)]
pat.t: suppress warning

10 years agoperl.h: Remove ERRHV
Father Chrysostomos [Mon, 28 Oct 2013 12:48:44 +0000 (05:48 -0700)]
perl.h: Remove ERRHV

It has been unused by the core since 5.6.0 (98eae8f58) and is
unused on CPAN.

10 years agoDon’t assume *^R has a scalar
Father Chrysostomos [Mon, 28 Oct 2013 00:09:17 +0000 (17:09 -0700)]
Don’t assume *^R has a scalar

$ perl -e '*^R = *foo; /(?{})/'
Segmentation fault: 11

10 years ago[perl #54044] Make PL_replgv refcounted
Father Chrysostomos [Sun, 27 Oct 2013 23:44:50 +0000 (16:44 -0700)]
[perl #54044] Make PL_replgv refcounted

Otherwise one can free it and make perl crash:

$ perl -e 'delete $::{"\cR"}; //'
Segmentation fault: 11

It crashes because PL_replgv now points to a freed SV which has no GV
slots, so GvSV on it fails.

10 years agogv:gv_try_downgrade: Leave PL_last_in_gv alone
Father Chrysostomos [Sun, 27 Oct 2013 23:02:44 +0000 (16:02 -0700)]
gv:gv_try_downgrade: Leave PL_last_in_gv alone

gv_try_downgrade exists to remove globs and subs that were (possibly
temporarily) vivified by bareword lookup.  It is called whenever a
gvop is freed and its gv looks like a candidate for downgrading.  That
means it applies, not only to potential sub calls, but also to *foo
and *bar.  gv_try_downgrade may delete a glob from the stash alto-
gether if it is empty.  So eval "*foo if 0" may delete the *foo glob.

PL_last_in_gv is the internal variable underlying ${^LAST_FH}.  If
gv_try_downgrade deletes the last-read handle, then ${^LAST_FH}
will become undefined, whereas eval "*foo if 0" is not supposed to
do anything:

$ ./miniperl -le 'readline *{"foo"}; warn ${^LAST_FH}; eval "*foo if 0"; warn ${^LAST_FH}'
GLOB(0x7f8f5a0052a0) at -e line 1.
Warning: something's wrong at -e line 1.

10 years agoMake PL_argvgv refcounted
Father Chrysostomos [Sun, 27 Oct 2013 21:37:10 +0000 (14:37 -0700)]
Make PL_argvgv refcounted

Otherwise one can free it and cause assertion failures when other
things do SvREFCNT_inc on a freed scalar:

$ ./miniperl -le 'undef *x; delete $::{ARGV}; $x++; eval "BEGIN{undef *x} readline"'
Assertion failed: (SvTYPE(sv) != (svtype)SVTYPEMASK), function Perl_sv_clear, file sv.c, line 6215.
Abort trap: 6

10 years agogv:gv_try_downgrade: Leave PL_stderrgv alone
Father Chrysostomos [Sun, 27 Oct 2013 18:24:52 +0000 (11:24 -0700)]
gv:gv_try_downgrade: Leave PL_stderrgv alone

gv_try_downgrade exists to remove globs and subs that were (possibly
temporarily) vivified by bareword lookup.  It is called whenever a
gvop is freed and its gv looks like a candidate for downgrading.  That
means it applies, not only to potential sub calls, but also to *foo
and *bar.  gv_try_downgrade may delete a glob from the stash alto-
gether if it is empty.  So eval "*foo if 0" may delete the *foo glob.

PL_stderrgv is a shortcut variable that points to *STDERR.  When
PL_stderrgv is null, the real stderr is used as a fallback.

If gv_try_downgrade deletes *STDERR (which causes PL_stderrgv to be
cleared), it can could the behaviour, which is not supposed to happen.
It doesn’t actually delete *STDERR right now, because undef() vivifies
the scalar slot, disqualifying the glob from downgrading.

If we change undef not to vivify the scalar slot (I plan to soon, and
this commit prepares for it), then this is what would happen without
this commit:

$ perl -le 'close *{"STDERR"}; undef *{"STDERR"}; eval "*STDERR if 0"; *{"STDERR"} = *STDOUT{IO}; warn'
$ perl -le 'close *{"STDERR"}; undef *{"STDERR"}; *{"STDERR"} = *STDOUT{IO}; warn'
Warning: something's wrong at -e line 1.

Notice how the first one-liner (with the eval) produces no output.

10 years agoWhen deleting via hek, pass the computed hash value
Father Chrysostomos [Sun, 27 Oct 2013 13:35:35 +0000 (06:35 -0700)]
When deleting via hek, pass the computed hash value

In those cases where the hash key comes from a hek, we already have a
computed hash value, so pass that to hv_common.

The easiest way to accomplish this is to add a new macro.

10 years agoMake PL_hintgv refcounted
Father Chrysostomos [Sun, 27 Oct 2013 12:52:09 +0000 (05:52 -0700)]
Make PL_hintgv refcounted

Otherwise one can free it (by deleting the *^H glob) and
cause a crash:

$ perl -e 'delete $::{"\cH"}; ${^OPEN}=foo'
Segmentation fault: 11

That happens because PL_hintgv points to a freed scalar, and
GvHV(PL_hintgv) ends up trying to access nonexistent fields.

10 years agoDon’t create %@ on startup
Father Chrysostomos [Sun, 27 Oct 2013 00:23:18 +0000 (17:23 -0700)]
Don’t create %@ on startup

This hash has been unused since perl-5.005_02-2093-g98eae8f:

commit 98eae8f585b9800849b5e5482e2d405f21bab67e
Author: Gurusamy Sarathy <gsar@cpan.org>
Date:   Fri Oct 8 10:26:15 1999 +0000

    remove kludgey duplicate background error avoidance (caused
    "leaks"; %@ wasn't even user-visible under -Dusethreads);
    only repeats of most recent error are now avoided

    p4raw-id: //depot/perl@4316

10 years ago[perl #119811] Remove %DB::lsub
Father Chrysostomos [Sun, 27 Oct 2013 00:08:28 +0000 (17:08 -0700)]
[perl #119811] Remove %DB::lsub

Under the debugger (the -d switch), if there is a DB::sub subroutine,
then %DB::lsub gets autovivified during a call to an lvalue sub.  That
hash is never used.  The code for vivifying the *DB::lsub glob was
copied from *DB::sub when lsub was added, and *DB::sub does have a
hash (%DB::sub), but *DB::lsub doesn’t need one.

10 years agoMake PL_envgv refcounted
Father Chrysostomos [Sat, 26 Oct 2013 23:51:23 +0000 (16:51 -0700)]
Make PL_envgv refcounted

Otherwise deleting $::{ENV} will make chdir crash:

$ perl -e 'delete $::{ENV}; chdir'
Segmentation fault: 11

This happens because PL_envgv points to a freed SV and GvHV(PL_envgv)
tries to access nonexistent fields.

10 years agoMake PL_firstgv and PL_secondgv refcounted
Father Chrysostomos [Sat, 26 Oct 2013 20:49:40 +0000 (13:49 -0700)]
Make PL_firstgv and PL_secondgv refcounted

Otherwise freeing *a or *b in a sort block will result in a crash:

$ perl -e '@_=sort { delete $::{a}; 3 } 1..3'
Segmentation fault: 11

10 years agoUpdate Socket to CPAN version 2.013
Chris 'BinGOs' Williams [Mon, 28 Oct 2013 22:38:11 +0000 (22:38 +0000)]
Update Socket to CPAN version 2.013

  [DELTA]

2.013   2031/10/28 00:49:43
        [BUGFIXES]
         * Unit-test bugfixes for VMS (RT89766):
            + Need to pass protocol => IPPROTO_TCP to avoid SCTP as well
            + Perform AI_NUMERICHOST test against non-"localhost"
            + May have to set NI_NUMERICSERV flag if it fails without

10 years agoUpdate HTTP-Tiny to CPAN version 0.037
Chris 'BinGOs' Williams [Mon, 28 Oct 2013 22:36:42 +0000 (22:36 +0000)]
Update HTTP-Tiny to CPAN version 0.037

  [DELTA]

0.037     2013-10-28 13:26:21 America/New_York

    [FIXED]

    - Basic authentication in the URL is now unescaped before being encoded
      into the authentication header

    [DOCUMENTED]

    - Added HTTP::Tiny::UA to SEE ALSO and suggested it as the appropriate
      place for new features

10 years ago[perl #120398] skip t/porting/extrefs.t when cross-compiling
François Perrad [Mon, 28 Oct 2013 19:29:29 +0000 (12:29 -0700)]
[perl #120398] skip t/porting/extrefs.t when cross-compiling

The toolchain is not installed on the target when cross-compiling.
So, this test must be skipped.
(same problem as RT#119769)

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
10 years agoperlfunc: clarify hash "modify while iterating"
David Mitchell [Mon, 28 Oct 2013 10:28:07 +0000 (10:28 +0000)]
perlfunc: clarify hash "modify while iterating"

[perl #120308]

5.18.0 introduced a new warning:

   Use of each() on hash after insertion without resetting hash iterator
   results in undefined behavior

which resulted in a debate as to whether the behaviour should also be
*documented* as as "undefined". This commit updates the documentation to
say that it is "unspecified".

10 years agogetnameinfo, getaddrinfo, and inet_xxx fix-ups for configure.com.
Craig A. Berry [Mon, 28 Oct 2013 02:43:55 +0000 (21:43 -0500)]
getnameinfo, getaddrinfo, and inet_xxx fix-ups for configure.com.

This is mostly a very belated follow-up to d7fba2bf7c68c, but in
the case of inet_aton, is a stupendously belated follow-up to
570bb66edbdc8.

10 years agoDon't make bool an int on VMS.
Craig A. Berry [Mon, 28 Oct 2013 02:31:13 +0000 (21:31 -0500)]
Don't make bool an int on VMS.

The special case has been there since 61bb59065bf1b12edab3, most
likely because the VMS C++ compiler, like a lot of other C++
compilers in the 1990s implemented a bool as an int, and making
the type in C compatible seemed like a good idea.  But no C++
compiler that's likely to build Perl on VMS has a bool type that
occupies more than one byte now, so remove the special case.  We're
unlikely to even see this code since we've had stdbool.h since
DEC C 6.4, released in 2001.

10 years agoUpdate Unicode-Collate to CPAN version 1.00
Chris 'BinGOs' Williams [Sun, 27 Oct 2013 22:06:43 +0000 (22:06 +0000)]
Update Unicode-Collate to CPAN version 1.00

  [DELTA]

1.00  Sun Oct 27 13:22:17 2013
    - When a subroutine by 'overrideOut' taking a out-of-range value and
      returning undef, now the value is treated as if it were U+FFFD.
      * 0.99 wrongly calculates implicit weights based on out-of-range values.
    - Assertion using unpack 'U' is added. If not only pack('U') but also
      unpack('U') of CORE:: don't work as expected, this module will die.

10 years agoUpdate Term-Cap to CPAN version 1.15
Chris 'BinGOs' Williams [Sat, 26 Oct 2013 20:44:25 +0000 (21:44 +0100)]
Update Term-Cap to CPAN version 1.15

  [DELTA]

1.15 Sat Oct 26 21:28:29 BST 2013
      - meta data patch from David Steinbrunner
      - Change email in metadata

1.14 Sat Oct 26 19:20:03 BST 2013
      - Update versions everywhere
      - Change email address and add the github location

1.13 Sat Oct 26 19:08:27 BST 2013
      -  Bring everything up to date with all patches from RT
      - Sync version with core

10 years agoDon’t let gv.c:gv_try_downgrade touch PL_statgv
Father Chrysostomos [Sat, 26 Oct 2013 19:28:11 +0000 (12:28 -0700)]
Don’t let gv.c:gv_try_downgrade touch PL_statgv

PL_statgv remembers the handle last used by stat, for the sake of -T _
and -B _.  If a glob is freed when PL_statgv points to it, PL_statgv
is set to null.

gv_try_downgrade exists to remove globs and subs that were (possibly
temporarily) vivified by bareword lookup.  It is called whenever a
gvop is freed and its gv looks like a candidate for downgrading.  That
means it applies, not only to potential sub calls, but also to *foo
and *bar.  gv_try_downgrade may delete a glob from the stash alto-
gether if it is empty.  So eval "*foo if 0" may delete the *foo glob.

If PL_statgv is pointing to *foo, then eval "*foo if 0" may change the
behaviour, which is not supposed to happen:

$ ./perl -Ilib -le 'stat *{"foo"}; -T _; print $!; -T _; print $!'
Bad file descriptor
Bad file descriptor
$ ./perl -Ilib -le 'stat *{"foo"}; -T _; print $!; eval "*foo if 0"; -T _; print $!'
Bad file descriptor
No such file or directory

10 years agoMake PL_DBgv and other db interp vars refcounted
Father Chrysostomos [Sat, 26 Oct 2013 13:00:59 +0000 (06:00 -0700)]
Make PL_DBgv and other db interp vars refcounted

$ PERL5DB=1 perl -de '*DB::DB = sub {} if 0; sub DB::DB{}'
No DB::DB routine defined at -e line 1.

When the ‘if’ gets folded and *DB::DB is freed, it triggers
gv_try_downgrade, causing $DB::{DB} to be deleted and PL_DBgv to point
to a freed SV.  A higher refcount would prevent gv_try_downgrade from
touching it.

10 years agoperl.c: Avoid redundant gv_AVadd and GvAVn
Father Chrysostomos [Sat, 26 Oct 2013 12:42:08 +0000 (05:42 -0700)]
perl.c: Avoid redundant gv_AVadd and GvAVn

We don’t need to call gv_AVadd if follewed by GvAVn, which itself
calls gv_AVadd when the AV is null.

Also, we don’t need to keep checking whether GvAV(PL_argvgv) is still
defined (via GvAVn with the final n) when pushing on to it.

This code goes back at least to perl 5 alpha 2.

10 years agogv:gv_add_by_type: Don’t check @ISA when not vivifying
Father Chrysostomos [Sat, 26 Oct 2013 12:40:10 +0000 (05:40 -0700)]
gv:gv_add_by_type: Don’t check @ISA when not vivifying

I added the code (in 986d39eeb4) to magicalise @ISA when vivifying it
via @{*ISA}.  But we don’t need to do that every time gv_add_by_type
is called, just when it is autovivifying.

10 years agoAdd op_other to B::Concise -debug output for LOGOPs
Matthew Horsfall [Thu, 3 Oct 2013 14:09:22 +0000 (10:09 -0400)]
Add op_other to B::Concise -debug output for LOGOPs

10 years agoRegen META.{yml,json}
Father Chrysostomos [Fri, 25 Oct 2013 21:40:11 +0000 (14:40 -0700)]
Regen META.{yml,json}

(If t/porting/regen.t fails without this regeneration, why doesn’t
‘make regen’ do this?)

10 years agoAdd Kevin Falcone to AUTHORS
Father Chrysostomos [Fri, 25 Oct 2013 21:36:31 +0000 (14:36 -0700)]
Add Kevin Falcone to AUTHORS

10 years agoNo longer point to rt.perl.org/perlbug/ as a landing page
Kevin Falcone [Tue, 22 Oct 2013 18:42:49 +0000 (14:42 -0400)]
No longer point to rt.perl.org/perlbug/ as a landing page

We'll use the homepage of rt.perl.org instead, as it's much more likely
to get text updates.

10 years agoupdate RTSERVER
Kevin Falcone [Tue, 22 Oct 2013 18:39:16 +0000 (14:39 -0400)]
update RTSERVER

This didn't work properly as is (because of the redirect from
http://rt.perl.org/rt3/ to https://rt.perl.org/rt3/) but at least it'll
work if someone tries it going forward.

10 years agoAllow newer bug URLs on rt.perl.org
Kevin Falcone [Tue, 22 Oct 2013 18:38:53 +0000 (14:38 -0400)]
Allow newer bug URLs on rt.perl.org

10 years agoFixup rt.perl.org/rt3 => rt.perl.org
Kevin Falcone [Tue, 22 Oct 2013 18:38:22 +0000 (14:38 -0400)]
Fixup rt.perl.org/rt3 => rt.perl.org

These links all would redirect properly, but give out the top URL.

10 years agoUpdate AutoLoader to CPAN version 5.74
Chris 'BinGOs' Williams [Fri, 25 Oct 2013 18:49:52 +0000 (19:49 +0100)]
Update AutoLoader to CPAN version 5.74

  [DELTA]

5.74  Fri Oct 25 19:08 2013
  - Makefile.PL: Set installdirs to "site" on Perl >= 5.12

10 years agoMake sure truncated in-memory files have trailing null
Father Chrysostomos [Fri, 25 Oct 2013 13:26:16 +0000 (06:26 -0700)]
Make sure truncated in-memory files have trailing null

Just spotted this....

If the target scalar contains something already, then setting SvCUR to
0 is not sufficient.

10 years agot/porting/dual-life.t: Another exception
Father Chrysostomos [Fri, 25 Oct 2013 13:18:55 +0000 (06:18 -0700)]
t/porting/dual-life.t: Another exception

In parallel testing, it might fail on files like
cpan/Module-Metadata/MB-9dzadSLU/Simple/bin/simple.plx.

10 years agoIncrease PerlIO::scalar::VERSION to 0.18
Father Chrysostomos [Fri, 25 Oct 2013 13:16:02 +0000 (06:16 -0700)]
Increase PerlIO::scalar::VERSION to 0.18

10 years agoBetter fix for #119529
Father Chrysostomos [Fri, 25 Oct 2013 13:15:30 +0000 (06:15 -0700)]
Better fix for #119529

<$fh> used to loop if $fh was opened to an in-memory handle containing
a reference.

Commit 552908b174 fixed the loop by forcing a reference to a string
when the handle was created.  It did not take into account that the
reference might be read-only.  It was also insufficient, in that
the target scalar could be set to a reference after the handle
was created.

The real reason it was looping was that the code for returning and
setting the size of the buffer was not handling non-PVs properly
(unless they were globs, which were special-cased).  It might return
0, and it might not, depending on what the internal SV field hap-
pened to hold.

This caused looping under 5.12 and onwards, but even in 5.10 <$fh>
returned nothing.

In this case, deleting code makes things just work.

Reverting the hunk from 552908b174 stops appending to refs from work-
ing, so I tweaked PerlIOScalar_pushed to fix that (which also reduced
the amount of code).

10 years agoRemove some unnecessary Makefile.PLs from cpan/ and ext/
Steve Hay [Wed, 23 Oct 2013 09:32:25 +0000 (10:32 +0100)]
Remove some unnecessary Makefile.PLs from cpan/ and ext/

These modules all work with the default Makefile.PL written by make_ext.pl.

(There are more Makefile.PLs in dist/ that could be removed too, but the
general policy with dist/ is to leave such files in place to make it easier
to roll CPAN releases from the blead source, which is canonical.)

10 years agoSilence some Win32 compiler warnings
Karl Williamson [Fri, 25 Oct 2013 04:35:51 +0000 (22:35 -0600)]
Silence some Win32 compiler warnings

These get rid of some "possible loss of data" warnings

10 years agoPATCH [perl #120314]: fold_grind.t spews tons of warnings
Karl Williamson [Fri, 18 Oct 2013 02:33:30 +0000 (20:33 -0600)]
PATCH [perl #120314]: fold_grind.t spews tons of warnings

It turns out that fixing the compiler warnings about possible loss of data
(by adding casts) silences these warnings.

10 years agoPropagate lvalue context to && and ||
Father Chrysostomos [Thu, 24 Oct 2013 21:45:34 +0000 (14:45 -0700)]
Propagate lvalue context to && and ||

I did this for the last statement in an lvalue sub (and the argument
to ‘return’ in an lvalue sub) in commit 2ec7f6f2428.

It turns out that it needs to apply in other lvaluish contexts, too:

$ ./perl -Ilib -le 'for($a||$b){$_++} print $b'
1
$ ./perl -Ilib -le 'for(pos $a || pos $b){$_++} print pos $b'
Modification of a read-only value attempted at -e line 1.

If I can assign to $b through this construct, then why not pos?

10 years agopp_hot.c:pp_rv2av: Remove superfluous SPAGAIN
Father Chrysostomos [Thu, 24 Oct 2013 19:53:21 +0000 (12:53 -0700)]
pp_hot.c:pp_rv2av: Remove superfluous SPAGAIN

Commit perl-5.8.0-9908-g5e17dd7, in March of 2007, added a SPAGAIN
here to account for the stack shifting when hv_scalar calls tied
hashes’ SCALAR method.

It was never necessary, because commit perl-5.8.0-3008-ga3bcc51,
which added hv_scalar and magic_scalarpack in December of 2003, made
magic_scalarpack push a new stack, protecting the old one.

10 years agorv2hv does not use its TARG
Father Chrysostomos [Thu, 24 Oct 2013 19:46:52 +0000 (12:46 -0700)]
rv2hv does not use its TARG

rv2hv has had a TARG since perl 5.000, but it has not used it since
hv_scalar was added in perl-5.8.0-3008-ga3bcc51.

This commit removes it, saving a tiny bit of space in the pad.

10 years agoUpdate Package-Constants to CPAN version 0.04
Chris 'BinGOs' Williams [Thu, 24 Oct 2013 19:42:28 +0000 (20:42 +0100)]
Update Package-Constants to CPAN version 0.04

  [DELTA]

0.04    Thu Oct 24 20:34:00 BST 2013
=================================================
* Update Makefile.PL to add repository et al
* Install into site if >= v5.12.0
* Add use deprecate due to core scheduled removal

10 years agoSchedule Package::Constants for removal from core
Chris 'BinGOs' Williams [Thu, 24 Oct 2013 19:20:03 +0000 (20:20 +0100)]
Schedule Package::Constants for removal from core

10 years agoUpdate Archive-Tar to CPAN version 1.96
Chris 'BinGOs' Williams [Thu, 24 Oct 2013 19:13:11 +0000 (20:13 +0100)]
Update Archive-Tar to CPAN version 1.96

  [DELTA]

1.96  24/10/2013
- integrate Package::Constants into Constant module
  and remove requirement on it.

1.94  24/10/2013
- install into site if >= 5.012

1.93_02 22/10/2013 (XLAT)
- [rt.cpan.org #78030] symlinks resolution on MSWin32

10 years agoRestore prev. behaviour of @a||... in lv sub
Father Chrysostomos [Thu, 24 Oct 2013 17:53:46 +0000 (10:53 -0700)]
Restore prev. behaviour of @a||... in lv sub

$ perl5.18.1 -lwe 'my @a;  sub i:lvalue {@a||@b} @a=1; (i())=3'
Name "main::b" used only once: possible typo at -e line 1.
Useless assignment to a temporary at -e line 1.

Bleadperl:

$ ./perl -Ilib -lwe 'my @a; sub i:lvalue {@a||@b} @a=1; (i())=3'
Name "main::b" used only once: possible typo at -e line 1.
Can't return array to lvalue scalar context at -e line 1.

I accidentally changed it in commit 2ec7f6f242 by propagating the
lvalue context.  This commit changes it back by only flagging the
rv2av op as being in an lvalue sub if it is not already flagged as
being in scalar context.

The old behaviour was inconsistent, and this commit does restore it
(see the tests), but resolving that discrepancy is for a future commit
(if I ever get to it).

In any case, ‘Can't return array to lvalue scalar context’ is wrong.

10 years agoFix bare blocks in lvalue subs
Father Chrysostomos [Thu, 24 Oct 2013 12:41:17 +0000 (05:41 -0700)]
Fix bare blocks in lvalue subs

If a bare block is the last thing in an lvalue sub, OP_LEAVELOOP needs
to propagate lvalue context and handle returned arrays properly, just
as OP_LEAVE has done since yesterday.

This is a follow-up to 2ec7f6f24289.  This came up in ticket #119797.

10 years agoMake the details array in universal.c static
Father Chrysostomos [Thu, 24 Oct 2013 12:32:17 +0000 (05:32 -0700)]
Make the details array in universal.c static

Otherwise we can have linking problems when a global ‘details’ symbol
is defined elsewhere.  (That happened to me with an XS module.)

10 years agoIncrease $B::Concise::VERSION to 0.991
Father Chrysostomos [Thu, 24 Oct 2013 03:23:21 +0000 (20:23 -0700)]
Increase $B::Concise::VERSION to 0.991

I don’t know, is it time for version 1 yet?

10 years ago[perl #119797] Fix if/else in lvalue sub
Father Chrysostomos [Thu, 24 Oct 2013 03:21:04 +0000 (20:21 -0700)]
[perl #119797] Fix if/else in lvalue sub

When if/else/unless is the last thing in an lvalue sub, the lvalue
context is not always propagated properly and scope exit tries to
copy things, including arrays, resulting in ‘Bizarre copy of ARRAY’.

This commit fixes the bizarre copy by flagging any leave op that is
part of an lvalue sub’s return sequence, using the OPpLEAVE flag added
for this purpose in the previous commit.  Then pp_leave uses that flag
to avoid copying return values, but protects them via the mortals
stack just like pp_leavesublv (actually pp_ctl.c:S_return_lvalues).

For ‘if’ and ‘unless’ without ‘else’, the lvalue context was not being
propagated, resulting in arrays’ getting flattened despite the lvalue
context.  op_lvalue_flags in op.c needed to handle AND and OR ops,
which ‘if’ and ‘unless’ compile to, to make this work.

10 years agoAdd OPpLVALUE flag
Father Chrysostomos [Thu, 24 Oct 2013 02:33:50 +0000 (19:33 -0700)]
Add OPpLVALUE flag

This flag will be used by the next commit.

10 years agoIncrease $bignum::VERSION to 0.37
Father Chrysostomos [Thu, 24 Oct 2013 00:59:54 +0000 (17:59 -0700)]
Increase $bignum::VERSION to 0.37

10 years agoAdd Marc Simpson to AUTHORS
Father Chrysostomos [Thu, 24 Oct 2013 00:56:05 +0000 (17:56 -0700)]
Add Marc Simpson to AUTHORS

10 years agoMinor bignum POD fix (capitalisation).
Marc Simpson [Wed, 23 Oct 2013 14:19:23 +0000 (15:19 +0100)]
Minor bignum POD fix (capitalisation).

10 years agobump Tie::StdHandle version
David Mitchell [Wed, 23 Oct 2013 18:21:35 +0000 (19:21 +0100)]
bump Tie::StdHandle version

after recent fixes

10 years agoTie::StdHandle::WRITE: handle offset
David Mitchell [Wed, 23 Oct 2013 18:14:36 +0000 (19:14 +0100)]
Tie::StdHandle::WRITE: handle offset

the WRITE method was ignoring its offset argument.

10 years agoTie::StdHandle appends extra copies of $\ to output
Anno Siegel [Wed, 23 Oct 2013 17:06:45 +0000 (18:06 +0100)]
Tie::StdHandle appends extra copies of $\ to output

[perl #120202]

The following code demonstrates the problem:

    use Tie::Handle;

    my $out = do { no warnings 'once'; \ local *HANDLE };
    tie *$out, 'Tie::StdHandle', '>&', \ *STDOUT or die;

    $\ = "haha\n";
    print $out "hihi\n";

which prints

    hihi
    haha
    haha

The string in $\ has been added twice, once explicitly by
Tie::Handle::PRINT and another time implicitly by the use of
(CORE::) print in Tie::StdHandle::WRITE.

The bug also affects the use of say() with tied handles where a spurious
newline is added by the same effect.

[ test added by davem ]

10 years agostdhandle.t: unlink the right file.
David Mitchell [Wed, 23 Oct 2013 15:40:55 +0000 (16:40 +0100)]
stdhandle.t: unlink the right file.

It writes to "afile", but initially deleted "afile.new" if it already
existed.

10 years agostdhandle.t: convert to use Test::More
David Mitchell [Wed, 23 Oct 2013 15:37:39 +0000 (16:37 +0100)]
stdhandle.t: convert to use Test::More

print "ok 13\n" is *so* 1990's.

10 years agoMake B/Deparse handle unicode regexes
David Mitchell [Wed, 23 Oct 2013 14:12:18 +0000 (15:12 +0100)]
Make B/Deparse handle unicode regexes

[perl #120182]
the precomp B::OP method was returning a non-UTF8 string even if the
regex was utf8

10 years agocorrect POD for SvIsCOW, it returns a U32
Daniel Dragan [Wed, 23 Oct 2013 10:36:45 +0000 (11:36 +0100)]
correct POD for SvIsCOW, it returns a U32

10 years agorefactor sv_add_backref
Daniel Dragan [Wed, 23 Oct 2013 10:28:15 +0000 (11:28 +0100)]
refactor sv_add_backref

-don't assign NULL twice to var mg, seen in machine code
-use sv_magicext to get MAGIC * instead of a 2nd call to mg_find, less
 passes through the linked list is faster
-move the mg_flags MGf_REFCOUNTED statement to before av, to reduce scope
 of liveness for var mg, it is never used again in the function
-av can not be null since it was just created, use
 SvREFCNT_inc_simple_void_NN
-on a tsv, that is being upgraded to be an AV backref holder, call
 av_extend only once with the correct slice count based on whether tsv was
 a SV backref holder or not previously
-since on a newly AV backref tsv, the number of backrefs will only be 1 or
 2, and if we made an AV type backref holder, doing the SV type
 optimization is now impossible, so don't check av for NULL when we know
 it wont be if we just made the AV, and don't do the bounds check and 2nd
 av_extend either since the AV is new and under our control
-if tsv is already an AV type backref, the AV can have 1 to infinity
 elements so do the bounds check and av_extend as before

It is intentional that on the new AV type holder branch, that after
"av_extend(av, *svp ? 2 : 1);" there are no further function calls in the
execution path until the return.

10 years agoAdd support for building with Visual C++ 2013
Steve Hay [Tue, 22 Oct 2013 17:05:17 +0000 (18:05 +0100)]
Add support for building with Visual C++ 2013

Two tests (t/io/fs.t and cpan/HTTP-Tiny/t/110_mirror.t) fail on my system,
currently in Daylight Saving Time, both due to times written/read by
utime()/stat() being off by one hour...

Not sure what the issue is yet, but I've reproduced it in this C program:

#include <stdio.h>
#include <sys/stat.h>
#include <sys/utime.h>
void main(void) {
  struct _utimbuf ut;
  struct _stat st;
  time_t t;
  t = 760060800;
  printf("Setting: %ld\n", t);
  ut.actime = t;
  ut.modtime = t;
  if (_utime("test.c", &ut) == -1) {
    perror("_utime failed\n");
    return;
  }
  if (_stat("test.c", &st) != 0) {
    perror("_stat failed\n");
    return;
  }
  printf("  atime: %ld\n", st.st_atime);
  printf("  mtime: %ld\n", st.st_mtime);
}

which outputs

Setting: 760060800
  atime: 760057200
  mtime: 760057200

with VC++ 2013, instead of

Setting: 760060800
  atime: 760060800
  mtime: 760060800

like Visual C++ 6.0 through 2012 all do.

10 years agospurious "Use of "-x" without parentheses" mesg
David Mitchell [Tue, 22 Oct 2013 15:48:16 +0000 (16:48 +0100)]
spurious "Use of "-x" without parentheses" mesg

RT #120288.

Something like '-X' at the start of a line (where X is one char, but not a
filetest operator) was giving a spurious

    Warning: Use of "-a" without parentheses is ambiguous

error. This was because the toker was provisionally marking the -a as the
last encountered unary operator (PL_last_uni), then not unmarking it when
it found that that it wasn't in fact a filetest operator.

10 years agoUnbreak -bareword under strict+integer
Father Chrysostomos [Tue, 22 Oct 2013 12:36:38 +0000 (05:36 -0700)]
Unbreak -bareword under strict+integer

Commit 077da62ff9 was not supposed to change behaviour, but only
remove logic rendered unnecessary two commits earlier in 1c2b3fd6f10.

But the special stricture exception for negation was in the same func-
tion (S_op_integerize) which applied it to OP_NEGATE, but now needed
to apply it to OP_I_NEGATE, too.

10 years agoperldelta for 27329181e3 and 2c8bbb43f3
Steve Hay [Tue, 22 Oct 2013 07:26:19 +0000 (08:26 +0100)]
perldelta for 27329181e3 and 2c8bbb43f3

10 years agoWinCE Perl EVC4 support
Daniel Dragan [Tue, 22 Oct 2013 01:59:32 +0000 (21:59 -0400)]
WinCE Perl EVC4 support

- CCTYPE has always been empty string in Makefile.ce, makedef.pl does not
  complain about this, but it is a bug, so fix it

- create a profile for a EVC4 arm build

- put -GS- and -GL flags into compiler version specific defs so VC6 era
  EVC4 will work

- don't delete ..\lib\Config.pm, it was made by win32/Makefile, for a
  Desktop Perl, deleting this breaks miniperl when it loads its pure perl
  modules for cross MakeMaker module building, and requires rebuilding the
  Desktop Perl so miniperl works again. CE Perl has its Config.pm in the
  xlib\$(MACHINE) dir

10 years agoPorting/Maintainers.pl - Remove redundant EXCLUDED files
Steve Hay [Mon, 21 Oct 2013 17:31:34 +0000 (18:31 +0100)]
Porting/Maintainers.pl - Remove redundant EXCLUDED files

Also add extra verbose output to Porting/core-cpan-diff to identify such
cases.

10 years ago.gitignore Win32's miniperl object files
Daniel Dragan [Sun, 20 Oct 2013 01:26:29 +0000 (21:26 -0400)]
.gitignore Win32's miniperl object files

Comments from the committer:
win32/mini/*.obj (and hence win32/mini/ since it contains nothing other than
*.obj) should be .gitignored by the top-level .gitignore file anyway, but
git clean -dfX doesn't remove them without this patch. (git clean -dfx does,
but some developers want to keep untracked files other than build products
explicitly listed by .gitignore files.)

10 years agoWinCE Makefile and make_ext.pl general and XS fixes
Daniel Dragan [Wed, 9 Oct 2013 07:33:47 +0000 (03:33 -0400)]
WinCE Makefile and make_ext.pl general and XS fixes

On a WinCE build. On the 2nd nmake run, using Makefile.ce, eventually calls
the Extensions target which calls make_ext.pl. What happens is nmake for CE
for each module is called on the Desktop per module makefile from the
earlier Desktop build. Since the Desktop Perl already was built
sucessfully, all rules/deps are met in the Desktop per module makefile, and
nothing happens during the module building phase for a CE build. Previously
I used external file management tools to delete the per module Makefiles
before running Makefile.ce.

*make_ext.pl
- implement deleting and rebuilding the per module makefile on a Cross
  build
- use constants for constant folding, there are opportunities for other
  variables to be converted to constants in the future
- fix a bug from commit baff067e71 where unlink() on a file with an open
  handle ($mfh) didn't delete the file from disk and a new per module
  makefile would be not be built by make_ext.pl later since the per module
  makefile was still on disk. This was observed on Win32. Also harden the
  unlink code with a new _unlink sub that is fatal if the file is still on
  disk after unlink supposedly deleted it.
- var $header and the quotemeta is because of an issue in Perl #119793

*Makefile.ce
- bring the debugging symbol generation flags and optimization flags
  to be closer to a Dekstop VC Perl build
- ICWD is obsolete as of commit f6b3c354c9 , remove it
- MINIMOD is obsolete as of commit 7b4d95f74b , remove it
- make a poisoned config.h so if there is a XS building mixup between
  a desktop and CE perl, the poisoned config.h for CE will stop the build
  gracefully
- $(MINIPERL) has never been defined in Makefile.ce from day 1 (10 years)
  replace with $(HPERL) everywhere, this was causing things to not run
  silently since $(MINIPERL) was empty string. Use HPERL instead of
  MINIPERL to allow flexibility to use the full perl binary if necessery
  one day
- better cleaning on root makefile clean target

*win32/win32.h
*win32/win32iop.h
- silence alot of redefinition warnings which gave pages of warnings on
  each WinCE compliand

*mg.c
- win32_get_errno is only on WIN32 build not WINCE

a "nmake -f Makefile.ce all" will now build the CE interp and all modules
in 1 shot with no user intervention

10 years agomake sv_2bool_flags() non-recursive on overload
Daniel Dragan [Mon, 21 Oct 2013 14:43:06 +0000 (15:43 +0100)]
make sv_2bool_flags() non-recursive on overload

When Perl_sv_2bool_flags() has an overloaded arg, it calls SvTRUE()
on the SV returned from the overload method. This indirectly calls
sv_2bool_flags() again.

Change it so that sv_2bool_flags() just iterates the new overload value
each time.

2 callsites were converted to gotos. A SvTRUE_common was expanded so goto
can be used.  This function's machine code size on VC2003 32 bits dropped
by 0x24 bytes after this patch.

10 years agoBenchmark.t: avoid ultra-lightweight code
David Mitchell [Mon, 21 Oct 2013 12:45:36 +0000 (13:45 +0100)]
Benchmark.t: avoid ultra-lightweight code

Some tests benchmarked the code '$i++', which is so lightweight that it
could trigger the die "Timing is consistently zero in estimation loop"
in Benchmark.pm.

So make the code slightly more heavyweight.