platform/upstream/perl.git
13 years agoStop readline($foo) from autovivifying
Father Chrysostomos [Tue, 23 Aug 2011 21:54:34 +0000 (14:54 -0700)]
Stop readline($foo) from autovivifying

Currently <$foo> does not autovivify, but readline($foo) does, due to
the way pp_readline calls pp_rv2gv directly, with PL_op still holding
a pp_readline op, whose flags may have completely different meanings.

readline uses the OPf_SPECIAL flag to distinguish <$foo> from readline
($foo).  rv2gv uses it to determine whether to autovivify; hence the
discrepancy.

13 years agoclose($undef) should not croak_no_modify
Father Chrysostomos [Tue, 23 Aug 2011 21:36:46 +0000 (14:36 -0700)]
close($undef) should not croak_no_modify

Commit ac53db4c3f7e fixed bug #31767 (open $1 not dying), but put the
SvREADONLY check in the wrong spot, causing this bug:

$ perl -lwe 'no warnings "once"; close $x; close $+'
Name "main::x" used only once: possible typo at -e line 1.
Use of uninitialized value $x in ref-to-glob cast at -e line 1.
Modification of a read-only value attempted at -e line 1.

It shouldn’t be dying if I’m not trying to modifying it.

13 years agoCall get-magic once for implicit rv2gv in close(), etc.
Father Chrysostomos [Tue, 23 Aug 2011 21:10:49 +0000 (14:10 -0700)]
Call get-magic once for implicit rv2gv in close(), etc.

