platform/upstream/perl.git
12 years agoAdd Mark Dootson to AUTHORS
Father Chrysostomos [Sat, 3 Dec 2011 01:52:17 +0000 (17:52 -0800)]
Add Mark Dootson to AUTHORS

12 years agoIncrease $threads::VERSION to 1.86
Father Chrysostomos [Sat, 3 Dec 2011 01:51:26 +0000 (17:51 -0800)]
Increase $threads::VERSION to 1.86

12 years ago[perl #104776] Fix threads for latest 64bit mingw-w64 + gcc 4.6
Mark Dootson [Sat, 3 Dec 2011 00:50:26 +0000 (16:50 -0800)]
[perl #104776] Fix threads for latest 64bit mingw-w64 + gcc 4.6

Latest mingw-w64 64 bit + gcc >= 4.6.2 fails due to differences in
setjmp definition. (32 bit is OK) (t/exit.t fails a couple of tests
with access violation faults)

12 years ago$tied =~ s///e when FETCH returns a COW
Father Chrysostomos [Fri, 2 Dec 2011 21:04:41 +0000 (13:04 -0800)]
$tied =~ s///e when FETCH returns a COW

This used to cause an assertion failure, or sometimes ‘Attempt to free
nonexistent shared string’.

All that was required to fix it was the deletion of two cpp lines.

12 years agoskip Perl_my_symlink symbol on older VMS systems.
Craig A. Berry [Fri, 2 Dec 2011 17:30:11 +0000 (11:30 -0600)]
skip Perl_my_symlink symbol on older VMS systems.

It's a wrapper for cases where we have symlink, not a replacement
for cases where we don't (pre-v8.3).  Trying to include it on
older systems causes a link error.

12 years agoUpdate Locale-Codes version in Maintainers.pl
Chris 'BinGOs' Williams [Fri, 2 Dec 2011 13:20:26 +0000 (13:20 +0000)]
Update Locale-Codes version in Maintainers.pl

This should have been part of 4345d05bb848d49bf1bc348b0bf725f5679165bf

12 years agoAllow COW PVMGs to be tied
Father Chrysostomos [Fri, 2 Dec 2011 06:46:22 +0000 (22:46 -0800)]
Allow COW PVMGs to be tied

This logic in sv_magic is wrong:

    if (SvREADONLY(sv)) {
if (
    /* its okay to attach magic to shared strings; the subsequent
     * upgrade to PVMG will unshare the string */
    !(SvFAKE(sv) && SvTYPE(sv) < SVt_PVMG)

    && IN_PERL_RUNTIME
    && !PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(how)
   )
{
    Perl_croak_no_modify(aTHX);
}
    }

There is nothing wrong with attaching magic to a shared string that
will stay shared.  Also, shared strings are not always < SVt_PVMG.
 Sometimes a PVMG or PVLV can end up with a shared string.  In those
cases, the logic above treats them as read-only, which they ain’t.

The easiest example is a downgraded typeglob:

$x = *foo;        # now a PVGV
undef $x ;        # downgraded to PVMG
$x = __PACKAGE__; # now a shared string (COW)
tie $x, "main";   # bang! $x is considered read-only
sub main::TIESCALAR{bless[]}

12 years agoUse SvOOK_on
Father Chrysostomos [Thu, 1 Dec 2011 20:36:18 +0000 (12:36 -0800)]
Use SvOOK_on

Now that SvOOK_on has a usable definition (i.e., it leaves the
NIOK flags alone), we can use it and remove the comments warning
against it.

12 years agoBring SvOOK_on back, but simpler
Father Chrysostomos [Thu, 1 Dec 2011 20:29:06 +0000 (12:29 -0800)]
Bring SvOOK_on back, but simpler

Commit 404dce59 removed it, because nothing in core or CPAN was using
it and it is not part of the API.

Nothing in core was using it because it was unusable as previously
defined (with SvIOK_off).

This commit brings it back, but now it is a simple flag-setting macro,
that will actually be usable by the core.

12 years agoUpdate Locale-Codes to CPAN version 3.20
Chris 'BinGOs' Williams [Thu, 1 Dec 2011 14:32:01 +0000 (14:32 +0000)]
Update Locale-Codes to CPAN version 3.20

  [DELTA]

  VERSION 3.20 (2011-12-01)

  NEW CODE(s)

  Added limited support for deprecated codes

    The code2XXX, XXX2code, all_XXX_codes, and all_XXX_names functions now support retired codes. RT 71124

  Fixed capitalization

    The 'South Sudan' country was all caps. RT 71024

  Pod tests off by default

    The pod tests will not run at install time. RT 71122

  Codesets may be specified by name

    All codesets may be specified by a constant or by their name now. Previously, they were specified only by a constant.

  alias_code deprecated

    The alias_code function exists for backward compatibility. It has been replaced by rename_country_code.
    The alias_code function will be removed sometime after September, 2013.

  Code cleanup

    All work is now done in the central module (Locale::Codes). Previously, some was still
    done in the wrapper modules (Locale::Codes::*) but that is gone now.

  Added LangFam module

    Added Language Family codes (langfam) as defined in ISO 639-5.

12 years agoMerge branch 'dual-life-socket' into blead
Florian Ragwitz [Thu, 1 Dec 2011 14:23:25 +0000 (15:23 +0100)]
Merge branch 'dual-life-socket' into blead

* dual-life-socket:
  Bump Socket::VERSION to 1.95; to match CPAN release
  Snapshot of P/PE/PEVANS/Socket-1.94_07.tar.gz
  More fixups for dual-life to support out-of-core build
  Prepare Socket.pm for dual-life
  Fixups for older Perl versions:
  Rewrite ext/Socket/t/Socket.t to use Test::More rather than manual printing

12 years agoBump Socket::VERSION to 1.95; to match CPAN release
Paul \"LeoNerd\" Evans [Thu, 1 Dec 2011 14:10:48 +0000 (14:10 +0000)]
Bump Socket::VERSION to 1.95; to match CPAN release

12 years agoSnapshot of P/PE/PEVANS/Socket-1.94_07.tar.gz
Paul \"LeoNerd\" Evans [Tue, 22 Nov 2011 15:11:49 +0000 (15:11 +0000)]
Snapshot of P/PE/PEVANS/Socket-1.94_07.tar.gz

12 years agoMore fixups for dual-life to support out-of-core build
Paul \"LeoNerd\" Evans [Tue, 1 Nov 2011 16:16:33 +0000 (16:16 +0000)]
More fixups for dual-life to support out-of-core build

 * Use ExtUtils::CChecker when not in core to replace the Configure-time testing that core does
 * Don't actually need to dVAR in getaddrinfo/getnameinfo
 * Expand croak_xs_usage inline rather than rely on xsubpp to write one

12 years agoPrepare Socket.pm for dual-life
Paul \"LeoNerd\" Evans [Mon, 24 Oct 2011 18:02:43 +0000 (19:02 +0100)]
Prepare Socket.pm for dual-life

 * Moved from ext/Socket to cpan/Socket
 * Currently declared as PEVANS/Socket-1.95.tar.gz - which is what it
   will eventually become

12 years agoFixups for older Perl versions:
Paul \"LeoNerd\" Evans [Mon, 24 Oct 2011 17:07:42 +0000 (18:07 +0100)]
Fixups for older Perl versions:

 * Pass package and version to XSLoader::load to keep older perl versions happy
 * Older perls do not define croak_sv; #define a workaround for them

12 years agoRewrite ext/Socket/t/Socket.t to use Test::More rather than manual printing
Paul \"LeoNerd\" Evans [Mon, 24 Oct 2011 16:51:13 +0000 (17:51 +0100)]
Rewrite ext/Socket/t/Socket.t to use Test::More rather than manual printing

12 years agoInstall perlfaq and perlglossary manpages in section 1 of the manual
Rafael Garcia-Suarez [Thu, 1 Dec 2011 14:10:49 +0000 (15:10 +0100)]
Install perlfaq and perlglossary manpages in section 1 of the manual

12 years agoSkip executable Cygwin test in EUMM when in core
Chris 'BinGOs' Williams [Thu, 1 Dec 2011 11:23:41 +0000 (11:23 +0000)]
Skip executable Cygwin test in EUMM when in core

Change has been upstreamed as:

<https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/d0172d0f>

12 years agoavoid conflicting static / dllexport on legacy perls too
Tony Cook [Thu, 1 Dec 2011 10:37:42 +0000 (21:37 +1100)]
avoid conflicting static / dllexport on legacy perls too

This probably fixes rt.cpan.org 72313 and 71964.

12 years agoignore a cygwin specific generated file
Tony Cook [Thu, 1 Dec 2011 08:39:18 +0000 (19:39 +1100)]
ignore a cygwin specific generated file

12 years agostatic and dllexport don't belong together on cygwin
Tony Cook [Thu, 1 Dec 2011 08:00:53 +0000 (19:00 +1100)]
static and dllexport don't belong together on cygwin

This was causing build errors like:

Cwd.c:553:1: error: external linkage required for symbol ‘XS_Cwd_getcwd’ because of ‘dllexport’ attribute

12 years agosv.c: fix comment typo added by ce2077b184
Father Chrysostomos [Thu, 1 Dec 2011 07:20:10 +0000 (23:20 -0800)]
sv.c: fix comment typo added by ce2077b184

12 years agoRemove SvOOK_on
Father Chrysostomos [Thu, 1 Dec 2011 07:06:55 +0000 (23:06 -0800)]
Remove SvOOK_on

Nothing is using in core or on CPAN.  It is not part of the API.

12 years agoperlintro: consistent use of spaces after dots
Father Chrysostomos [Thu, 1 Dec 2011 06:29:44 +0000 (22:29 -0800)]
perlintro: consistent use of spaces after dots

12 years ago[perl #105024] UNIVERSAL::AUTOLOAD and %+
Father Chrysostomos [Thu, 1 Dec 2011 06:05:03 +0000 (22:05 -0800)]
[perl #105024] UNIVERSAL::AUTOLOAD and %+

The code in gv.c for loading a tie module automatically
(S_require_tie_mod) was only loading the module if its stash did not
exist or if a particular method (usually TIEHASH) could not be found.
But it was triggering autoloading, such that a universal AUTOLOAD
method would allow it to ‘find’ the method it was looking for, even if
it did not exist.  So autovivifying the package somehow (e.g., by men-
tioning one of its symbols) could prevent the module from loading.

12 years agoteach podcheck.t about newly linked-to module in perlfunc
Ricardo Signes [Thu, 1 Dec 2011 00:40:54 +0000 (19:40 -0500)]
teach podcheck.t about newly linked-to module in perlfunc

12 years agoDon't suggest using srand for "cryptographic purposes"
Abhijit Menon-Sen [Thu, 1 Dec 2011 00:02:35 +0000 (05:32 +0530)]
Don't suggest using srand for "cryptographic purposes"

Also, don't suggest Math::Random::MT::Perl as a source of
cryptographically secure randomness, because it isn't.

12 years agopod/perlintro: mention that "foreach" is really a synonym for "for"
Ævar Arnfjörð Bjarmason [Sat, 26 Nov 2011 23:07:15 +0000 (23:07 +0000)]
pod/perlintro: mention that "foreach" is really a synonym for "for"

The perlintro section on for/foreach would have you believe that "for"
is always C-style and "foreach" is always Perl-style. This isn't
actually the case, so link to the perlsyn section that covers that.

12 years agopod/perlsyn: for is equivalent to "foreach'
Ævar Arnfjörð Bjarmason [Sat, 26 Nov 2011 22:58:22 +0000 (22:58 +0000)]
pod/perlsyn: for is equivalent to "foreach'

Change the Compound Statements section to not like by omission. Both
for and foreach can be used as C-style and Perl-style for-loops, but
the documentation pretended that "for" was always C-style and
"foreach" was always Perl-style.

12 years agoperlhacktips: typo
Father Chrysostomos [Wed, 30 Nov 2011 21:16:06 +0000 (13:16 -0800)]
perlhacktips: typo

12 years agoperlsource.pod: toolks → tools
Father Chrysostomos [Wed, 30 Nov 2011 17:42:58 +0000 (09:42 -0800)]
perlsource.pod: toolks → tools

12 years agoAnother confusing comment; this time in regcomp.c
Father Chrysostomos [Wed, 30 Nov 2011 17:34:46 +0000 (09:34 -0800)]
Another confusing comment; this time in regcomp.c

This one comes from c2123ae38.

And we shouldn’t be suing our mothers’ tykes. :-)

12 years agoCorrect comment in hv.c:S_share_hek_flags
Father Chrysostomos [Wed, 30 Nov 2011 06:43:15 +0000 (22:43 -0800)]
Correct comment in hv.c:S_share_hek_flags

It says that allocate one block of memory with the HEK immediately
following the HE, so we can find the HEK from the HE.  Of course we
can find the HEK from the HE, as the HE points to it.  The two terms
were apparently transposed.

12 years agoRemove obsolete comment about SvPOKp in sv.h
Father Chrysostomos [Wed, 30 Nov 2011 06:39:26 +0000 (22:39 -0800)]
Remove obsolete comment about SvPOKp in sv.h

This comment was added in 373b357f1, and then invalidated by the same
person in 8eeaf79a, seventeen days later.

12 years agohv.h: Don’t call a char * parameter ‘sv’!
Father Chrysostomos [Wed, 30 Nov 2011 04:12:56 +0000 (20:12 -0800)]
hv.h: Don’t call a char * parameter ‘sv’!

This goes all the way back to bbce6d6978 (inseparable changes from
patch from perl5.003_08 to perl5.003_09).  It is mightily confusing
for anyone trying to figure out how these things work.

12 years agohv.h: remove obsolete comment
Father Chrysostomos [Wed, 30 Nov 2011 04:08:51 +0000 (20:08 -0800)]
hv.h: remove obsolete comment

This comment was made obsolete by commit bc5cdc2388.

12 years agosv.c/find_uninit_var: Explain kid-scanning loop better
Father Chrysostomos [Wed, 30 Nov 2011 02:04:35 +0000 (18:04 -0800)]
sv.c/find_uninit_var: Explain kid-scanning loop better

Hopefully this explanation will be clearer and will prevent clumsy
individuals like me from introducing bugs like #103766.

12 years agosv.c: typo
Father Chrysostomos [Wed, 30 Nov 2011 01:59:26 +0000 (17:59 -0800)]
sv.c: typo

12 years agopanic after cow-to-stash assignment
Father Chrysostomos [Tue, 29 Nov 2011 02:31:55 +0000 (18:31 -0800)]
panic after cow-to-stash assignment

This type of thing isn’t officially supported, but perl shouldn’t be
freeing unallocated memory (the 9th octet of a freed HEK) as a result:

    $::{whatever} = __PACKAGE__;
    *{"whatever"};

A string stored in the symbol table like that is actually a subroutine
stub.  ‘sub foo($)’ is stored as '$' in the "foo" slot to save space.

gv_init_pvn (formerly known as gv_init) checks SvPOK first thing,
assuming, if it is set, that it can reuse SvPVX as the CV’s prototype,
without reallocating or copying it.  That works most of the time.

For COW strings (such as those returned by __PACKAGE__), SvPVX points
to the hek_key field (the 9th octet) of a shared HEK.  When the CV is
freed, it ends up trying to do Safefree(that_hek + 8) effectively,
which is bad.

12 years agoAs perldoc is linked from perl.pod, it shouldn't be in perltoc's sin list.
Nicholas Clark [Mon, 28 Nov 2011 15:40:28 +0000 (15:40 +0000)]
As perldoc is linked from perl.pod, it shouldn't be in perltoc's sin list.

perldoc has a manpage prominently linked from the perl manpage. Hence it
makes no sense to also have it listed at the end of perltoc in the section
described as "Here should be listed all the extra programs' documentation,
but they don't all have manual pages yet"

12 years agoEliminate vestigial reference to unpushed.h from descrip_mms.template
Nicholas Clark [Mon, 28 Nov 2011 14:38:55 +0000 (14:38 +0000)]
Eliminate vestigial reference to unpushed.h from descrip_mms.template

Commit dcff826f70bf3f64 renamed unpushed.h to git_version.h in early 2009.
So code to delete it is no longer needed :-)

12 years agopod/buildtoc now generates pod/roffitall
Nicholas Clark [Sun, 27 Nov 2011 22:02:54 +0000 (23:02 +0100)]
pod/buildtoc now generates pod/roffitall

roffitall remains a shell script, identical apart from a dynamically
generated list of man pages (and removal of the comment from 2000 that
this should be done).

12 years agoavoid double defining the POSIX::TCSANOW constant sub
Tony Cook [Mon, 28 Nov 2011 07:18:25 +0000 (18:18 +1100)]
avoid double defining the POSIX::TCSANOW constant sub

On Win32 which has no native TCSANOW definition this would produce:

Constant subroutine TCSANOW redefined at ../lib/POSIX.pm line -1.

because the macro wasn't defined when building the unknown symbols
table but was defined when building the defined symbols table.

12 years agosv.c: Turn a FIXME comment into an explanation
Father Chrysostomos [Mon, 28 Nov 2011 02:37:14 +0000 (18:37 -0800)]
sv.c: Turn a FIXME comment into an explanation

12 years agoRemove duplicate comment from sv.h
Father Chrysostomos [Mon, 28 Nov 2011 02:27:09 +0000 (18:27 -0800)]
Remove duplicate comment from sv.h

The ‘or lexical’ in this ‘glob or lexical is just a copy’ comment was
added in perl 5.001 (748a9306), which added closures.

This comment was later duplicated in commit 120ff8e9d (‘Document a
sixth use for SVf_FAKE’), but in a clearer fashion.

This commit removes the ‘or lexical’ part, as it is now confusing.

12 years agoUpdate Module-Loaded to CPAN version 0.08
Chris 'BinGOs' Williams [Sun, 27 Nov 2011 21:03:49 +0000 (21:03 +0000)]
Update Module-Loaded to CPAN version 0.08

  [DELTA]

  Changes for 0.08    Sun Nov 27 20:44:00 GMT 2011
  =================================================
  * Remove trailing spaces and update Makefile.PL

12 years agoFix two bugs related to pod files outside of pod/
Nicholas Clark [Sun, 27 Nov 2011 20:26:46 +0000 (21:26 +0100)]
Fix two bugs related to pod files outside of pod/

Commit 1721346e4e420217, which allowed buildtoc to handle files outside of
pod/, had two bugs when processing files from outside of pod/

Firstly, the call to podset() for the core pods needs to pass in the short
name of the pod, not the name with the path in it (ie $_->[4], not $_->[1]),
else the =head2 entry for that pod will have the pathname in it.

Secondly, buildtoc must take care to avoid outputting the contents for these
pods twice - once when read from cpan/ or dist/ using the path in pod.lst,
and once from the file as found in lib/

12 years ago[perl #99850] SEGV when destructor undefs goto &sub
Father Chrysostomos [Sun, 27 Nov 2011 19:41:44 +0000 (11:41 -0800)]
[perl #99850] SEGV when destructor undefs goto &sub

If goto &sub triggers a destructor that undefines &sub, a
crash ensues.

This commit adds an extra check in pp_goto after the unwinding of the
previous sub’s scope.

12 years agotypo in perlre.pod
Father Chrysostomos [Sun, 27 Nov 2011 19:07:44 +0000 (11:07 -0800)]
typo in perlre.pod

12 years agoChange a semicolon to a colon. This is necessary for the shared mem example to compile
Peter Martini [Fri, 25 Nov 2011 23:23:53 +0000 (18:23 -0500)]
Change a semicolon to a colon. This is necessary for the shared mem example to compile

12 years agoFix two post 5.15.0 perltoc.pod generation bugs.
Nicholas Clark [Sun, 27 Nov 2011 12:05:11 +0000 (13:05 +0100)]
Fix two post 5.15.0 perltoc.pod generation bugs.

Commit 1721346e4e420217, which allowed buildtoc to handle files outside of
pod, changed the number of entries in the master structure, but missed
changing one test from 3 to 5, which resulted in all the core documentation
being omitted from the generated perltoc.pod

Commit f37610d895e1d30b, which eliminated the use of absolute pathnames,
failed to change two regular expressions in the subroutine passed to
File::Find::find(), which resulted in all module pod filenames having
lib/ prepended, and thus all modules being treated as pragmata.
This commit also contained an error in the call to podset() for the core
documentation, which wasn't noticed because that code was never called,
due to the bug introduced by commit 1721346e4e420217.

perltoc.pod now builds correctly once again. Whether anyone uses it is
another matter.

12 years agoIn roffitall, explicitly use perl to run rofftoc.
Nicholas Clark [Sat, 26 Nov 2011 21:20:30 +0000 (22:20 +0100)]
In roffitall, explicitly use perl to run rofftoc.

Previously roffitall invoked rofftoc as ./rofftoc (implying a shell script),
and in turn rofftoc used the "sh or perl" construction to cause sh to pass
itself to perl. This was a bit obfuscated at the best of times, and broke
completely when commit ff906f87ce151941 removed execute permission in 2010.

12 years ago[perl #97980] Stop tied() from returning a copy
Father Chrysostomos [Sun, 27 Nov 2011 02:17:45 +0000 (18:17 -0800)]
[perl #97980] Stop tied() from returning a copy

Now tied() returns the actual scalar used to hold the tie object,
so one can write weaken(tied $foo).

12 years agoMake inlined &CORE::__SUB__ the right-sized op
Father Chrysostomos [Sun, 27 Nov 2011 00:58:56 +0000 (16:58 -0800)]
Make inlined &CORE::__SUB__ the right-sized op

In commit 1a35f9ffb I forgot to make an inlined OP_RUNCV op a PVOP in
ck_entersub_args_core (which inlines a &CORE::sub).

This caused crashes on Linux, but not on OS X, for some reason.

12 years ago[perl #98352] perlre: Clarify visibility of $1 in (??{...})
Father Chrysostomos [Sat, 26 Nov 2011 23:55:48 +0000 (15:55 -0800)]
[perl #98352] perlre: Clarify visibility of $1 in (??{...})

12 years agoOops!
Father Chrysostomos [Sat, 26 Nov 2011 23:39:05 +0000 (15:39 -0800)]
Oops!

Well, I at least ran test_porting after making that ‘only doc’ change!
But then I committed with -a by mistake.  Oh well.

12 years agosv.h: Consistent use of spaces after dots
Father Chrysostomos [Sat, 26 Nov 2011 20:49:52 +0000 (12:49 -0800)]
sv.h: Consistent use of spaces after dots

12 years ago[perl #97632] Improve SvTAINT docs
Father Chrysostomos [Sat, 26 Nov 2011 20:42:55 +0000 (12:42 -0800)]
[perl #97632] Improve SvTAINT docs

Copied almost verbatim from text supplied by Kevin Ryde.

12 years agoRemove ‘no warnings deprecated’ from two .t’s
Father Chrysostomos [Sat, 26 Nov 2011 19:46:58 +0000 (11:46 -0800)]
Remove ‘no warnings deprecated’ from two .t’s

This was added to avoid the warning from $[, but these two test
scripts no longer mention $[.

12 years agoOptimise substr assignment in void context
Father Chrysostomos [Sat, 26 Nov 2011 07:04:22 +0000 (23:04 -0800)]
Optimise substr assignment in void context

In void context we can optimise

    substr($foo, $bar, $baz) = $replacement;

to something like

    substr($foo, $bar, $baz, $replacement);

except that the execution order must be preserved.  So what we actu-
ally do is

    substr($replacement, $foo, $bar, $baz);

with a flag to indicate that the replacement comes first.  This means
we can also optimise assignment to two-argument substr the same way.

Although optimisations are not supposed to change behaviour,
this one does.

• It stops substr assignment from calling get-magic twice, which means
  the optimisation makes things less buggy than usual.
• It causes the uninitialized warning (for an undefined first argu-
  ment) to mention the substr operator, as it did before the previous
  commit, rather than the assignment operator.  I think that sort of
  detail is minor enough.

I had to make the warning about clobbering references apply whenever
substr does a replacement, and not only when used as an lvalue.  So
four-argument substr now emits that warning.  I would consider that a
bug fix, too.

Also, if the numeric arguments to four-argument substr and the
replacement string are undefined, the order of the uninitialized warn-
ings is slightly different, but is consistent regardless of whether
the optimisation is in effect.

I believe this will make 95% of substr assignments run faster.  So
there is less incentive to use what I consider the less readable form
(the four-argument form, which is not self-documenting).

Since I like naïve benchmarks, here are Before and After:

$ time ./miniperl -le 'do{$x="hello"; substr ($x,0,0) = 34;0}for 1..1000000'

real 0m2.391s
user 0m2.381s
sys 0m0.005s
$ time ./miniperl -le 'do{$x="hello"; substr ($x,0,0) = 34;0}for 1..1000000'

real 0m0.936s
user 0m0.927s
sys 0m0.005s

12 years agoDon’t coerce $x immediately in foo(substr $x...)
Father Chrysostomos [Sat, 26 Nov 2011 00:22:01 +0000 (16:22 -0800)]
Don’t coerce $x immediately in foo(substr $x...)

This program:

    #!perl -l
    sub myprint { print @_ }
    print substr *foo, 1;
    myprint substr *foo, 1;

produces:

    main::foo
    Can't coerce GLOB to string in substr at - line 4.

Ouch!

I would expect \substr simply to give me a scalar that peeks into the
original string, but without modifying the original until the return
value of \substr is actually assigned to.

But it turns out that it coerces the original into a string immedi-
ately, unless it’s GMAGICAL.  I find the exception for magical varia-
ble rather befuddling.  I can only imagine it was for efficency (since
the stringified form will be overwritten when magic_setsubstr calls
SvGETMAGIC), but that doesn’t make sense as the original variable can
itself be modified between the return of the special lvalue and the
assignment to that lvalue.

Since magic_setsubstr itself coerces the variable into a string upon
assignment to the lvalue, we can just remove the coercion code from
pp_substr.

But that causes double uninitialized warnings in cases like
substr($undef, 0,0) = "lrep".

That happens because pp_substr is still stringifying the variable (but
without modifying it).  It has to do that, as it looks at the length
of the original string and accordingly adjusts the offsets stored in
the lvalue if they are negative or if they extend beyond the end of
the string.

So this commit takes the simple route of avoiding the warning in
pp_substr by only stringifying a variable that is SvOK if called in
lvalue context.

Hence, assignment to substr($tied...) will continue to call FETCH
twice, but that is not a new bug.

The ideal solution would be for the offsets to be translated in mg.c,
rather than in pp_substr.  But that would be a more involved change
(including most of this commit, which is therefore not wasted) with
potential backward-compatibility issue with negative numbers.

A side effect it that the ‘Attempt to use reference as lvalue in
substr’ warning now occurs during the assignment to the substr lvalue,
rather that substr itself.  This means it occurs even for tied varia-
bles, so things are now more consistent.

The example at the beginning could still croak if the glob were
replaced with a null string, so this commit only partially allevi-
ates the pain.

12 years agoOptimise __SUB__ to a constant
Father Chrysostomos [Fri, 25 Nov 2011 21:36:29 +0000 (13:36 -0800)]
Optimise __SUB__ to a constant

If __SUB__ is not inside a closure, it can be optimised to a constant.
We can only do this in the peephole optimiser, as we cannot tell
whether PL_compcv will become a closure until we reach the end
of the sub.

The __SUB__ op cannot simply be replaced with a const op, as the par-
ent op is not readily available in the peephole optimiser and, hence,
we cannot change its pointer.

So we have to convert the runcv op itself into a const op.  So it
has to be the same size.  This commit makes it a PVOP, since newPVOP,
unlike newSVOP, allows a null pv.  To avoid adding workarounds to B
modules, I put an exception in newPVOP’s assertion, instead of chang-
ing the type in regen/opcodes.

But B::Deparse still had to be updated to avoid infinite recursion.

12 years agoUpdate Unicode-Collate to CPAN version 0.87
Chris 'BinGOs' Williams [Sat, 26 Nov 2011 21:22:55 +0000 (21:22 +0000)]
Update Unicode-Collate to CPAN version 0.87

  [DELTA]

  0.87  Sat Nov 26 17:01:42 2011
    - Now Locale/*.pl files are searched in @INC. (see [rt.cpan.org #72666])
    - added locale_version method to access the version number of Locale/*.pl.

12 years agocorrect some erroneous linking in 5.14.0 delta
Ricardo Signes [Sat, 26 Nov 2011 01:26:45 +0000 (20:26 -0500)]
correct some erroneous linking in 5.14.0 delta

12 years agoAdd AutoLoader upgrade to perldelta
Chris 'BinGOs' Williams [Fri, 25 Nov 2011 22:12:44 +0000 (22:12 +0000)]
Add AutoLoader upgrade to perldelta

12 years agoUpdate B-Debug to CPAN version 1.17
Chris 'BinGOs' Williams [Fri, 25 Nov 2011 22:09:52 +0000 (22:09 +0000)]
Update B-Debug to CPAN version 1.17

  [DELTA]

  1.17 2011-11-25 rurban
        * FSF address change

12 years agobisect.pl avoids perl-5.004 and earlier on case insensitive systems.
Nicholas Clark [Fri, 25 Nov 2011 17:39:04 +0000 (18:39 +0100)]
bisect.pl avoids perl-5.004 and earlier on case insensitive systems.

bisect.pl now probes to see if the checkout is on a case insensitive file
system (such as the default HFS+ on OS X), and if so, uses perl-5.005 as
the earliest stable release to test.

This should make bisect.pl "just work" on a typical OS X system, for the
vast majority of use cases.

12 years agobisect-runner.pl now builds back to 5.005 on the default OS X filesystem.
Nicholas Clark [Fri, 25 Nov 2011 15:32:26 +0000 (16:32 +0100)]
bisect-runner.pl now builds back to 5.005 on the default OS X filesystem.

OS X defaults to case-insensitive HFS+. perl-5.8.0 and later have hints
files to avoid a clash between Makefile and makefile, and hence can build
without problems. Teaching bisect-runner.pl to replicate this hints tweak
allows it to build perl-5.6.0 and perl-5.005 on a default HFS+.
However, only do this for a case insensitive filesystem, else it breaks
the build for 5.003 and earlier (which hardcode 'makefile' in places).

perl-5.004 and earlier won't work on a default HFS+ without a *lot* of
bodgery, as the distribution from that era has two files, Configure and
configure, which trample over each other and confuse git. There are case
clashes in later revisions, which may create unexpected failures for
some actions (versus the same action on a case sensitive file system) but
they don't appear to affect building any 5.*.0 revisions.

bisect-runner.pl can build back to 5.002 on OS X on a case sensitive HFS+
file system.

12 years agobisect-runner.pl should avoid ext/Hash/Util/FieldHash being built twice.
Nicholas Clark [Fri, 25 Nov 2011 11:19:45 +0000 (12:19 +0100)]
bisect-runner.pl should avoid ext/Hash/Util/FieldHash being built twice.

Commit 550428fe486b1888 stopped the invocation of ext/Hash/Util/Makefile.PL
automatically recursing to ext/Hash/Util/FieldHash/Makefile.PL, as make_ext
was also calling it directly. This then resulted in two makes running in
parallel in ext/Hash/Util/FieldHash, which could all end in tears (and
failed builds). Hence we need to apply this fix if it isn't present, to
avoid spurious build failures during bisect runs.

12 years agobisect-runner.pl can now build on AIX back to perl-5.002
Nicholas Clark [Fri, 25 Nov 2011 10:41:14 +0000 (11:41 +0100)]
bisect-runner.pl can now build on AIX back to perl-5.002

Two "one line" fixes to Configure and pp_sys.c are enough to get all .0
stable releases to build. perl-5.001n also builds as far as miniperl.

This makes bisect.pl useful for diagnosing problems on AIX.

12 years agoIn bisect-runner.pl, fall back to context diffs for ancient patch binaries.
Nicholas Clark [Fri, 25 Nov 2011 09:58:16 +0000 (10:58 +0100)]
In bisect-runner.pl, fall back to context diffs for ancient patch binaries.

AIX supplies a pre-historic patch program, which certainly predates Linux
and is probably older than NT. It can't cope with unified diffs. Meanwhile,
it's hard enough to get git diff to output context diffs, let alone git show,
and nearly all the patches embedded here are unified. So it seems that the
path of least resistance is to convert unified diffs to context diffs.

12 years agoIn bisect-runner.pl, only shell out to patch from apply_patch().
Nicholas Clark [Wed, 23 Nov 2011 21:51:13 +0000 (22:51 +0100)]
In bisect-runner.pl, only shell out to patch from apply_patch().

Previously the system's patch binary was invoked from 3 places. Refactoring
the code to only call it from one place will make it easier to work around
ancient versions of patch that some vendors still supply.

12 years ago.\win32\mdelete.bat not needed
Konovalov, Vadim (Vadim)** CTR ** [Fri, 25 Nov 2011 09:10:24 +0000 (09:10 +0000)]
.\win32\mdelete.bat not needed

From: "Konovalov, Vadim (Vadim)** CTR **" <vadim.konovalov@alcatel-lucent.com>
Subject: [PATCH v5.15.5-187] .\win32\mdelete.bat not needed
Date: Thu, 24 Nov 2011 21:48:26 +0100
Message-ID: <35BF8D9716175C43BB9D67CA60CC345E2E0284DD@FRMRSSXCHMBSC2.dc-m.alcatel-lucent.com>

12 years agoDon’t warn for foo+1 with ($) proto
Father Chrysostomos [Fri, 25 Nov 2011 03:20:00 +0000 (19:20 -0800)]
Don’t warn for foo+1 with ($) proto

Commit 22393538 added the warning for (;$) prototypes, but
ended up adding it for ($) as well.

12 years agoevalbytes should ignore outer utf8 declaration
Father Chrysostomos [Fri, 25 Nov 2011 01:43:38 +0000 (17:43 -0800)]
evalbytes should ignore outer utf8 declaration

A slight mistake in the evalbytes.t test script caused a lot of tests
not be testing what they were supposed to be testing for.  I used
'qq(\x...)' instead of qq('\x...').  (I.e., I was trying to embed lit-
eral Unicode characters in the string, rather than pass escapes to
evalbytes.)

I had wondered at the time why it worked without my doing anything, so
I probably should have looked deeper.

12 years agoUpgrade AutoLoader to 5.72
Steffen Mueller [Thu, 24 Nov 2011 18:21:05 +0000 (19:21 +0100)]
Upgrade AutoLoader to 5.72

Mostly just a FSF address update.

12 years agoregen pod issues
Father Chrysostomos [Thu, 24 Nov 2011 16:52:59 +0000 (08:52 -0800)]
regen pod issues

12 years agoperlgpl.pod: wrap long line
Father Chrysostomos [Thu, 24 Nov 2011 16:52:52 +0000 (08:52 -0800)]
perlgpl.pod: wrap long line

12 years agoIncrease $SelfLoader::VERSION to 1.19
Father Chrysostomos [Thu, 24 Nov 2011 16:36:54 +0000 (08:36 -0800)]
Increase $SelfLoader::VERSION to 1.19

12 years agoUpdate references to the FSF's postal address
Dominic Hargreaves [Thu, 24 Nov 2011 16:08:04 +0000 (16:08 +0000)]
Update references to the FSF's postal address

12 years agoTest ambiguous warning with (;$) proto
Father Chrysostomos [Thu, 24 Nov 2011 16:27:13 +0000 (08:27 -0800)]
Test ambiguous warning with (;$) proto

12 years agoWhen parsing subs with user-defined prototypes, store information needed to throw...
Matthew Horsfall (alh) [Tue, 23 Aug 2011 03:32:10 +0000 (23:32 -0400)]
When parsing subs with user-defined prototypes, store information needed to throw warnings

12 years agoSuppress ‘once’ warning in gmagic.t
Father Chrysostomos [Thu, 24 Nov 2011 09:33:33 +0000 (01:33 -0800)]
Suppress ‘once’ warning in gmagic.t

12 years agoAdd lib/perl5db/t/rt-104168 to MANIFEST
Father Chrysostomos [Thu, 24 Nov 2011 09:22:38 +0000 (01:22 -0800)]
Add lib/perl5db/t/rt-104168 to MANIFEST

12 years agoThe attached patch adds to the debugger a capability I thought about
Peter Scott [Thu, 24 Nov 2011 09:21:29 +0000 (01:21 -0800)]
The attached patch adds to the debugger a capability I thought about
ages ago and which turned out to be absurdly easy to implement.  It adds
an optional parameter to the t(race) command, a maximum number of stack
frames to trace below the current one:, e.g.:

     t 3 - turn tracing on, trace up to 3 levels below current depth, be
silent below that
     t 2 fnord() - trace up to 2 levels deep in execution of fnord()

Since it is backwards compatible I added it to the legacy command set as
well, but that's certainly debatable.

12 years ago‘Inline’ S_sv_unglob
Father Chrysostomos [Thu, 24 Nov 2011 09:18:46 +0000 (01:18 -0800)]
‘Inline’ S_sv_unglob

S_sv_unglob is only called in one place, so inline it (but cheat, to
preserve blame history).

12 years agoMake COW-clobbering faster
Father Chrysostomos [Thu, 24 Nov 2011 09:16:32 +0000 (01:16 -0800)]
Make COW-clobbering faster

There is this special SV_COW_DROP_PV flag that gets passed to
sv_force_normal_flags to signal that the SV is about to be clobbered,
so there is no point in allocating a new PV.  But this flag was not
actually being used, until the previous commit commandeered it for
globs (despite the name).

Now it actually does what it says.

Before and after:

$ time ./perl -e '$x = __PACKAGE__, undef $x for 1..8000000'

real 0m5.758s
user 0m5.740s
sys 0m0.008s
$ time ./perl -e '$x = __PACKAGE__, undef $x for 1..8000000'

real 0m3.290s
user 0m3.282s
sys 0m0.006s

12 years agoMake assignment over glob copies much faster
Father Chrysostomos [Thu, 24 Nov 2011 09:09:14 +0000 (01:09 -0800)]
Make assignment over glob copies much faster

sv_force_normal is passed the SV_COW_DROP_PV flag if the scalar is
about to be written over.  That flag is not currently used.  We can
speed up assignment over fake GVs a lot by taking advantage of the flag.

Before and after:

$ time ./perl -e '$x = *foo, undef $x for 1..2000000'

real 0m4.264s
user 0m4.248s
sys 0m0.007s
$ time ./perl -e '$x = *foo, undef $x for 1..2000000'

real 0m1.820s
user 0m1.812s
sys 0m0.005s

12 years agoCall FETCH once for rcatline
Father Chrysostomos [Thu, 24 Nov 2011 07:32:30 +0000 (23:32 -0800)]
Call FETCH once for rcatline

12 years agolib/version.t: suppress warning
Father Chrysostomos [Thu, 24 Nov 2011 04:40:06 +0000 (20:40 -0800)]
lib/version.t: suppress warning

12 years agoperlfunc: Don’t put __SUB__ between substr entries
Father Chrysostomos [Thu, 24 Nov 2011 04:31:55 +0000 (20:31 -0800)]
perlfunc: Don’t put __SUB__ between substr entries

I made the mistake of putting it after the first =item substr,
instead of before it.

12 years agosysread should not ignore magic on its buffer
Father Chrysostomos [Thu, 24 Nov 2011 04:26:51 +0000 (20:26 -0800)]
sysread should not ignore magic on its buffer

sysread uses SvPV_force, which has a bug in it.  Even if the SV_GMAGIC
flag is passed to sv_pvn_force_flags (which SvPV_force does), it
ignores magic in any typeglob argument.

12 years agoMake sselect call fetch once
Father Chrysostomos [Thu, 24 Nov 2011 01:48:47 +0000 (17:48 -0800)]
Make sselect call fetch once

Not only does this commit make four-argument select call fetch once
on each argument (instead of sometimes 0 times), but it also checks
whether the argument is a string after calling fetch now, instead of
before, in determining whether to warn about a non-string.

12 years agoMove substr tests under t/op
Father Chrysostomos [Wed, 23 Nov 2011 21:41:52 +0000 (13:41 -0800)]
Move substr tests under t/op

Commit a4499558 moved them under t/re along with the subst tests, but
these are unrelated to regexps.

12 years agoCall FETCH once when chomping a tied ref
Father Chrysostomos [Wed, 23 Nov 2011 21:29:48 +0000 (13:29 -0800)]
Call FETCH once when chomping a tied ref

12 years agopp.c: Remove useless read-only check from S_do_chomp
Father Chrysostomos [Wed, 23 Nov 2011 21:11:48 +0000 (13:11 -0800)]
pp.c: Remove useless read-only check from S_do_chomp

After sv_force_normal_flags, the scalar will no longer be read-only,
except in those cases where sv_force_normal_flags croaks.  So this
check will never be true when SvFAKE was true.

12 years agoCall FETCH once for $tied_ref =~ y/a/b/
Father Chrysostomos [Wed, 23 Nov 2011 21:03:06 +0000 (13:03 -0800)]
Call FETCH once for $tied_ref =~ y/a/b/

12 years agoIncrease $IO::File::VERSION to 1.16
Father Chrysostomos [Wed, 23 Nov 2011 20:52:33 +0000 (12:52 -0800)]
Increase $IO::File::VERSION to 1.16

12 years agoRemove ‘use File::Spec’ from IO::File
Father Chrysostomos [Wed, 23 Nov 2011 20:52:20 +0000 (12:52 -0800)]
Remove ‘use File::Spec’ from IO::File

It is not using it any more.