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.
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.
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.
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
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
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.
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.
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.
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".
[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>
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
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
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
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.
[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.
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
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.
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.
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.
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