This commit stops an implicit rv2gv from calling get-magic twice.  As
a side-effect, it also squelches the duplicate warning emitted by
‘close undef’ (bug #97482).

is_gv_magical_sv is modified not to call get-magic on the sv passed to
it.  It is not in the public API, and the only two callers (rv2gv and
softrefxv) have already called get-magic before calling it.

13 years agoUpdate Archive-Extract to CPAN version 0.56
Chris 'BinGOs' Williams [Tue, 23 Aug 2011 19:03:52 +0000 (20:03 +0100)]
Update Archive-Extract to CPAN version 0.56

  [DELTA]

  Changes for 0.56    Tue Aug 23 15:55:52 2011
  ============================================
  * Amend the MSWin32 fixes for 'unzip' to
    work with Cygwin-based tools too.

13 years agoUpgrade Pod::Simple from version 3.18 to 3.19
Florian Ragwitz [Tue, 23 Aug 2011 16:35:58 +0000 (18:35 +0200)]
Upgrade Pod::Simple from version 3.18 to 3.19

13 years agoSo much for ‘correcting’ a test!
Father Chrysostomos [Tue, 23 Aug 2011 16:43:29 +0000 (09:43 -0700)]
So much for ‘correcting’ a test!

I forgot to change it back to test a built-in symbol.

13 years agoreaddir.t: Remove erroneous comments; correct test
Father Chrysostomos [Tue, 23 Aug 2011 16:32:41 +0000 (09:32 -0700)]
readdir.t: Remove erroneous comments; correct test

In commit 99fc7eca4 I wrote some erroneous comments and modified a
test such that it no longer tested what I was supposed to test.

I did not realise that the bug only affected globs for built-in varia-
bles, specifically those that pop into existence when looked at:

$ perl5.10.1 -e '$x = "y"; readdir $x'
Bad symbol for dirhandle at -e line 1.
$ perl5.10.1 -e '$x = "."; readdir $x'
Bus error

In commit 99fc7eca4, I actually removed the ultimate cause of the bug,
restoring the 5.8.x behaviour of not dying with ‘Bad symbol’, because
there *is* a symbol, even if it’s not a valid handle.

This commit removes the erroneous comments and makes the test less
sensitive to output, since it’s just supposed to be testing that no
crash happens.

13 years agoRemove null checks from pp_rv2gv
Father Chrysostomos [Tue, 23 Aug 2011 16:21:41 +0000 (09:21 -0700)]
Remove null checks from pp_rv2gv

sv can no longer be null at these points, as of commit 99fc7eca4,
which fixed buggy code that 7a5fd60d4 added (which resulted in
various interesting bugs and workarounds over the past few years.)

13 years agoRun regen/uconfig_h.pl as part of the regen and regen_headers targets.
Nicholas Clark [Tue, 23 Aug 2011 14:08:55 +0000 (16:08 +0200)]
Run regen/uconfig_h.pl as part of the regen and regen_headers targets.

regen/uconfig_h.pl can't be run (by default) by regen.pl, as regen.pl needs
to be cross-platform, whilst regen/uconfig_h.pl relies on having a Bourne
Shell. However, if one has managed to extract Makefile from Makefile.SH,
that's clear proof that one has a working Bourne Shell available :-)

13 years agoAdd t/porting/globvar.t, to sanity test globvar.sym on a *nix platform.
Nicholas Clark [Fri, 19 Aug 2011 10:15:38 +0000 (12:15 +0200)]
Add t/porting/globvar.t, to sanity test globvar.sym on a *nix platform.

This adds to makedef.pl a new platform, "test".

Hopefully this change will catch most problems that previously had resulted
in build failures on Win32.

13 years agoHandle PL_sh_path better in globvar.sym and makedef.pl
Nicholas Clark [Fri, 19 Aug 2011 10:12:16 +0000 (12:12 +0200)]
Handle PL_sh_path better in globvar.sym and makedef.pl

PL_sh_path needs some form of special case because it is conditionally
defined either in perlvar.h or perl.h, but globvar.sym mentions all symbols
unconditionally, and undef -DPERL_GLOBAL_STRUCT perlvar.h is parsed as an
unconditional skip list.

13 years agoGroup 3 headers as $(generated_headers) in the *nix, VMS and Win32 makefiles.
Nicholas Clark [Fri, 19 Aug 2011 19:04:50 +0000 (21:04 +0200)]
Group 3 headers as $(generated_headers) in the *nix, VMS and Win32 makefiles.

uudmap.h bitcount.h mg_data.h are all generated by generate_uudmap, and all
need to be deleted as part of the clean targets, so it makes sense to
reference all 3 together using a single makefile macro.

13 years agoperlfunc: List all prototypes for lstat
Father Chrysostomos [Tue, 23 Aug 2011 07:25:57 +0000 (00:25 -0700)]
perlfunc: List all prototypes for lstat

13 years agoStrip S<> formatting codes from diagnostics output
Matthew Horsfall (alh) [Tue, 23 Aug 2011 01:26:26 +0000 (21:26 -0400)]
Strip S<> formatting codes from diagnostics output

Update spacing

Don't break S<20 questions> across lines, update test to be accurate

13 years ago[perl #95530] BigRat int(-1/2) == 0
Father Chrysostomos [Mon, 22 Aug 2011 20:43:59 +0000 (13:43 -0700)]
[perl #95530] BigRat int(-1/2) == 0

Math::BigRat was trying to copy the sign of a BigRat object into a
BigInt object when converting to an integer, but without taking into
account that the number might be rounded toward zero.  This resulted
in a 0 BigInt with a negative sign, which is not actually a valid
BigInt object, as it does not support negative zero.

13 years agoSync Module-CoreList version in Maintainers.pl with version on CPAN
Chris 'BinGOs' Williams [Mon, 22 Aug 2011 19:47:29 +0000 (20:47 +0100)]
Sync Module-CoreList version in Maintainers.pl with version on CPAN

13 years agoOnly list non-static undocumented funcs in perlintern
Father Chrysostomos [Mon, 22 Aug 2011 16:42:32 +0000 (09:42 -0700)]
Only list non-static undocumented funcs in perlintern

13 years agoRevise perlintern’s descr of undocumented funcs
Father Chrysostomos [Mon, 22 Aug 2011 16:33:00 +0000 (09:33 -0700)]
Revise perlintern’s descr of undocumented funcs

13 years agoperlfaq: remove 1 link; correct another
Father Chrysostomos [Mon, 22 Aug 2011 15:38:27 +0000 (08:38 -0700)]
perlfaq: remove 1 link; correct another

A link from the document to itself is not useful.
C<perldoc> should be L<perldoc>.

13 years agoAdd quick note to perlfaq main page about searching the perlfaq
Matthew Horsfall [Mon, 1 Aug 2011 00:18:57 +0000 (20:18 -0400)]
Add quick note to perlfaq main page about searching the perlfaq

13 years agoUpdate Archive-Extract to CPAN version 0.54
Chris 'BinGOs' Williams [Mon, 22 Aug 2011 12:45:56 +0000 (13:45 +0100)]
Update Archive-Extract to CPAN version 0.54

  [DELTA]

  Changes for 0.54    Mon Aug 22 11:52:18 2011
  ============================================
  * Resolve issues on MSWin32 when 'unzip' is
    found in PATH

13 years agoRemove user-defined casing feature
Karl Williamson [Sun, 21 Aug 2011 17:49:28 +0000 (11:49 -0600)]
Remove user-defined casing feature

This feature was deprecated in 5.14 and scheduled to remove in 5.16.  A
CPAN module was written to provide better functionality without the
significant drawbacks of this implementation.

13 years agoskip a test that requires Cwd under miniperl
Tony Cook [Mon, 22 Aug 2011 14:16:42 +0000 (00:16 +1000)]
skip a test that requires Cwd under miniperl

13 years agoskip the defined *+ and *- tests on miniperl
Tony Cook [Mon, 22 Aug 2011 13:44:19 +0000 (23:44 +1000)]
skip the defined *+ and *- tests on miniperl

using either attempts to load Tie::Hash::NamedCapture which may not be
available in miniperl.

13 years agoFix Configure's csym test for gcc's link time optimisation
H.Merijn Brand [Mon, 22 Aug 2011 13:41:26 +0000 (15:41 +0200)]
Fix Configure's csym test for gcc's link time optimisation

This introduces a volatile into the test program so gcc cannot optimise
out the symbol itself as being unused.

13 years agoboot_Win32CORE needs to be XS_EXTERNAL() following commit ab1478f7146843f7.
Nicholas Clark [Mon, 22 Aug 2011 04:38:32 +0000 (06:38 +0200)]
boot_Win32CORE needs to be XS_EXTERNAL() following commit ab1478f7146843f7.

Win32CORE.c is shipped as a C file, not built by ExtUtils::ParseXS, so needs
to be manually updated to reflect the change of default in XSUB.h

13 years agoAdd tests for defined(*builtin)
Father Chrysostomos [Mon, 22 Aug 2011 05:51:56 +0000 (22:51 -0700)]
Add tests for defined(*builtin)

This commit tests that GVs containing built-in variables that are usu-
ally created lazily pop into existence when looked at, as the fact
they didn’t exist is something we want to hide.

13 years agoMake rv2gv return autovivified magic GVs
Father Chrysostomos [Mon, 22 Aug 2011 05:14:55 +0000 (22:14 -0700)]
Make rv2gv return autovivified magic GVs

There is special code in pp_rv2gv to deal with the case of built-in
variables that are created on the fly.  It basically pretends that
they have always existed, even in rvalue context.

Normally, defined(*{"foo"}) will not actually create the *foo glob,
but will simply return false.  defined(*{">"}), however is supposed
to return true because of the $> variable; its popping into existing
when looked at being an implementation detail.  That is the whole pur-
pose of is_gv_magical_sv in gv.c.

Prior to this commit, however, defined(*{">"}) would autovivify the
GV, but then return *false*!

It was simply a matter of faulty logic in this part of pp_rv2gv:

SV * const temp = MUTABLE_SV(gv_fetchsv(sv, 0, SVt_PVGV));
if (!temp
    && (!is_gv_magical_sv(sv,0)
|| !(sv = MUTABLE_SV(gv_fetchsv(sv, GV_ADD,
SVt_PVGV))))) {
    RETSETUNDEF;
}
sv = temp;

The autovivification happens in the second gv_fetchsv call.  But after
the new GV is assigned to sv and the condition proves false, we reach
the sv = temp assignment which clobbers it.

13 years agoMake defined(${'$'}) return true
Father Chrysostomos [Mon, 22 Aug 2011 03:43:21 +0000 (20:43 -0700)]
Make defined(${'$'}) return true

Commit 0e219455 made $$ into a magical variable that is not created
on startup.

Usually perl pretends that built-in vars created on the fly have
always existed.  But commit 0e219455 did not add $$ to the list of
such variables in is_gv_magical_sv.  So defined ${'$'} started return-
ing false.

13 years agoRemove obsolete paragraph from perlintern/is_gv_magical_sv
Father Chrysostomos [Mon, 22 Aug 2011 03:21:11 +0000 (20:21 -0700)]
Remove obsolete paragraph from perlintern/is_gv_magical_sv

This paragraph, added in 2004 by commit b9b0e72c, was made obsolete in
2008 by commit 9d8f40c4.

13 years agoAdd tests for unlink
Father Chrysostomos [Mon, 22 Aug 2011 03:09:44 +0000 (20:09 -0700)]
Add tests for unlink

13 years agoMake unlink with implicit $_ work once more
Father Chrysostomos [Mon, 22 Aug 2011 02:58:43 +0000 (19:58 -0700)]
Make unlink with implicit $_ work once more

I broke this with commit ea5703f4.  unlink is the only op that has the
OA_DEFGV flag and no scalar or file arguments.

Commit ea5703f4 changed the OA_DEFGV logic in ck_fun to generate a
new $_ op for the first optional parameter, instead of just the first
parameter, to avoid special-casing unpack.  But lists are not marked
with OA_OPTIONAL.  So this commit changes it to check for list parame-
ters as well.

13 years agoMention the 5.14 and 5.15 tracks.
Abigail [Sun, 21 Aug 2011 21:57:37 +0000 (23:57 +0200)]
Mention the 5.14 and 5.15 tracks.

This was done for other previous tracks as well.

13 years agoChangelog/version bump for ExtUtils::ParseXS
Steffen Mueller [Sun, 21 Aug 2011 11:35:43 +0000 (13:35 +0200)]
Changelog/version bump for ExtUtils::ParseXS

Upgrade version in Maintainers.pl.

13 years agoMake sure to strip trailing semicolons from inputmap
Steffen Mueller [Sun, 21 Aug 2011 11:35:14 +0000 (13:35 +0200)]
Make sure to strip trailing semicolons from inputmap

If we don't get that right, there may be additional semicolons in
the output C code. Those will be interpreted as empty statements
which is a problem for strict/old compilers which require strict
separation of declarations and other code.

Reported by Torsten Schoenfeld, diagnosed by Thorsten and Jan Dubois.

13 years agoFix C++ build following commit ab1478f7146843f7.
Nicholas Clark [Sun, 21 Aug 2011 12:55:28 +0000 (14:55 +0200)]
Fix C++ build following commit ab1478f7146843f7.

For C++, ab1478f7146843f7 inadvertently defined XS_INTERNAL as
    extern "C" static ...
which C++ compilers rightfully choke on.

13 years agoBump $ExtUtils::ParseXS::VERSION following commit 948e998797279292.
Nicholas Clark [Sun, 21 Aug 2011 12:37:22 +0000 (14:37 +0200)]
Bump $ExtUtils::ParseXS::VERSION following commit 948e998797279292.

13 years agoadd the 5.15.2 epigraph
Ricardo Signes [Sun, 21 Aug 2011 11:43:21 +0000 (07:43 -0400)]
add the 5.15.2 epigraph

13 years agoMake the use of XS_EXTERNAL fall back to XS
Steffen Mueller [Thu, 18 Aug 2011 11:20:35 +0000 (13:20 +0200)]
Make the use of XS_EXTERNAL fall back to XS

If XSUB.h/perl doesn't define the new XS_EXTERNAL macro that we
use for emitting non-static XSUBs for the boot functions, we have
XS_EXTERNAL just fall back to the standard XS macro.

13 years agoPerldelta for static XSUBs
Steffen Mueller [Fri, 12 Aug 2011 17:13:09 +0000 (19:13 +0200)]
Perldelta for static XSUBs

13 years agoMake XSUBs static by default
Steffen Mueller [Fri, 12 Aug 2011 15:28:33 +0000 (17:28 +0200)]
Make XSUBs static by default

At the same time, do not include "STATIC" in XSPROTO and
get rid of the XSPROTO_INTERNAL and XSPROTO_EXTERNAL macros
because of that. This allows Devel::PPPort to continue doing
its evil typedef'ing magic using XSPROTO.

13 years agoExlicitly enable exporting of some XSUB symbols
Steffen Mueller [Fri, 12 Aug 2011 15:27:00 +0000 (17:27 +0200)]
Exlicitly enable exporting of some XSUB symbols

These are used in other compilation units. The declarations there
use the XS_EXTERNAL macro to indicate an non-static XSUB that is
taken from another object file.

13 years agoNew XS keyword: EXPORT_XSUB_SYMBOLS
Steffen Mueller [Fri, 12 Aug 2011 15:13:03 +0000 (17:13 +0200)]
New XS keyword: EXPORT_XSUB_SYMBOLS

This can be used to enable/disable the exporting of XSUB symbols.
Technically and at least as far as the documentation change is
concerned, this change goes together with the upcoming change
to XSUB.h to make not exporting the XSUB symbols the default.
It's harmless if a bit useless without that.

In the original plan for making XSUBs "static", there wouldn't have
been a public and easy way to make XSUBs exported from XS code
without resorting to manually redefining macros. But since even in
just the core set of modules, simple things break, I think it's best
to expose this bit of choice.

13 years agoRefactor unpack’s newDEFSVOP logic; correct prototype
Father Chrysostomos [Sun, 21 Aug 2011 08:37:42 +0000 (01:37 -0700)]
Refactor unpack’s newDEFSVOP logic; correct prototype

unpack is the only op that takes an implicit $_ for its second argu-
ment.  (For others it’s the first.)

Instead of special-casing unpack with its own ck_ routine, we can sim-
ply modify the logic in ck_fun to apply OA_DEFGV to the first optional
argument, not just the first argument.

Currently OA_DEFGV is not set in PL_opargs[OP_UNPACK], which means the
automatically-generated prototype is ($;$), instead of ($_).

This commit sets the flag on the op, changes it to use ck_fun
directly, and updates ck_fun and the prototype-generation code accord-
ingly.  I couldn’t put this in multiple commits, as the changes are
interdependent.

13 years agoCorrect test in defins.t
Father Chrysostomos [Sun, 21 Aug 2011 08:26:37 +0000 (01:26 -0700)]
Correct test in defins.t

defined(FILE) does not work.  This test ‘passed’ for me, even when
I broke it.

13 years agoTest unpack with no args
Father Chrysostomos [Sun, 21 Aug 2011 06:49:11 +0000 (23:49 -0700)]
Test unpack with no args

to make sure subsequent commits don’t break things.

13 years ago[perl #96000] Apply standard copyright license statement
Dominic Hargreaves [Sat, 20 Aug 2011 14:44:13 +0000 (15:44 +0100)]
[perl #96000] Apply standard copyright license statement

The original authors have agreed to alter the licensing of these
files, in order to remove a potentially problematic invariant
title clause:

From: Doug MacEachern <dougm@…..com>
To: Jon Orwant <orwant@….com>
Cc: Jesse Vincent <jesse@fsck.com>
Subject: Re: [fwd] [perl #96000] Restrictive licensing term on pod/perlembed.pod, pod/perlmodinstall.pod
Message-ID: <1dc71b53-12e2-45d3-af62-f6d169147921@ox.local>
In-Reply-To: <CAJs5hDaW+k6mf_NBj-6hPyr4rGvkEjhVtXyJ8ziLXyXimcvgHA@mail.gmail.com>

Any license changes to perlembed.pod are fine with me.

Or just revert to the original version of the document: "Look at perlmain.c, and do something like that." ;)

Best,
-Doug

----- Original Message -----
> From: "Jon Orwant" <orwant@….com>
> To: "Jesse Vincent" <jesse@fsck.com>
> Cc: dougm@….com
> Sent: Sunday, July 31, 2011 7:38:49 PM
> Subject: Re: [fwd] [perl #96000] Restrictive licensing term on pod/perlembed.pod, pod/perlmodinstall.pod
>
> Sure, happy to relicense.
>
>
> Jon
>
>
> On Sun, Jul 31, 2011 at 4:03 PM, Jesse Vincent < jesse@fsck.com >
> wrote:
>
>
> Hi Doug & Jon,
>
> I know it's been forever since you last touched the perl core-
>
> It looks like the Debian folks would like us to relax the licensing
> terms on docs that bear your copyrights.
>
> Would you be willing to relicense the contributions you made to the
> two
> documents listed below under the same terms as the rest of Perl?
>
> Thanks!
> Jesse
> --

13 years agoupdate TOC for perl5153delta
Ricardo Signes [Sun, 21 Aug 2011 00:38:03 +0000 (20:38 -0400)]
update TOC for perl5153delta

13 years agocreate perldelta.pod for 5.12.3
Ricardo Signes [Sun, 21 Aug 2011 00:29:58 +0000 (20:29 -0400)]
create perldelta.pod for 5.12.3

13 years agoadd new release to perlhist
Ricardo Signes [Sat, 20 Aug 2011 18:58:36 +0000 (14:58 -0400)]
add new release to perlhist

13 years agoremove boilerplate text from perldelta
Ricardo Signes [Sat, 20 Aug 2011 18:25:58 +0000 (14:25 -0400)]
remove boilerplate text from perldelta

13 years agoupdate perldelta for release;
Ricardo Signes [Sat, 20 Aug 2011 18:11:18 +0000 (14:11 -0400)]
update perldelta for release;

In particular, note the addition of the coreargs opcode in perldelta

We might have no need of this entry in the perl5160 delta, but for
those brave enough to read 5.15.2 delta, it may be of interest.

13 years agoWIP
Ricardo Signes [Sat, 20 Aug 2011 18:57:02 +0000 (14:57 -0400)]
WIP

13 years agoUpdate Module::CoreList for 5.x.y
Ricardo Signes [Sat, 20 Aug 2011 18:56:49 +0000 (14:56 -0400)]
Update Module::CoreList for 5.x.y

13 years agobump version to 5.12.2 using Porting/bump-perl-version
Ricardo Signes [Sat, 20 Aug 2011 18:14:51 +0000 (14:14 -0400)]
bump version to 5.12.2 using Porting/bump-perl-version

13 years ago&CORE::fork()
Father Chrysostomos [Sat, 20 Aug 2011 06:29:53 +0000 (23:29 -0700)]
&CORE::fork()

In commit 7fa5bd9b5, I not only forgot about getpwent (see commit
cc131e4, in which I mistakenly called it pwent), but fork as well.
Again, all this commit has to do is add it to the list of ‘ampable’
functions in gv.c.  The rest already works.

13 years agoAdd OPpASSIGN_CV_TO_GV to B::Concise
Father Chrysostomos [Fri, 19 Aug 2011 20:33:15 +0000 (13:33 -0700)]
Add OPpASSIGN_CV_TO_GV to B::Concise

13 years agoAdd OPpDONT_INIT_GV to B::Concise
Father Chrysostomos [Fri, 19 Aug 2011 20:13:24 +0000 (13:13 -0700)]
Add OPpDONT_INIT_GV to B::Concise

13 years agopp.c:pp_rv2gv: Skip amagic check when vivifying a glob
Father Chrysostomos [Fri, 19 Aug 2011 19:27:03 +0000 (12:27 -0700)]
pp.c:pp_rv2gv: Skip amagic check when vivifying a glob

Commit bb1bc619 eliminated the only case that ‘goto wasref’ is called
with something that might have overloading.  The only ‘goto wasref’
that remains is the autovivifying case, which cannot have any magic
(since the GV has just been created).  So the wasref label can be
moved below the amagic check.

Consider this a picoöptimisation.

13 years ago&CORE::pwent()
Father Chrysostomos [Fri, 19 Aug 2011 13:54:29 +0000 (06:54 -0700)]
&CORE::pwent()

In commit 7fa5bd9b5, I forgot about pwent.  All this commit has
to do is add it to the list of ‘ampable’ functions in gv.c.  The
rest already works.

13 years agoIgnore ExtUtils::Manifest's release tests in the core
Florian Ragwitz [Fri, 19 Aug 2011 12:22:08 +0000 (15:22 +0300)]
Ignore ExtUtils::Manifest's release tests in the core

13 years agoUpgrade ExtUtils::Manifest from version 1.59 to 1.60
Florian Ragwitz [Fri, 19 Aug 2011 12:08:40 +0000 (15:08 +0300)]
Upgrade ExtUtils::Manifest from version 1.59 to 1.60

13 years agoSwap the release suckers for 5.15.3 and 5.15.4
Florian Ragwitz [Fri, 19 Aug 2011 11:14:37 +0000 (14:14 +0300)]
Swap the release suckers for 5.15.3 and 5.15.4

Turns out I mixed things up and would've had to do two releases in one month,
which is probably not a good idea. Stevan was happy to do his release a month
earlier.

13 years agoperldelta for perl #97010
Father Chrysostomos [Thu, 18 Aug 2011 16:20:22 +0000 (09:20 -0700)]
perldelta for perl #97010

13 years ago[perl #97020] Carp (actually caller) leaking memory
Father Chrysostomos [Thu, 18 Aug 2011 15:50:02 +0000 (08:50 -0700)]
[perl #97020] Carp (actually caller) leaking memory

Commit eff7e72c3 (Detect incomplete caller overrides in Carp) used
this little trick for detecting a @DB::args that an overridden
caller() failed to set:

+  @args = \$i; # A sentinal, which no-one else has the address of

But there is a bug in caller().  The first time caller tries to write
to @DB::args, it calls Perl_init_dbargs first.  That function checks
whether @DB::args is AvREAL, in case someone has assigned to it, and
takes appropriate measures.  But caller doesn’t bother calling
Perl_init_dbargs more than once.  So manually-assigned items in
@DB::args would leak, starting with the *second* call to caller.

Commit eff7e72c3 triggered that bug, resulting in a regression in
Carp, in that it started leaking.  eff7e72c3 was backported to 5.12.2
with commit 97705941a4, so in both 5.12 and 5.14 Carp is affected.

This bug (the caller bug, not Carp’s triggering thereof) also affects
any caller overrides that set @DB::args themselves, if there are
alternate calls to the overridden caller and CORE::caller.

This commit fixes that by changing the if (!PL_dbargs) condition
in pp_caller to if (!PL_dbargs || AvREAL(PL_dbargs)).  I.e., if
@args is either uninitialised or AvREAL then call Perl_init_dbargs.
Perl_init_dbargs also has a bug in it, that this fixes: The array not
only needs AvREAL turned off, but also AvREIFY turned on, so that
assignments to it that occur after its initialisation turn AvREAL back
on again.  (In fact, Larry Wall added a comment suggesting this back
in perl 5.000.)

13 years agoUpdate perldiag/&CORE::%s cannot be called directly
Father Chrysostomos [Thu, 18 Aug 2011 15:51:28 +0000 (08:51 -0700)]
Update perldiag/&CORE::%s cannot be called directly

Something I missed in commit d47dcd9c7

13 years agoDocument &CORE::nullary() calls
Father Chrysostomos [Thu, 18 Aug 2011 05:25:39 +0000 (22:25 -0700)]
Document &CORE::nullary() calls

13 years ago&CORE::wantarray()
Father Chrysostomos [Thu, 18 Aug 2011 05:10:30 +0000 (22:10 -0700)]
&CORE::wantarray()

This commit allows &CORE::wantarray to be called via ampersand syntax
or through references.

It adds a new private flag for wantarray, OPpOFFBYONE, which caller\rwill use as well, telling wantarray (or caller) to look one call fur-
ther up the call stack.

13 years ago&CORE::foo() for nullary functions
Father Chrysostomos [Wed, 17 Aug 2011 19:32:33 +0000 (12:32 -0700)]
&CORE::foo() for nullary functions

This commit makes nullary subs in the CORE package callable with
ampersand syntax and through references--except for wantarray, which
is more complicated and will have its own commit.

It does this by creating an op tree like this:

$ ./perl -Ilib -MO=Concise,CORE::times -e 'BEGIN{\&CORE::times}'
CORE::times:
3  <1> leavesub[1 ref] K/REFC,1 ->(end)
-     <@> lineseq K ->3
1        <$> coreargs(IV 310) v ->2
2        <0> tms ->3
-e syntax OK

The coreargs op checks to make sure there are no arguments, for now.
The 310 is the op number for times (OP_TMS).

There is no nextstate op, because we want to inherit hints from
the caller.

The __FILE__, __LINE__ and __PACKAGE__ directives are implemented
like this:

$ ./perl -Ilib -MO=Concise,CORE::__FILE__ -e 'BEGIN{\&CORE::__FILE__}'
CORE::__FILE__:
7  <1> leavesub[1 ref] K/REFC,1 ->(end)
-     <@> lineseq K ->7
1        <$> coreargs(PV "__FILE__") v ->2
6        <2> lslice K/2 ->7
-           <1> ex-list lK ->4
2              <0> pushmark s ->3
3              <$> const(IV 1) s ->4
-           <1> ex-list lK ->6
4              <0> pushmark s ->5
5              <0> caller[t1] l ->6
-e syntax OK

The lslice op and its children are equivalent to (caller)[1].

13 years agoAdd coreargs op
Father Chrysostomos [Wed, 17 Aug 2011 01:02:33 +0000 (18:02 -0700)]
Add coreargs op

&CORE::foo subs will use this operator for sorting out @_.

13 years agorafl has accepted the burden of a maint release.
Jesse Vincent [Thu, 18 Aug 2011 06:52:18 +0000 (09:52 +0300)]
rafl has accepted the burden of a maint release.

13 years agoDave Cross has been volunteered for a blead release
Jesse Vincent [Thu, 18 Aug 2011 06:52:01 +0000 (09:52 +0300)]
Dave Cross has been volunteered for a blead release

13 years agoCorrect spelling of Kaňkovský
Father Chrysostomos [Wed, 17 Aug 2011 21:35:19 +0000 (14:35 -0700)]
Correct spelling of Kaňkovský

13 years ago[perl #96126] Allocate CvFILE more simply
Father Chrysostomos [Tue, 16 Aug 2011 21:57:47 +0000 (14:57 -0700)]
[perl #96126] Allocate CvFILE more simply

See the thread starting at:
http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg175161.html

Instead of assuming that only Perl subs have mallocked CvFILEs and
only under threads, resulting in various hackery to borrow parts of
the SvPVX buffer where that assumption proves wrong, we can simply
add another flag (DYNFILE) to indicate whether CvFILE is mallocked,
instead of trying to use the ISXSUB flag for two purposes.

This simplifies the code greatly, eliminating bug #96126 in the pro-
cess (which had to do with sv_dup not knowing about the hackery that
this commit removes).

I removed that comment from cv_ckproto_len about CONSTSUBs doubling up
the buffer field, as it is no longer relevant.  But I still left the
code as it is, since it’s better to do an explicit length check.

13 years agoAdd Max as a release victim
Jesse Vincent [Wed, 17 Aug 2011 10:04:54 +0000 (13:04 +0300)]
Add Max as a release victim

13 years agoUpdate AUTHORS following commit f5458e3a4f.
Steve Hay [Tue, 16 Aug 2011 17:28:54 +0000 (18:28 +0100)]
Update AUTHORS following commit f5458e3a4f.

13 years agoFix tabbing from commit f5458e3a4f and bump IO::Handle version.
Steve Hay [Tue, 16 Aug 2011 17:26:39 +0000 (18:26 +0100)]
Fix tabbing from commit f5458e3a4f and bump IO::Handle version.

13 years agoFix setting sockets nonblocking in Win32
Stephen Oberholtzer [Tue, 16 Aug 2011 13:35:54 +0000 (09:35 -0400)]
Fix setting sockets nonblocking in Win32

13 years agoMerge branch 'blead' of ssh://perl5.git.perl.org/perl into blead
Jesse Vincent [Tue, 16 Aug 2011 07:53:53 +0000 (10:53 +0300)]
Merge branch 'blead' of ssh://perl5.git.perl.org/perl into blead

* 'blead' of ssh://perl5.git.perl.org/perl:
  [perl #97076] Fix mad+threads bareword strict exemption
  perldelta update
  Two AUTHORS fixes
  Remove OPpENTERSUB_NOMOD from B::Concise
  Remove OPpENTERSUB_NOMOD.
  Propagate lvalue context only to children of list ops which are not in void context.
  Fix tabbing and trailing whitespace from commit f1d35e3443 and bump IO::Socket version.
  Use the exception set in select (connect()) to early return when remote end is busy or in non existing port
  generic perldelta entry for prototype changes
  &CORE::not and &CORE::getprotobynumber
  Give not and getprotobynumber listop prototypes
  Document and test $; prototype syntax
  Move checking of CV to GV assigned (OPpASSIGN_CV_TO_GV) from the peephole optimizer to scalarvoid

13 years agoRestore (and slightly update) documentation about The Rules and the
Jesse Vincent [Tue, 16 Aug 2011 07:46:33 +0000 (10:46 +0300)]
Restore (and slightly update) documentation about The Rules and the
structure of Perl 5 governance removed during the major refactoring
of perlhack.pod in 04c692a854b61dfae1266e29468ce4fb51c80512.

13 years agoAdd another explicit synonym for the porters.
Jesse Vincent [Tue, 16 Aug 2011 07:46:12 +0000 (10:46 +0300)]
Add another explicit synonym for the porters.

13 years ago[perl #97076] Fix mad+threads bareword strict exemption
Father Chrysostomos [Tue, 16 Aug 2011 05:30:07 +0000 (22:30 -0700)]
[perl #97076] Fix mad+threads bareword strict exemption

As reported in the ticket this was broken by:

commit eb796c7f1a47acbd996034731639c1bb76e31a19
Author: Gerard Goossen <gerard@ggoossen.net>
Date:   Tue Aug 9 20:35:06 2011 +0200

    Move bareword checking from the peephole optimizer to finalize_optree. Fixes [perl #95998]

    The bareword checking is moved from the peephole optimizer to finalize_optree.
    newRANGE needs additional bareword checking because the constants may
    be optimized away by 'gen_constant_list'.
    The OPpCONST_STRICT flag is removed after giving an error about a
    bareword to prevent giving multiple errors about the same bareword.

In some cases, like pipe(foo,bar), the bareword was subject to strict
'subs' even though it was meant to be exempt.

A backtrace revealed that it happened in S_finalize_op when called
recursively from this block:

#if defined(PERL_MAD) && defined(USE_ITHREADS)
    {
/* Make sure mad ops are also thread-safe */
MADPROP *mp = o->op_madprop;
while (mp) {
    if (mp->mad_type == MAD_OP && mp->mad_vlen) {
OP *prop_op = (OP *) mp->mad_val;
/* We only need "Relocate sv to the pad for thread safety.", but this
   easiest way to make sure it traverses everything */
finalize_op(prop_op);
    }
    mp = mp->mad_next;
}
    }
#endif

That comment about only needing to relocate the sv to the pad is
telling.  If that’s the only reason for the recursive call, then
we don’t want that recursive call doing strict checking.  So this
commit simply turns off the strict flag, which should be safe, since
S_no_bareword_allowed does the same thing itself.

13 years agoperldelta update
Father Chrysostomos [Tue, 16 Aug 2011 04:47:33 +0000 (21:47 -0700)]
perldelta update

13 years agoTwo AUTHORS fixes
Father Chrysostomos [Mon, 15 Aug 2011 21:50:54 +0000 (14:50 -0700)]
Two AUTHORS fixes

• Correct Kankovský
• Add Karthik Rajagopalan

13 years agoRemove OPpENTERSUB_NOMOD from B::Concise
Father Chrysostomos [Tue, 16 Aug 2011 00:52:10 +0000 (17:52 -0700)]
Remove OPpENTERSUB_NOMOD from B::Concise

13 years agoRemove OPpENTERSUB_NOMOD.
Gerard Goossen [Sat, 13 Aug 2011 16:51:48 +0000 (18:51 +0200)]
Remove OPpENTERSUB_NOMOD.

OPpENTERSUB_NOMOD was always set in combination with OPf_WANT_VOID
which is now used to not propagate the lvalue context, making
OPpENTERSUB_NOMOD redundant.

13 years agoPropagate lvalue context only to children of list ops which are not in void context.
Gerard Goossen [Sat, 13 Aug 2011 16:38:13 +0000 (18:38 +0200)]
Propagate lvalue context only to children of list ops which are not in void context.

Children list ops might be in void context because the list is in scalar
context. A test that discarded elements in a list are not assigned lvalue
context is added.
Children of a list op might also be in void context because they are
special entersub ops for attributes. This patch makes the
OPpENTERSUB_NOMOD flag redundant.

13 years agoFix tabbing and trailing whitespace from commit f1d35e3443
Steve Hay [Mon, 15 Aug 2011 20:30:41 +0000 (21:30 +0100)]
Fix tabbing and trailing whitespace from commit f1d35e3443
and bump IO::Socket version.

13 years agoUse the exception set in select (connect()) to early return when remote end is busy...
Karthik Rajagopalan [Thu, 14 Jul 2011 17:36:41 +0000 (13:36 -0400)]
Use the exception set in select (connect()) to early return when remote end is busy or in non existing port

For non blocking socket, it a timeout has been specified, IO::Socket internally use select(..) to
detect the result of socket connection. In situation, where remote end is busy or in non-existing port, we spend
entire timeout mentioned in select(..) call. We cannot completely differentiate if error is WSAECONNREFUSED(10061) or
WSAETIMEDOUT(10060) in this situation. If we use the exception set in select(..) call, we can do early return and also
a make a clear differentiation in error condition. This is same like what Linux handle in this situation.

13 years agogeneric perldelta entry for prototype changes
Father Chrysostomos [Mon, 15 Aug 2011 19:45:28 +0000 (12:45 -0700)]
generic perldelta entry for prototype changes

13 years ago&CORE::not and &CORE::getprotobynumber
Father Chrysostomos [Mon, 15 Aug 2011 16:28:51 +0000 (09:28 -0700)]
&CORE::not and &CORE::getprotobynumber

These two are now supported.  They were not before, because their
prototypes gave them unary precedence, even though these ops both
have list precedence.  That was corrected in the previous commit.

13 years agoGive not and getprotobynumber listop prototypes
Father Chrysostomos [Mon, 15 Aug 2011 16:23:50 +0000 (09:23 -0700)]
Give not and getprotobynumber listop prototypes

They parse as list operators, but their prototypes imply unop
precedence.

13 years agoDocument and test $; prototype syntax
Father Chrysostomos [Mon, 15 Aug 2011 16:20:08 +0000 (09:20 -0700)]
Document and test $; prototype syntax

This has worked this way for yonks.  It is actually useful, so it might
as well be documented.

13 years agoMove checking of CV to GV assigned (OPpASSIGN_CV_TO_GV) from the peephole optimizer...
Gerard Goossen [Tue, 9 Aug 2011 19:33:27 +0000 (21:33 +0200)]
Move checking of CV to GV assigned (OPpASSIGN_CV_TO_GV) from the peephole optimizer to scalarvoid

13 years agoMerge branch 'blead' of ssh://perl5.git.perl.org/perl into blead
Jesse Vincent [Mon, 15 Aug 2011 19:20:53 +0000 (22:20 +0300)]
Merge branch 'blead' of ssh://perl5.git.perl.org/perl into blead

* 'blead' of ssh://perl5.git.perl.org/perl: (198 commits)
  CORE.pod: fix nit grammar
  podcheck.t pod grammar fix
  Make lock(&foo) syntax nominally lock the subroutine
  Forgot one in d677d0fca41325ba7203de00652fdeb43659754a.
  Write some missing version strings in configure.com
  Correct some format strings in configure.com.
  Improve comments about op_private bits. And move the non op specific flags to the top.
  get authors.t passing again
  Update AUTHORS file and convert from Latin-1 to UTF-8
  perldiag.pod on defined %hash
  perldelta for &CORE::foo
  Update core_prototype’s docs
  Move pp_-specific code out of core_prototype
  Change core_prototype to take a keyword num
  Add tests for precedence of CORE:: subs
  Add inlinable &CORE::functions
  Make core_prototype provide the op number as well
  Make sure the CORE package is always called CORE
  Remove select’s prototype
  B::Terse and B::Xref were missing some documentation.
  ...

13 years agoAdd Abigail as a release manager
Jesse Vincent [Mon, 15 Aug 2011 19:20:23 +0000 (22:20 +0300)]
Add Abigail as a release manager

13 years agoCORE.pod: fix nit grammar
Karl Williamson [Mon, 15 Aug 2011 15:01:27 +0000 (09:01 -0600)]
CORE.pod: fix nit grammar

13 years agopodcheck.t pod grammar fix
Karl Williamson [Wed, 10 Aug 2011 15:47:28 +0000 (09:47 -0600)]
podcheck.t pod grammar fix

13 years agoMake lock(&foo) syntax nominally lock the subroutine
Father Chrysostomos [Mon, 15 Aug 2011 02:16:14 +0000 (19:16 -0700)]
Make lock(&foo) syntax nominally lock the subroutine

In 5.10, lock(&foo) was an error for non-lvalue subs.  For lvalue
subs, it passed &foo to the lockhook and return \&foo.

In 5.12, lock(&foo) was still an error for non-lvalue subs.  For
lvalue subs, it would pass &foo to the lockhook and then either
trip an assertion (-DDEBUGGING) or return &foo, resulting in inter-
esting bugs.

Commit f4df43b5e changed lock(&lvalue_sub) to call the sub and lock
its return value.

As Reini Urban pointed out in
<CAHiT=DE5cVZbuCR3kb=Q5oCa18vo3jr5jZKmURHYha2PwF4pEQ@mail.gmail.com>,
locking a subroutine does have its uses.

Since lock(&foo) has never really worked anyway, we can still
change this.

So, for lvalue subs, this reverts back to the 5.10 behaviour.  For
non-lvalue subs, it now behaves the same way, the lvalue flag making
no difference.  Note that it still causes an error at run-time, if
threads::shared is loaded, as its lockhook is conservative in what
it accepts.

But this change allows for future extensibility, unlike f4df43b5e.

A note about the implementation: There are two pieces of code (at
least) in op.c that convert an entersub op into an rv2cv, one in
S_doref and the other in Perl_op_lvalue_flags.  Originally (before
f4df43b5e) it was S_doref that took care of that for OP_LOCK.  But
Perl_op_lvalue_flags is called first, so it would assume it was an
assignment to a sub call and croak if there was no lvalue sub in the
symbol table.  This commit adds back the special case for OP_LOCK, but
in Perl_op_lvalue_flags, not S_doref.

13 years agoForgot one in d677d0fca41325ba7203de00652fdeb43659754a.
Craig A. Berry [Mon, 15 Aug 2011 03:04:09 +0000 (22:04 -0500)]
Forgot one in d677d0fca41325ba7203de00652fdeb43659754a.