This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
12 years agoUnicode::UCD: Remove obsolete pod lines
Karl Williamson [Sun, 14 Aug 2011 19:56:48 +0000 (13:56 -0600)]
Unicode::UCD: Remove obsolete pod lines

Starting in 5.14, this file descriptor is no longer used.

12 years agoperluniprops: mention 5.14 not 5.13
Karl Williamson [Sun, 14 Aug 2011 15:45:03 +0000 (09:45 -0600)]
perluniprops: mention 5.14 not 5.13

12 years agoperluniprops: Add quotes around a couple prop names
Karl Williamson [Sun, 14 Aug 2011 15:43:44 +0000 (09:43 -0600)]
perluniprops: Add quotes around a couple prop names

12 years agomktables: Clarify comment added to output tables
Karl Williamson [Sun, 14 Aug 2011 15:36:23 +0000 (09:36 -0600)]
mktables: Clarify comment added to output tables

The table files are used not just by perl.exe but various modules
that are part of the Perl core.

12 years agomktables: Remove possibility of 2nd ccc table
Karl Williamson [Sun, 14 Aug 2011 03:20:11 +0000 (21:20 -0600)]
mktables: Remove possibility of 2nd ccc table

The Canonical Combining Class property map table file has a non-standard
name and directory location because that's where Unicode::Normalize
expects it.  Previous to this patch, it was also possible to create a
duplicate table in the standard location if an installation desired.
But future patches are adding an API to get that information without
having to read from files, so this won't be needed after that, and
prepares the way for that API.

12 years agomktables: remove internal restriction
Karl Williamson [Fri, 15 Jul 2011 02:47:13 +0000 (20:47 -0600)]
mktables: remove internal restriction

The code punted before under the condition changed.  But it is
relatively easy to handle it; which is needed by future commits.

12 years agot/uni/case.pl: Allow overridden simple maps in input
Karl Williamson [Wed, 13 Jul 2011 16:46:04 +0000 (10:46 -0600)]
t/uni/case.pl: Allow overridden simple maps in input

Future commits are planned to change the base list in various
mapping tables to include the simple maps which are now suppressed
when there are full maps that override them.

The current test blindly tests all the simple maps, which would
start to fail because the core uses the full maps when available.
So, simply don't test the overridden ones.

12 years agomktables: Reorder error check
Karl Williamson [Wed, 13 Jul 2011 15:15:06 +0000 (09:15 -0600)]
mktables: Reorder error check

The error check should happen after we decide the whole thing
is a no-op.

12 years agomktables: Clarify warning message
Karl Williamson [Wed, 13 Jul 2011 15:13:57 +0000 (09:13 -0600)]
mktables: Clarify warning message

12 years agoperluniprops: nit
Karl Williamson [Mon, 11 Jul 2011 04:08:16 +0000 (22:08 -0600)]
perluniprops: nit

12 years agoFix VC6 compilation of pp_sort.c
Steve Hay [Mon, 7 Nov 2011 21:10:44 +0000 (21:10 +0000)]
Fix VC6 compilation of pp_sort.c

Fixes copy & paste errors introduced by f3dab52a51.

12 years agoUpdate IO-Compress to CPAN version 2.040
Chris 'BinGOs' Williams [Sun, 6 Nov 2011 22:56:39 +0000 (22:56 +0000)]
Update IO-Compress to CPAN version 2.040

  [DELTA]

  2.040 28 October 2011

      * t/105oneshot-zip-only.t
        - CanonicalName test failure on Windows
          [RT# 68926]

      * IO::Compress::Zip
        - ExtAttr now populates MSDOS attributes

  2.039 28 October 2011

      * IO::Compress::Zip
        - Added CanonicalName option.
          Note this option is set to true by default.
        - Added FilterName option

      * IO::Unompress::Base
        - Fixed issue where setting $\ would corrupt the uncompressed data.
          Thanks to Steffen Goeldner for reporting the issue.

      * t/050interop-*.t
        - Handle case when external command contains a whitespace
          RT #71335

12 years agoUpdate Compress-Raw-Bzip2 to CPAN version 2.040
Chris 'BinGOs' Williams [Sun, 6 Nov 2011 22:32:24 +0000 (22:32 +0000)]
Update Compress-Raw-Bzip2 to CPAN version 2.040

  [DELTA]

  2.040 28 October 2011

      * No Changes

  2.039 28 October 2011

      * croak if attempt to freeze/thaw compression object
        [RT #69985]

12 years agoUpdate Compress-Raw-Zlib to CPAN version 2.040
Chris 'BinGOs' Williams [Sun, 6 Nov 2011 22:24:49 +0000 (22:24 +0000)]
Update Compress-Raw-Zlib to CPAN version 2.040

  [DELTA]

  2.040 28 October 2011

      * No Changes

  2.039 28 October 2011

      * croak if attempt to freeze/thaw compression object
        [RT #69985]

12 years agoUpdate Unicode-Collate to CPAN version 0.84
Chris 'BinGOs' Williams [Sun, 6 Nov 2011 21:59:59 +0000 (21:59 +0000)]
Update Unicode-Collate to CPAN version 0.84

  [DELTA]

  0.84  Sun Nov  6 14:44:51 2011
    - U::C::Locale supports script codes.
    - U::C::Locale newly supports locales: fa, sr_Latn, ur.
    - added loc_fa.t, loc_srla.t, loc_ur.t in t.

  0.83  Sun Oct 30 20:22:04 2011
    - mklocale: auto-generate equivalents for suppressed contractions.
      * be.txt, bg.txt, kk.txt, mk.txt, ru.txt, sr.txt, uk.txt in data
        are simplified.
      * but no Locale/*.pl will be modified.

  0.82  Sun Oct 30 10:03:48 2011
    - U::C::Locale newly supports locales: si, si__dictionary,
      sv__reformed, ta, te, th, wae.
    - added loc_si.t, loc_sidt.t, loc_svrf.t, loc_ta.t, loc_te.t,
      loc_th.t, loc_wae.t in t.
    - updated some locales to CLDR 2.0 : sk, sr, sv, uk.
    - updated CJK/Pinyin.pm according to CLDR 2.0.

12 years agoDear dual-life.t: I regret your existence
Father Chrysostomos [Sun, 6 Nov 2011 22:31:09 +0000 (14:31 -0800)]
Dear dual-life.t: I regret your existence

12 years agotoke.c:lex_start: Move len into the only block that uses it
Father Chrysostomos [Sun, 6 Nov 2011 22:25:42 +0000 (14:25 -0800)]
toke.c:lex_start: Move len into the only block that uses it

12 years agoUpdate docs about lex_start’s flags param
Father Chrysostomos [Sun, 6 Nov 2011 22:08:00 +0000 (14:08 -0800)]
Update docs about lex_start’s flags param

12 years agoDon’t leak the source for evalbytes($utf8)
Father Chrysostomos [Sun, 6 Nov 2011 22:05:49 +0000 (14:05 -0800)]
Don’t leak the source for evalbytes($utf8)

12 years agoAvoid redundant copies in string evals
Father Chrysostomos [Sun, 6 Nov 2011 22:04:51 +0000 (14:04 -0800)]
Avoid redundant copies in string evals

Perl_lex_start copies the string passed to it unconditionally.
Sometimes pp_entereval makes a copy before passing the string
to lex_start.  So in those cases we can pass a flag to avoid a
redundant copy.

12 years agoeval"" should reset %^H in more cases
Father Chrysostomos [Sun, 6 Nov 2011 21:37:55 +0000 (13:37 -0800)]
eval"" should reset %^H in more cases

This is scary:

    #use sort 'stable';
    require re; re->import('/x');
    eval '
      print "a b" =~ /a b/ ? "ok\n" : "nokay\n";
      use re "/m";
      print "a b" =~ /a b/ ? "ok\n" : "nokay\n";
   ';

It prints:

    ok
    nokay

The re->import statement is supposed to apply to the caller that
is currently being compiled, but it makes ‘use re "/m"’ enable
/x as well.

Uncomment the ‘use sort’ line, and you get:

    ok
    ok

which is even scarier.

eval"" is supposed to compile its argument with the hints under which
the eval itself was compiled.

Whenever %^H is modified, a flag (HINT_LOCALIZE_HH; LHH hereinafter)
is set in $^H.

When eval is called, it checks the LHH flag in the hints from the time
it was compiled, to determine whether to reset %^H.  If LHH is set,
it creates a new %^H based on the hints under which it was compiled.
Otherwise, it just leaves %^H alone.

The problem is that %^H and LHH may be set some time later
(re->import), so when the eval runs there is junk in %^H that
does not apply to the contents of the eval.

There are two layers at which the hints hash is stored.  There is the
Perl-level hash, %^H, and then there is a faster cop-hints-hash struc-
ture underneath.  It’s the latter that is actually used during compi-
lation.  %^H is just a Perl front-end to it.

When eval does not reset %^H and %^H has junk in it, the two get
out of sync, because eval always sets the cop-hints-hash correctly.
Hence the first print in the first example above compiles without
‘use re "/x"’.  The ‘use re’ statement after it modifies the %^H-with-
junk-in-it, which then gets synchronised with the cop-hints-hash,
turning on /x for the next print statement.

Adding ‘use sort’ to the top of the program makes the problem go
away, because, since sort.pm uses %^H, LHH is set when eval() itself
is compiled.

This commit fixes this by having pp_entereval check not only the LHH
flag from the hints under which it was compiled, but also the hints of
the currently compiling code ($^H / PL_hints).

12 years agoTypos in gv.t
Father Chrysostomos [Sun, 6 Nov 2011 20:57:12 +0000 (12:57 -0800)]
Typos in gv.t

12 years agoenable LFS on GNU/Hurd
Pino Toscano [Tue, 1 Nov 2011 18:37:19 +0000 (18:37 +0000)]
enable LFS on GNU/Hurd

at the moment, perl is compiled on GNU/Hurd without large file support.
This, other than the lacking of support for files > 2 GB, causes the
failure in the t/op/stat.t test.
The failure in stat.t happens because of the following: when filtering
devices in /dev/* using grep {} with -b/-c, stat fails for large
devices such as /dev/hdX blocks, or /dev/zero chars (this latter case
should be an Hurd-specific issue, but shouldn't matter for this case),
hence the counts done with grep {} and the ones done filtering the
output of `ls' don't match.

The attached patch enables the LFS using the same way used on linux.sh;
about t/op/lfs.t, it gets skipped at the "kernel/fs not configured to
use large files?" check, although it correctly detects sparse files and
(at least by looking at the disk usage) allocates the 5GB (or so) file
created with system() in that test.

12 years agoCorrect bug number in gv.t
Father Chrysostomos [Sun, 6 Nov 2011 18:42:21 +0000 (10:42 -0800)]
Correct bug number in gv.t

12 years agoMake multiple #line’s update dblines in evals
Father Chrysostomos [Sun, 6 Nov 2011 10:11:02 +0000 (02:11 -0800)]
Make multiple #line’s update dblines in evals

The array-copying stuff that happens when #line 3 "filename" is
encountered in a string eval is not sufficient.  If there are multiple
such statements, only the first one copies the debugger’s lines arrays
(@{"_<filename"}) into the new array.

Checking that CopFILESV(PL_curcop) begins with ‘(eval ’ is a bit
silly, since the parser already knows whether it’s processing a file
without having to check file names.  (And what if you have a real file
beginning with ‘(eval ’?)

See commit 8818d40 and others that it references, for the history of
this piece of code.

12 years agoStop toggling the FAKE flag for stringified GVs
Father Chrysostomos [Sun, 6 Nov 2011 09:40:57 +0000 (01:40 -0800)]
Stop toggling the FAKE flag for stringified GVs

Back in the old days, when GVs had magic attached to them, get-magic
used to stringify the glob and assign the string to the PV field.  It
was triggered in mg.c like this:

    gv_efullname3(sv,((GV*)sv), "*");

Because sv was both the glob being read *and* the string being
assigned to, the stringification would call set-magic on the glob and
flatten the glob into a string.  Or something like that.

That is not necessary any more.

12 years ago[perl #96326] *{$io} should not be semi-defined
Father Chrysostomos [Sun, 6 Nov 2011 09:35:38 +0000 (01:35 -0800)]
[perl #96326] *{$io} should not be semi-defined

gv_efullname4 produces undef if the GV points to no stash, instead of
using __ANON__, as it does when the stash has no name.

Instead of going through hoops to try and work around it elsewhere, fix
gv_efullname4.

This means that

   $x = *$io;
   $x .= "whate’er";

no longer produces an uninitialized warning.  (The warning was rather
strange, as defined() returned true.)

This commit also gives the glob the name $__ANONIO__ (yes, with a dol-
lar sign).  It may seem a little strange, but there is precedent in
other autovivified globs, such as those open() produces when it cannot
determine the variable name (e.g, open $t->{fh}).

12 years agoop.c:ck_eval: consting
Father Chrysostomos [Sun, 6 Nov 2011 08:25:00 +0000 (01:25 -0700)]
op.c:ck_eval: consting

12 years agoMerge unicode_eval and evalbytes
Father Chrysostomos [Sun, 6 Nov 2011 08:15:07 +0000 (01:15 -0700)]
Merge unicode_eval and evalbytes

This branch adds the unicode_eval and evalbytes feature features.

unicode_eval makes string eval() treats its argument consistently
as characters.

evalbytes enables the evalbytes() function which treats its argument
consistently as bytes.

So the Unicode Bug is hereby fixed for eval.

Source filters actually work logically under both these features.
unicode_eval causes source filters invoked in eval() to croak.
evalbytes actually allows the source code passed to it to be filtered,
instead of leaking source filters out to some other scope like the
historical eval().

'print "Just another Perl hacker,\n"'->CORE'evalbytes

12 years agoDocument unicode_eval and evalbytes
Father Chrysostomos [Fri, 4 Nov 2011 23:37:41 +0000 (16:37 -0700)]
Document unicode_eval and evalbytes

12 years agoMerge some parser fields
Father Chrysostomos [Fri, 4 Nov 2011 21:30:09 +0000 (14:30 -0700)]
Merge some parser fields

By combining two booleans with the flags field, we save some space.
By making it a 16-bit instead of 32-bit field (only two flag bits
are currently used), we also avoid alignment holes (I hope; I’m
not very good at this).

12 years agoMake source filters work in evalbytes
Father Chrysostomos [Fri, 4 Nov 2011 21:11:26 +0000 (14:11 -0700)]
Make source filters work in evalbytes

When a filter is added, the current buffer is hung on the end of
the filters array, and a new substring of it becomes the current
buffer.

12 years agoAdd new OPpEVAL flags to B::Concise
Father Chrysostomos [Sun, 30 Oct 2011 22:46:46 +0000 (15:46 -0700)]
Add new OPpEVAL flags to B::Concise

12 years agoIncrease $B::Concise::VERSION to 0.87
Father Chrysostomos [Sun, 30 Oct 2011 06:16:24 +0000 (23:16 -0700)]
Increase $B::Concise::VERSION to 0.87

12 years agoAdd evalbytes function
Father Chrysostomos [Sun, 30 Oct 2011 21:33:06 +0000 (14:33 -0700)]
Add evalbytes function

This function evaluates its argument as a byte string, regardless of
the internal encoding.  It croaks if the string contains characters
outside the byte range.  Hence evalbytes(" use utf8; '\xc4\x80' ")
will return "\x{100}", even if the original string had the UTF8 flag
on, and evalbytes(" '\xc4\x80' ") will return "\xc4\x80".

This has the side effect of fixing the deparsing of CORE::break under
‘use feature’ when there is an override.

12 years agoparser.h: Rearrange constants
Father Chrysostomos [Sun, 30 Oct 2011 03:46:37 +0000 (20:46 -0700)]
parser.h: Rearrange constants

Put LEX_IGNORE_UTF8_HINTS near the only other constant passed
to lex_start

12 years agoForbid source filters in Unicode evals
Father Chrysostomos [Sun, 30 Oct 2011 02:56:18 +0000 (19:56 -0700)]
Forbid source filters in Unicode evals

Source filters have always been byte-level filters.  Therefore they
don’t make sense on Unicode strings, unless we are planning to add
new APIs to support it.  Until then, croak.

12 years agoIncrease $feature::VERSION to 1.23
Father Chrysostomos [Sun, 30 Oct 2011 01:12:28 +0000 (18:12 -0700)]
Increase $feature::VERSION to 1.23

12 years agoeval STRING UTF8 cleanup.
Brian Fraser [Fri, 5 Aug 2011 10:30:11 +0000 (11:30 +0100)]
eval STRING UTF8 cleanup.

(modified by the committer only to apply when the unicode_eval
feature is enabled)

12 years agoAdd unicode_eval feature
Father Chrysostomos [Sat, 29 Oct 2011 23:48:45 +0000 (16:48 -0700)]
Add unicode_eval feature

It doesn’t do anything yet.

12 years agoAllow dual-life.t to be run outside t/
Father Chrysostomos [Sun, 6 Nov 2011 06:28:06 +0000 (23:28 -0700)]
Allow dual-life.t to be run outside t/

12 years agoTweak dual-life.t’s exceptions again
Father Chrysostomos [Sun, 6 Nov 2011 06:27:29 +0000 (23:27 -0700)]
Tweak dual-life.t’s exceptions again

Boy, this script requires a *lot* of maintenance.

12 years agoFix hash.t’s miniperl skip
Father Chrysostomos [Sun, 6 Nov 2011 01:28:19 +0000 (18:28 -0700)]
Fix hash.t’s miniperl skip

12 years agoeach() should not leave RITER set on empty hash
Father Chrysostomos [Sun, 6 Nov 2011 01:25:42 +0000 (18:25 -0700)]
each() should not leave RITER set on empty hash

Commit 900ac0519e (5.11.0) sped up keys() on an empty hash by modify-
ing the iteration code not to loop through the buckets looking for an
entry if the number of keys is 0.  Interestingly, it had no visible
affect on keys(), but it *did* have one on each().  Resetting the ite-
rator’s current bucket number (RITER) used to be done inside that loop
in hv_iternext.  keys() always begins by resetting the iterator, so it
was unaffected.  But each %empty will leave the iterator as-is.  It
will be set on an empty hash if the last element was deleted while an
iterator was active.  This has buggy side-effects.

    $h{1} = 2;
    each %h;  # returns (1, 2)
    delete $h{1};
    each %h;  # returns false; should reset iterator
    $h{1}=2;
    print each %h, "\n";  # prints nothing

Commit 3b37eb248 (5.15.0), which changed the way S_hfreeentries works.
(S_hfreentries is called by all operators that empty hashes, such as
%h=() and undef %h.)  Now S_hfreentries does nothing if the hash is
empty.  That change on its own should have been harmless, but the
result was that even %h=() won’t reset RITER after each() has put
things in an inconsistent state.  This caused test failures in
Text::Tabulate.

So the solution, of course, is to complete the change made by
900ac0519e and reset the iterator properly in hv_iternext if the
hash is empty.

12 years agohv.c: comment typo
Father Chrysostomos [Sun, 6 Nov 2011 00:13:14 +0000 (17:13 -0700)]
hv.c: comment typo

12 years agoGlob.xs: remove unused vars
Father Chrysostomos [Sat, 5 Nov 2011 23:29:26 +0000 (16:29 -0700)]
Glob.xs: remove unused vars

These are left over from the refactoring that took place
with commit 1bb8785a.

12 years agotie.t: typos
Father Chrysostomos [Sat, 5 Nov 2011 23:21:54 +0000 (16:21 -0700)]
tie.t: typos

12 years agoPerl_hv_kill_backrefs is also used in scope.c
Father Chrysostomos [Sat, 5 Nov 2011 21:44:04 +0000 (14:44 -0700)]
Perl_hv_kill_backrefs is also used in scope.c

Sorry for the smoke.

12 years agoHide pad vars from magic methods on scope exit
Father Chrysostomos [Sat, 5 Nov 2011 21:38:21 +0000 (14:38 -0700)]
Hide pad vars from magic methods on scope exit

If, during scope exit, a pad var is being cleared for reuse, it needs
to be hidden from magic methods that might reference it through weak
references.  Otherwise they can end up modifying the var that will be
seen next time that scope is entered, by blessing it, etc.

12 years agoWeak refs to pad hvs should go stale
Father Chrysostomos [Sat, 5 Nov 2011 20:26:41 +0000 (13:26 -0700)]
Weak refs to pad hvs should go stale

When a lexical variable goes out of scope, as in

    {
        my %lexical_variable;
        ...
    }
    # no longer in scope here

it is supposed to disappear as far as Perl code can tell.  That the
same SV is reused the next time that scope is entered is an implement-
ation detail.

The move of hashes’ back-references from magic into the HvAUX struc-
ture in 5.10 caused this implementation detail to leak through.

Normally, weak references to pad variables going out of scope are
killed off:

    {
        my $scalar;
        weaken ($global_scalar = \$scalar);
    }
    # here $global_scalar is undef

When hashes’ back-references were moved, leave_scope was not updated
to account.  (For non-hash variables, it’s the mg_free call that takes
care of it.)  So in this case:

    {
        my %hash;
        weaken ($global_scalar = \%hash);
    }

$global_scalar would still reference a hash, but one marked PADSTALE.
Modifications to that hash through the reference would be visible the
next time the scope was entered.

12 years agosort MANIFEST
Father Chrysostomos [Fri, 4 Nov 2011 20:16:38 +0000 (13:16 -0700)]
sort MANIFEST

12 years agoRemove vos/syslog.h from MANIFEST
Father Chrysostomos [Fri, 4 Nov 2011 20:15:24 +0000 (13:15 -0700)]
Remove vos/syslog.h from MANIFEST

12 years agoBuild perl using the dynamic linking capabilities of OpenVOS Release 17.1. Remove...
Paul Green [Fri, 4 Nov 2011 19:19:28 +0000 (15:19 -0400)]
Build perl using the dynamic linking capabilities of OpenVOS Release 17.1. Remove private copies of some POSIX functions that are now implemented by OpenVOS.

12 years agoAdd GNU/Hurd hints for NDBM_File
Pino Toscano [Mon, 31 Oct 2011 19:21:27 +0000 (19:21 +0000)]
Add GNU/Hurd hints for NDBM_File

currently, there are few tests failing because of a broken NDBM module;
using the same hints as used on Linux (given that apparently the cause
is the same) makes the following tests pass:
  t/op/dbm.t
  cpan/autodie/t/dbmopen.t
  cpan/Memoize/t/errors.t
  cpan/Memoize/t/tie_ndbm.t
  ext/NDBM_File/t/ndbm.t
  lib/AnyDBM_File.t

Dominic Hargreaves adds: Note that the original git commit log [what
you see above] lists some tests which aren't affected in blead.

12 years agoFill out sv_upgrade docs
Father Chrysostomos [Fri, 4 Nov 2011 15:35:40 +0000 (08:35 -0700)]
Fill out sv_upgrade docs

See commit 5a0c33f0f.

12 years agoRestore VMS glob skip removed in 1bb8785a.
Craig A. Berry [Fri, 4 Nov 2011 16:10:02 +0000 (11:10 -0500)]
Restore VMS glob skip removed in 1bb8785a.

The test appears to be checking the handling of double quotes in
File::Glob::csh_glob(), but on VMS, we're not using that, we're
using Perl_vms_start_glob().  Perhaps the latter should do some
quote removal as well.

12 years agoFix hang in ext/POSIX/t/sysconf.t on GNU/Hurd
Pino Toscano [Mon, 31 Oct 2011 21:37:04 +0000 (21:37 +0000)]
Fix hang in ext/POSIX/t/sysconf.t on GNU/Hurd

while compiling perl 5.14.2 on GNU/Hurd, I ran into what it seems a
undefined POSIX behaviour in ext/POSIX/t/sysconf.t.

      my $fd = POSIX::open($fifo, O_RDWR)
      or skip("could not open $fifo ($!)", 3 * @path_consts_fifo);

according to the POSIX open()[1] about O_RDWR,
  The result is undefined if this flag is applied to a FIFO.
.... which is actually our case.
Apparently Linux and *FreeBSD (and maybe also OSes) accept this
behaviour, but on GNU/Hurd this causes the open() call to block
undefinitely. Given there's nothing done with the FIFO if not querying
{,f}pathconf() values, the proposed solution I attached is to change
the opening mode to "O_RDONLY | O_NONBLOCK".

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

12 years agoUse SvUPGRADE, not sv_upgrade, in sv_sethek
Father Chrysostomos [Fri, 4 Nov 2011 07:17:52 +0000 (00:17 -0700)]
Use SvUPGRADE, not sv_upgrade, in sv_sethek

This was causing some interesting HTML::Element failures, which were
only triggered by HTML::DOM’s test suite.

ref’s TARG can become tainted if another op in the same statement
turns on tainting for the rest of the statement, so it becomes a PVMG.
The next call to the same ref will try to sv_upgrade it to a PV (which
is lower).  Only the macro version, SvUPGRADE, checks whether the
upgrade is needed.

ref only calls sv_sethek when it has a blessed object for its argu-
ment, hence the strange-looking test.

12 years agoDeparse ()[()]
Father Chrysostomos [Fri, 4 Nov 2011 05:36:23 +0000 (22:36 -0700)]
Deparse ()[()]

A pushmark doesn’t have to have a sibling:

$ ./perl -Ilib -MO=Concise -e '()[()]'
6  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 1 -e:1) v:{ ->3
5     <2> lslice vK/2 ->6
-        <1> ex-list lK ->4
3           <0> pushmark s ->4
-           <0> stub lP ->-
-        <1> ex-list lK ->5
4           <0> pushmark s ->5            <-- look here!
-e syntax OK

12 years agoStop @{""} = reverse @_ from crashing
Father Chrysostomos [Thu, 3 Nov 2011 21:47:06 +0000 (14:47 -0700)]
Stop @{""} = reverse @_ from crashing

Class::ClassDecorator was crashing during compilation on this line:

        @{"$name\::ISA"} = ( reverse @_ );

I presume this was due to commit 540dd770, which changed the way the
inplace-reverse optimisation is activated, because the crash happens
in S_inplace_aassign.  But deleting even one line of code here or
there makes the crash go away (hence the lack of tests).

This is my reasoning for how this commit eliminates the crash:

    @{""} = reverse @_

compiles down to

b     <2> aassign[t5] vKS/COMMON ->c
-        <1> ex-list lK ->8
3           <0> pushmark s ->4
7           <@> reverse[t4] lK/1 ->8
4              <0> pushmark s ->5
6              <1> rv2av[t3] lK/1 ->7
5                 <#> gv[*_] s ->6
-        <1> ex-list lK ->b
8           <0> pushmark s ->9
a           <1> rv2av[t1] lKRM*/1 ->b
-              <@> scope sK ->a
-                 <0> ex-nextstate v ->9
9                 <$> const[PV ""] s ->a

Notice that the second rv2av does not have an a gv op as its child,
but a scope instead.

In S_inplace_aassign, which checks to see whether the optimisation is
even possible, oleft refers to the second rv2av above (with scope as
its child; i.e., @{""}) while oright refers to the first rv2av (with
gv as its child; @_).

This check to make sure the left side is an array

    /* Check the lhs is an array */
    if (!oleft ||
(oleft->op_type != OP_RV2AV && oleft->op_type != OP_PADAV)
|| oleft->op_sibling
|| (oleft->op_private & OPpLVAL_INTRO)
    )
return;

does not check the op type of the rv2av’s child.

So this check, a little further on, to see whether the arrays are the
same on both sides (which applies only to rv2av; padav is handled
further on):

    /* check the array is the same on both sides */
    if (oleft->op_type == OP_RV2AV) {
if (oright->op_type != OP_RV2AV
    || !cUNOPx(oright)->op_first
    || cUNOPx(oright)->op_first->op_type != OP_GV
    || cGVOPx_gv(cUNOPx(oleft)->op_first) !=
       cGVOPx_gv(cUNOPx(oright)->op_first)
)
    return;

assumes that cUNOPx(oleft)->op_first is a gv op.

That is not the case when the lhs is @{""}, so
cGVOPx_gv(some_scope_op) ends up trying to read
((PADOP*)some_scope_op)->op_padix under threaded perls, passing
that ‘index’ (which is actually the scope op’s op_first field) to
PAD_SV[...], consequently reading past the end of the pad and possibly
into unallocated territory; hence the crash.

12 years agoMake Storable load even with %INC modified
Father Chrysostomos [Thu, 3 Nov 2011 00:04:33 +0000 (17:04 -0700)]
Make Storable load even with %INC modified

Modified to stop Log::Agent from loading, that is.

There’s at least one CPAN module that does it.  While that module
could be blamed, Storable used to be more robust in this area
before the AutoLoader extirpation, and there is nothing wrong with
robustness.

12 years agoErrno does not escape archname
Reini Urban [Wed, 2 Nov 2011 18:17:15 +0000 (13:17 -0500)]
Errno does not escape archname

With a @ or $ or % character in the user-choosen archname, Errno fails.
I usually use @ to denote git tags in the archlib.

E.g. Possible unintended interpolation of @khwtk in string at ../lib/Errno.pm line 12

12 years agoUpdate ExtUtils-MakeMaker to CPAN version 6.63_02
Steve Hay [Wed, 2 Nov 2011 09:30:05 +0000 (09:30 +0000)]
Update ExtUtils-MakeMaker to CPAN version 6.63_02

12 years agoMake diag.t runnable outside t/
Father Chrysostomos [Wed, 2 Nov 2011 01:49:16 +0000 (18:49 -0700)]
Make diag.t runnable outside t/

12 years agoWarn for $[ ‘version’ checks
Father Chrysostomos [Wed, 2 Nov 2011 01:25:59 +0000 (18:25 -0700)]
Warn for $[ ‘version’ checks

Following Michael Schwern’s suggestion, here is a warning for those
hapless folks who use $[ for version checks.

It applies whenever $[ is used in one of: < > <= >=

12 years agoPATCH: [perl #101710] Regression with /i, latin1 chars.
Karl Williamson [Tue, 1 Nov 2011 23:57:15 +0000 (17:57 -0600)]
PATCH: [perl #101710] Regression with /i, latin1 chars.

The root cause of this bug is that it was assuming that a string was in
utf8 when it wasn't, and so was thinking that a byte was a starter byte
that wasn't, so was skipping ahead based on that starter byte.

12 years agoIn bisect.pl, provide a default test for --validate, and summary output.
Nicholas Clark [Tue, 1 Nov 2011 21:48:41 +0000 (22:48 +0100)]
In bisect.pl, provide a default test for --validate, and summary output.

If no test case is specified for --validate, use TEST to run t/base/*.t
We can't run minitest because some tests fail on earlier versions, and
bisect-runner.pl intentionally doesn't patch any regression tests.

12 years agoAdd -l and -w options to bisect-runner.pl, for use with -e
Nicholas Clark [Tue, 1 Nov 2011 21:04:08 +0000 (22:04 +0100)]
Add -l and -w options to bisect-runner.pl, for use with -e

This allows simpler one-liners with -e and print, as one no longer needs to
add "\n" to all output. Reformat the example for --validate to use -l instead
of "\n".

12 years agoIn bisect.pl, use --start and --end to give ranges to --validate
Nicholas Clark [Tue, 1 Nov 2011 19:48:30 +0000 (20:48 +0100)]
In bisect.pl, use --start and --end to give ranges to --validate

This allows the user to specify a subset of revisions to test build.

12 years agoAdd --force-regen to bisect-runner.pl to regen_headers before building.
Nicholas Clark [Tue, 1 Nov 2011 19:31:43 +0000 (20:31 +0100)]
Add --force-regen to bisect-runner.pl to regen_headers before building.

--force-regen runs C<make regen_headers> before building F<miniperl>. This
may fix a build that otherwise would skip because the generated headers at
that revision are stale. It's not the default because it conceals this error
in the true state of such revisions.

12 years agoIn bisect-runner.pl, remove "faking it" code from the main flow.
Nicholas Clark [Tue, 1 Nov 2011 16:51:50 +0000 (17:51 +0100)]
In bisect-runner.pl, remove "faking it" code from the main flow.

Refactor the code to fake a correct MANIFEST into force_manifest() and
force_manifest_cleanup(). Refactor the code that emulates -Dnoextensions
into fake_noextensions().

This should make it easier to see the main flow of the program.

12 years agoIn bisect-runner.pl, consolidate the code that patches extensions.
Nicholas Clark [Tue, 1 Nov 2011 16:04:01 +0000 (17:04 +0100)]
In bisect-runner.pl, consolidate the code that patches extensions.

All the code that patches extensions extensions is now moved to patch_ext().

12 years agoIn bisect-runner.pl, consolidate the code that patches .SH and C files.
Nicholas Clark [Tue, 1 Nov 2011 14:57:07 +0000 (15:57 +0100)]
In bisect-runner.pl, consolidate the code that patches .SH and C files.

All the code that patches .SH files is now moved to patch_SH().
All the code that patches C files is now moved to patch_C().

12 years agoIn bisect-runner.pl, consolidate the code that patches Configure and hints.
Nicholas Clark [Tue, 1 Nov 2011 13:00:21 +0000 (14:00 +0100)]
In bisect-runner.pl, consolidate the code that patches Configure and hints.

All the code that patches Configure is now moved to patch_Configure().
All the code that patches hints files is now moved to patch_hints().

This should start to make it easier to see the main flow of the program.

12 years agoAdd a --validate option to bisect.pl to verify that stable releases build.
Nicholas Clark [Tue, 1 Nov 2011 11:44:57 +0000 (12:44 +0100)]
Add a --validate option to bisect.pl to verify that stable releases build.

This is useful for validating a new OS/CPU/compiler combination, and for
checking that refactoring bisect-runner.pl hasn't broken any that previously
worked.

12 years agoFix third argument to setresgid call while setting $(.
Leon Timmermans [Tue, 13 Sep 2011 20:04:23 +0000 (22:04 +0200)]
Fix third argument to setresgid call while setting $(.

[Committer's note: discussion on perl5-security-report concluded that
exploitability was low to nonexistent because any system that has setresgid
but not setregid will pretend to have the latter and define it in terms
of the former (see "#ifndef HAS_SETREGID" in perl.h).  But the bug should
be fixed in case that code gets exposed in the future.  The approach
taken in perl.h was also called into question and may elicit further
discussion and patching.]

Note: bug this only affects systems that have setresgid but not setregid
(since that codepath prefers the latter over the former). To the best of
my knowledge, no such systems exists (nor would it make much sense) so
this bug is probably not exploitable, but I can't guarantee that.

When the effective group is set using setresgid, it does this:
  setresgid((Gid_t)PL_gid, (Gid_t)-1, (Gid_t) 1);
That last 1 should have been a -1. Instead of leaving the saved GID
unchanged it sets it to to 1. This means privileges are not permanently
dropped, but instead the GID is set to 1 (if possible). The program can
thereafter change it's effective and real GIDs to 1.

12 years agoperlfunc/glob: Explain use of quotes
Tom Christiansen [Mon, 31 Oct 2011 16:59:11 +0000 (09:59 -0700)]
perlfunc/glob: Explain use of quotes

12 years agoperldelta update
Father Chrysostomos [Mon, 31 Oct 2011 15:53:10 +0000 (08:53 -0700)]
perldelta update

12 years agot/porting/authors.t can send just the git log info needed by checkAUTHORS.pl
Nicholas Clark [Thu, 27 Oct 2011 11:38:46 +0000 (13:38 +0200)]
t/porting/authors.t can send just the git log info needed by checkAUTHORS.pl

Using a custom pretty format to reduce the data passed drops the runtime by
about 25%. Admittedly small in absolute terms, but an easy change whose
gains will slowly accumulate.

12 years agoRemove $date from Porting/checkAUTHORS.pl, which was never used.
Nicholas Clark [Thu, 27 Oct 2011 11:17:08 +0000 (13:17 +0200)]
Remove $date from Porting/checkAUTHORS.pl, which was never used.

It was added in commit 00229b9760c33911, along with the pattern which
captured the value of 'AuthorDate:', when checkAUTHORS.pl was converted to
parsing the output of git log instead of p4 log. Neither the old nor the new
code made any use of dates, hence the variable (and the capture) were never
needed.

12 years agoImprove general GNU hints, needed for GNU/Hurd.
Pino Toscano [Wed, 10 Aug 2011 05:11:33 +0000 (08:11 +0300)]
Improve general GNU hints, needed for GNU/Hurd.

Bug-Debian: http://bugs.debian.org/636609

Patch-Name: fixes/hurd-hints.diff

With minor modifications to add Pino to AUTHORS.

12 years agoCorrect FreeBSD hints file for FreeBSD 10.0
Jilles Tjoelker [Sun, 30 Oct 2011 09:53:43 +0000 (10:53 +0100)]
Correct FreeBSD hints file for FreeBSD 10.0

Perl does not build on FreeBSD 10.0 because some checks in
hints/freebsd.sh think FreeBSD 10 is FreeBSD 1 and therefore enable
behaviour only appropriate for a.out systems.

The below patch was included in the lang/perl5.12 port and fixes its
build. The resulting binaries are also suitable to compile other ports.
I have also verified that this patch applies to lang/perl5.10 and
lang/perl5.14, making them build.

12 years agoAdd Jilles Tjoelker to AUTHORS.
Nicholas Clark [Sun, 30 Oct 2011 09:35:55 +0000 (10:35 +0100)]
Add Jilles Tjoelker to AUTHORS.

12 years agoRemove some repeated code in pp_regcomp
Father Chrysostomos [Sat, 29 Oct 2011 20:41:13 +0000 (13:41 -0700)]
Remove some repeated code in pp_regcomp

12 years agoFix =~ $str_overloaded (5.10 regression)
Father Chrysostomos [Sat, 29 Oct 2011 20:40:06 +0000 (13:40 -0700)]
Fix =~ $str_overloaded (5.10 regression)

In 5.8.x, this code:

  use overload '""'=>sub { warn "stringify"; --$| ? "gonzo" : chr 256 };
  my $obj = bless\do{my $x};
  warn "$obj";
  print "match\n" if chr(256) =~ $obj;

prints

  stringify at - line 1.
  gonzo at - line 3.
  stringify at - line 1.
  match

which is to be expected.

In 5.10+, the stringification happens one extra time, causing a failed match:

  stringify at - line 1.
  gonzo at - line 3.
  stringify at - line 1.
  stringify at - line 1.

This logic in pp_regcomp is faulty:

    if (DO_UTF8(tmpstr)) {
assert (SvUTF8(tmpstr));
    } else if (SvUTF8(tmpstr)) {
... copy under ‘use bytes’...
    }
    else if (SvAMAGIC(tmpstr)) {
/* make a copy to avoid extra stringifies */
tmpstr = newSVpvn_flags(t, len, SVs_TEMP | SvUTF8(tmpstr));
    }

The SvAMAGIC check never happens when the UTF8 flag is on.

12 years agoIncrease $strict::VERSION to 1.05
Father Chrysostomos [Sat, 29 Oct 2011 18:55:09 +0000 (11:55 -0700)]
Increase $strict::VERSION to 1.05

12 years agounconfuse strict.pm documentation
Moritz Lenz [Sat, 29 Oct 2011 18:21:40 +0000 (20:21 +0200)]
unconfuse strict.pm documentation

my() does not localize variables, and reusing variable names is
confusing too

12 years agoDosGlob: Comment typo
Father Chrysostomos [Sat, 29 Oct 2011 18:48:41 +0000 (11:48 -0700)]
DosGlob: Comment typo

12 years agoDosGlob: Don’t parse an pattern that will not be used
Father Chrysostomos [Sat, 29 Oct 2011 18:47:25 +0000 (11:47 -0700)]
DosGlob: Don’t parse an pattern that will not be used

This is the same change for efficiency’s sake that was applied to
File::Glob in commit edfed4c3099a.

12 years agoFile::Glob: Consistent use of spaces after dots
Father Chrysostomos [Sat, 29 Oct 2011 16:56:23 +0000 (09:56 -0700)]
File::Glob: Consistent use of spaces after dots

(except after e.g.)

12 years agoFile::Glob: Remove docs specific to Mac Classic
Father Chrysostomos [Sat, 29 Oct 2011 16:54:59 +0000 (09:54 -0700)]
File::Glob: Remove docs specific to Mac Classic

These have been obsolete since commit e37778c28b in 2009.

12 years agoDocument File::Glob::csh_glob
Father Chrysostomos [Sat, 29 Oct 2011 16:52:45 +0000 (09:52 -0700)]
Document File::Glob::csh_glob

In <https://rt.cpan.org/Ticket/Display.html?id=72021>, Damian Con-
way writes:

> PS: List::Maker previously followed the documented behaviour of
>     File::Glob, rather than the actual behaviour. So there's arguably a
>     bug in File::Glob as well. ;-)

List::Maker was forwarding calls to File::Glob::bsd_glob from its
global override in scopes where its override did not apply.  The
File::Glob documentation was misleading and implied that that was the
correct thing to do.

12 years agoPATCH: [perl #101940]: BBC Tk
Karl Williamson [Sat, 29 Oct 2011 17:20:40 +0000 (11:20 -0600)]
PATCH: [perl #101940]: BBC Tk

This commit that turned up this bug turns out merely exposes an
underlying problem that could be generated via other means.

regcomp.c was looking at the SvUTF8 flag on the input pattern before
doing an SvPV on it.  Generally the flag is considered not reliable
unless checked immediately after a SvPV.

I haven't been able to come up with a simple test case that reproduces
the bug.  I suspect that XS code is required to trigger it.

12 years agoregcomp.c: Use no_mg for 2nd fetch of pattern
Karl Williamson [Sat, 29 Oct 2011 15:48:43 +0000 (09:48 -0600)]
regcomp.c: Use no_mg for 2nd fetch of pattern

The pattern could be tied, for example, and so only want to access it
once.  I couldn't come up with a test case that actually exercised this,
but I can think of future changes to regcomp that would.

12 years agoFix spelling in comment
Karl Williamson [Sat, 29 Oct 2011 14:52:07 +0000 (08:52 -0600)]
Fix spelling in comment

12 years agoGlob.xs: Remove dMY_CXT from bsd_glob
Father Chrysostomos [Sat, 29 Oct 2011 08:20:28 +0000 (01:20 -0700)]
Glob.xs: Remove dMY_CXT from bsd_glob

It has been redundant since 1bb8785a (when bsd_glob was still
called doglob).

12 years agoDosGlob: eliminate %iter
Father Chrysostomos [Sat, 29 Oct 2011 07:56:20 +0000 (00:56 -0700)]
DosGlob: eliminate %iter

This hash is redundant, as the presence of an entry in %entries is
sufficient.

12 years agoIncrease $File::DosGlob::VERSION to 1.07
Father Chrysostomos [Sat, 29 Oct 2011 07:53:59 +0000 (00:53 -0700)]
Increase $File::DosGlob::VERSION to 1.07

12 years agoGlob.xs: Clarify comment
Father Chrysostomos [Sat, 29 Oct 2011 07:52:46 +0000 (00:52 -0700)]
Glob.xs: Clarify comment

12 years agoGlob.xs: Remove comment
Father Chrysostomos [Sat, 29 Oct 2011 07:51:42 +0000 (00:51 -0700)]
Glob.xs: Remove comment

This was obsoleted by commit f4cbf9907d.