This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
12 years ago[perl #63558] Deparse open local(*FH) correctly
Father Chrysostomos [Thu, 8 Dec 2011 17:58:44 +0000 (09:58 -0800)]
[perl #63558] Deparse open local(*FH) correctly

open FH and open local(*FH) compile down to the same structure
(open *FH), but with a flag set on the rv2gv (*{}) op for the
local case.

B::Deparse was special-casing rv2gv for ops with * in their prototype,
but without consideration for the flag.

12 years agoDeparse dump as CORE::dump
Father Chrysostomos [Thu, 8 Dec 2011 17:34:04 +0000 (09:34 -0800)]
Deparse dump as CORE::dump

Since dump() warns without CORE::, and since the two variants are
indistinguishable after compilation, always deparse dump() as
CORE::dump.

12 years agoDeparse filetest ops without llafr
Father Chrysostomos [Thu, 8 Dec 2011 17:30:31 +0000 (09:30 -0800)]
Deparse filetest ops without llafr

Before this commit, (-e $_) + 72 deparsed incorrectly, because it
became -e($_) + 72, equivalent to -e ($_+72).

Concerning the removed comment, it’s more important to produce correct
code than nice-looking code.

12 years agoFix use VERSION test failures under PERL_UNICODE
Father Chrysostomos [Thu, 8 Dec 2011 16:42:31 +0000 (08:42 -0800)]
Fix use VERSION test failures under PERL_UNICODE

use VERSION now checks whether HINT_LOCALIZE_HH is set, which indi-
cates that %^H has been modified.  If it is set, it does ‘no feature’
first, regardless of the version number.

Some tests were checking that feature.pm is not loaded for use 5.8.8.
Now it is sometimes, particularly if PERL_UNICODE has been set, as it
adds keys to %^H.

For now, I’ve tweaked the tests.  It would be nice if version declara-
tions could load and unload features without loading feature.pm, just
as they do with strictures.

12 years agoDeparse CORE::do+{} and CORE::do({}) correctly
Father Chrysostomos [Thu, 8 Dec 2011 14:24:53 +0000 (06:24 -0800)]
Deparse CORE::do+{} and CORE::do({}) correctly

Commit 94bb57f91b missed the CORE:: variant.

12 years agoFix deparsing of "" =~ <any OPf_SPECIAL op>
Father Chrysostomos [Thu, 8 Dec 2011 06:13:50 +0000 (22:13 -0800)]
Fix deparsing of "" =~ <any OPf_SPECIAL op>

This is a regression in 5.14.

$ ./perl -Ilib -MO=Deparse -e '"" =~ do{}'
'' =~ ($_ =~ do {
    ()
});
-e syntax OK

Commit a539498ab05 fixed the deparsing of "foo" =~ (1?/foo/:/bar/),
in which /foo/ is implicitly bound to $_.  Due to constant folding,
the whole condition expression is reduced to "foo" =~ /foo/, but with
/foo/ still bound to $_.  /foo/ is marked OPf_SPECIAL, which allows
us to distinguish the cases.  The fix, which added "$_ =~" explic-
itly, did not check that the op was a match op, so any op on the rhs
with the OPf_SPECIAL flag set could trigger the same special case.

12 years agoDeparse.pm: More functions that do not follow llafr
Father Chrysostomos [Thu, 8 Dec 2011 06:40:28 +0000 (22:40 -0800)]
Deparse.pm: More functions that do not follow llafr

See the previous commit.

Again, whether we apply the llafr to loop exits shouldn’t be about
whether parentheses look nice, but whether the final code parses
correctly.

12 years ago[perl #77096] Deparse return and do without llafr
Father Chrysostomos [Thu, 8 Dec 2011 05:58:27 +0000 (21:58 -0800)]
[perl #77096] Deparse return and do without llafr

‘return’ and ‘do-file’ are exempt from the ‘looks-like-a-function
rule’ (llafr).

B::Deparse was intentionally ignoring that:

While it might produce nice-looking code, the final code compiles dif-
ferently in many cases, so we simply cannot ignore these ops’ disre-
gard for that rule.

12 years agodeparse.t: Add bug number
Father Chrysostomos [Wed, 7 Dec 2011 20:52:05 +0000 (12:52 -0800)]
deparse.t: Add bug number

12 years ago[perl #47361] Deparse do +{} and do({}) correctly
Father Chrysostomos [Wed, 7 Dec 2011 20:41:56 +0000 (12:41 -0800)]
[perl #47361] Deparse do +{} and do({}) correctly

These are both variants of do-file syntax.

12 years agoCorrect a bug in the previous commit (bb35dd48)
Nicholas Clark [Thu, 8 Dec 2011 13:02:39 +0000 (14:02 +0100)]
Correct a bug in the previous commit (bb35dd48)

The test in bisect-runner.pl for when to apply the fix of commit
c955f1177b2e311d was not correct - it would also attempt to apply the patch
to commit c955f1177b2e311d and later, not just to commits before
c955f1177b2e311d.

12 years agobisect-runner.pl now builds 42 more 5.005_5x releases.
Nicholas Clark [Wed, 7 Dec 2011 17:42:00 +0000 (18:42 +0100)]
bisect-runner.pl now builds 42 more 5.005_5x releases.

Commit 455ece5e082708b1, which added the SSNEW() macro, was buggy and needs
a fix from commit 3c8a44569607336e in order to avoid strange seemingly
unrelated SEGVs.

12 years agoTeach bisect-runner.pl how to build a significant PERL_OBJECT commit.
Nicholas Clark [Wed, 7 Dec 2011 15:41:21 +0000 (16:41 +0100)]
Teach bisect-runner.pl how to build a significant PERL_OBJECT commit.

Commit 22c35a8c2392967a is "phase 1 of somewhat major rearrangement of
PERL_OBJECT stuff" but doesn't build due to 2 simple errors. blead in this
broken state was merged to the cfgperl branch, and then these were
immediately corrected there. cfgperl (with the fixes) was merged back to
blead. The resultant rather twisty maze of commits completely confuses git
bisect (and at least me), causing it to the bisect run to confidently return
the wrong answer, an unrelated commit on the cfgperl branch.

12 years agobisect-runner.pl must patch an incorrect use of eaccess() for 5.005_5x
Nicholas Clark [Wed, 7 Dec 2011 13:37:52 +0000 (14:37 +0100)]
bisect-runner.pl must patch an incorrect use of eaccess() for 5.005_5x

Without this, 538 intermedidate revisions of 5.005_5x fail to build on
(at least) Linux.

12 years agoFix ext/B/t/f_map.t failure
Father Chrysostomos [Wed, 7 Dec 2011 20:27:25 +0000 (12:27 -0800)]
Fix ext/B/t/f_map.t failure

Tiny typo on my part.  Strangely, the tests passed for me before, so I
probably made a mistake in trying to switch branches.

12 years agoUpdate ExtUtils-ParseXS to CPAN version 3.07
Chris 'BinGOs' Williams [Wed, 7 Dec 2011 19:52:05 +0000 (19:52 +0000)]
Update ExtUtils-ParseXS to CPAN version 3.07

  [DELTA]

  3.07 - Wed Dec  7 14:10:00 CET 2011
    - Fix inconsistent versioning in 3.06.

  3.06 - Fri Dec  2 08:10:00 CET 2011

    - Fix Cygwin issues [Tony Cook]
      avoid conflicting static / dllexport on legacy perls too
      This probably fixes rt.cpan.org 72313 and 71964.
      (3928a66ad4bd8aee704eda1942b7877c0ff1ab2c in core)

    - Convert ` to ' [James Keenan]
      55bee391aeff3c3b8d22fa4ce5491ee9440028aa and
      6dfee1ec62c64d7afe8ced4650596dd9e7f71a63 in core

    - Avoid some test-time warnings [Zefram]
      97bae9c59cd181b3b54061213ec1fdce0ccb30d4 in core

12 years ago[perl #47359] Deparse method {$object} correctly
Father Chrysostomos [Wed, 7 Dec 2011 16:39:59 +0000 (08:39 -0800)]
[perl #47359] Deparse method {$object} correctly

The block is evaluated in list context, allowing things like
SUPER::glelp{@_} to work, so deparsing it as do{...}->method is wrong,
as it puts the block in scalar context.

12 years agoDeparse: detect hh changes properly
Father Chrysostomos [Wed, 7 Dec 2011 07:29:21 +0000 (23:29 -0800)]
Deparse: detect hh changes properly

The hack to check whether the hint hash has changed doesn’t work.  One
actually has to iterate through the hash.  Since declare_hinthash does
that already, just call it.

The change to declare_hinthash to return an empty list instead of ''
is one of those theoretical speed-ups.  It results in one less state-
ment and two fewer method calls in its caller.

12 years agoAdjust docs to match new ver decl behaviour
Father Chrysostomos [Wed, 7 Dec 2011 07:18:00 +0000 (23:18 -0800)]
Adjust docs to match new ver decl behaviour

12 years agoDeparse funny keys/values in hh properly
Father Chrysostomos [Wed, 7 Dec 2011 07:07:49 +0000 (23:07 -0800)]
Deparse funny keys/values in hh properly

Simply putting '...' or q(...) around a string is not sufficient to
quote it properly, allowing this sort of ‘fun’:

$ perl -l -MO=Deparse -e'BEGIN{$^H{"'\''.'\''"} = "um);\n    exit("}print'
BEGIN { $/ = "\n"; $\ = "\n"; }
sub BEGIN {
    $^H{q['.']} = "um);\n    exit(";
}
BEGIN {
    $^H{''.''} = q(um);
    exit();
}
print $_;
-e syntax OK

And B::Deparse already has a facility for quoting strings, so why
not use it?

12 years agoFix up ext/B/t for strict.pm changes
Father Chrysostomos [Wed, 7 Dec 2011 07:01:24 +0000 (23:01 -0800)]
Fix up ext/B/t for strict.pm changes

12 years agoFix deparsing of undefined hint hash values
Father Chrysostomos [Wed, 7 Dec 2011 06:58:31 +0000 (22:58 -0800)]
Fix deparsing of undefined hint hash values

Undefined values in the hint hash were being deparsed as empty
strings.  Whenever the hint hash changed, all undefined values, even
those unmodified, were being printed.

12 years agouse 5.xxx: Don’t load feature.pm unnecessarily
Father Chrysostomos [Wed, 7 Dec 2011 05:33:18 +0000 (21:33 -0800)]
use 5.xxx: Don’t load feature.pm unnecessarily

And don’t look in the hint hash unless the LOCALIZE_HH hint is set.

12 years agomore tests for partial strictures and ver decls
Father Chrysostomos [Wed, 7 Dec 2011 02:20:19 +0000 (18:20 -0800)]
more tests for partial strictures and ver decls

12 years agoImplement new ‘use 5.xxx' plan
Father Chrysostomos [Wed, 7 Dec 2011 02:12:14 +0000 (18:12 -0800)]
Implement new ‘use 5.xxx' plan

• Version declarations now unload all features before loading the
  specified feature bundle.
• Explicit use/no strict overrides any implicit strict-loading done by
  version declarations, whether before or after use of strict.pm.
• ‘use 5.01’ or earlier disables any implicitly-enabled strictures.

12 years agoDocument :default feature bundle
Father Chrysostomos [Wed, 7 Dec 2011 00:54:18 +0000 (16:54 -0800)]
Document :default feature bundle

12 years agoAdd :default feature bundle
Father Chrysostomos [Tue, 6 Dec 2011 22:50:16 +0000 (14:50 -0800)]
Add :default feature bundle

12 years agobisect-runner.pl should skip the testcase if it fails to build config.sh
Nicholas Clark [Wed, 7 Dec 2011 12:55:03 +0000 (13:55 +0100)]
bisect-runner.pl should skip the testcase if it fails to build config.sh

Previously if given a testcase and a target of config.sh or config.h, it
would always attempt run it, even if the target (config.sh or config.h)
had not been built. Oddly enough, this usually resulted in the test case
failing, with the consequence that the bisect run ended with a spurious
result. Skipping such revisions instead makes the bisect output meaningful.

12 years agoPorting/expand-macro.pl needs to avoid "macro redefined" errors.
Nicholas Clark [Wed, 7 Dec 2011 10:26:29 +0000 (11:26 +0100)]
Porting/expand-macro.pl needs to avoid "macro redefined" errors.

In the C code that Porting/expand-macro.pl generates, it #includes the
header containing the macro, to ensure that the macro definition is seen.
This was skipped for perl.h and EXTERN.h, which it always automatically
includes. However, perl.h includes embed.h and embedvar.h and then undefines
and redefines macros in them. Hence if either header is included (again) the
compiler warns about macro redefinitions. Hence ensure that neither is
included a second time.

12 years agoSync versions in Maintainers.pl for Safe and ExtUtils-ParseXS
Chris 'BinGOs' Williams [Wed, 7 Dec 2011 09:52:42 +0000 (09:52 +0000)]
Sync versions in Maintainers.pl for Safe and ExtUtils-ParseXS

12 years agoIncrease perl5db.pl’s version to 1.35
Father Chrysostomos [Tue, 6 Dec 2011 21:17:56 +0000 (13:17 -0800)]
Increase perl5db.pl’s version to 1.35

12 years agocmpVERSION.pl: Check lib/*.pl, too
Father Chrysostomos [Tue, 6 Dec 2011 21:17:13 +0000 (13:17 -0800)]
cmpVERSION.pl: Check lib/*.pl, too

12 years agoUpgrade to Safe 2.30
Rafael Garcia-Suarez [Tue, 6 Dec 2011 21:02:21 +0000 (22:02 +0100)]
Upgrade to Safe 2.30

[rt.cpan.org #72872] Fix bad interaction with loading
Tie::Hash::NamedCapture on perls >= 5.14.0

12 years agoperlfunc/substr: Don’t mention dev release
Father Chrysostomos [Tue, 6 Dec 2011 17:24:23 +0000 (09:24 -0800)]
perlfunc/substr: Don’t mention dev release

Dev releases are an artefact of the developement process, so mentioning
them is not helpful to the average reader.

12 years agoDocument substr lv with negative offset
Father Chrysostomos [Tue, 6 Dec 2011 17:22:59 +0000 (09:22 -0800)]
Document substr lv with negative offset

12 years agoUpdate eval docs for list context fix
Father Chrysostomos [Tue, 6 Dec 2011 16:44:43 +0000 (08:44 -0800)]
Update eval docs for list context fix

12 years ago[perl #80630] Make eval"" return empty list for syntax errors
Father Chrysostomos [Sat, 19 Nov 2011 19:13:24 +0000 (11:13 -0800)]
[perl #80630] Make eval"" return empty list for syntax errors

Up till now, eval"" in list context was returning a list containing
undef for syntax errors and an empty list for run-time errors.

12 years agoDon’t LEAVE_with_name("evalcomp") for syntax errors
Father Chrysostomos [Tue, 6 Dec 2011 16:34:15 +0000 (08:34 -0800)]
Don’t LEAVE_with_name("evalcomp") for syntax errors

In S_doeval, if yystatus == 0 but there have been parser errors, then
there will be an extra scope on the scope stack inside the evalcomp
scope, causing an assertion failure with LEAVE_with_name("evalcomp").

This can happen with eval(q|""!=!~//|), which is a reduced version of
an eval in SNMP::Trapinfo’s test suite.

Under non-debugging builds, everything would have worked anyway,
as the LEAVE_with_name("evalcomp") would have left the scope
inside evalcomp.

Since POPBLOCK pops away the savestack markers on the scope stack, it
is not actually necessary to do LEAVE_with_name("evalcomp") at all
when there is a syntax error.

12 years ago|| instead of "or" (perl#78708)
Alexandr Ciornii [Tue, 6 Sep 2011 21:30:46 +0000 (00:30 +0300)]
|| instead of "or" (perl#78708)

12 years agoPut optimised substr assignment in void context
Father Chrysostomos [Mon, 5 Dec 2011 20:55:57 +0000 (12:55 -0800)]
Put optimised substr assignment in void context

24fcb59fc optimised substr assignment in void context down to four-arg
substr, causing considerable speed-up, but did not take the extra step
of marking the substr op itself as being in void context, so pp_substr
was still constructing a return value.  This commit speed things up
just a tiny bit more.

12 years agofix some foibles in perlintro.pod
Ricardo Signes [Mon, 5 Dec 2011 03:47:24 +0000 (22:47 -0500)]
fix some foibles in perlintro.pod

1. add a missing "of"
2. add a post-dot space missed in e8b5ae5
3. get the motto "right" as per common usage

12 years agoUpdate IO-Compress to CPAN version 2.045
Chris 'BinGOs' Williams [Sun, 4 Dec 2011 20:55:58 +0000 (20:55 +0000)]
Update IO-Compress to CPAN version 2.045

  [DELTA]

  2.045 3 December 2011

      * Restructured IO::Compress::FAQ.pod

12 years agoUpdate Compress-Raw-Zlib to CPAN version 2.045
Chris 'BinGOs' Williams [Sun, 4 Dec 2011 20:48:57 +0000 (20:48 +0000)]
Update Compress-Raw-Zlib to CPAN version 2.045

  [DELTA]

  2.045 3 December 2011

      * Moved FAQ.pod into Zlib.pm

12 years agoUpdate Compress-Raw-Bzip2 to CPAN version 2.045
Chris 'BinGOs' Williams [Sun, 4 Dec 2011 20:45:37 +0000 (20:45 +0000)]
Update Compress-Raw-Bzip2 to CPAN version 2.045

  [DELTA]

  2.045 3 December 2011

      * Moved FAQ.pod to IO::Compress

12 years agoAdjust substr offsets when using, not when creating, lvalue
Father Chrysostomos [Sun, 4 Dec 2011 18:47:40 +0000 (10:47 -0800)]
Adjust substr offsets when using, not when creating, lvalue

When substr() occurs in potential lvalue context, the offsets are
adjusted to the current string (negative being converted to positive,
lengths reaching beyond the end of the string being shortened, etc.)
as soon as the special lvalue to be returned is created.

When that lvalue is assigned to, the original scalar is stringified
once more.

That implementation results in two bugs:

1) Fetch is called twice in a simple substr() assignment (except in
void context, due to the special optimisation of commit 24fcb59fc).

2) These two calls are not equivalent:

$SIG{__WARN__} = sub { warn "w ",shift};
sub myprint { print @_; $_[0] = 1 }
print substr("", 2);
myprint substr("", 2);

The second one dies.  The first one only warns.  That’s mean.  The
error is also wrong, sometimes, if the original string is going to get
longer before the substr lvalue is actually used.

The behaviour of \substr($str, -1) if $str changes length is com-
pletely undocumented.  Before 5.10, it was documented as being unreli-
able and subject to change.

What this commit does is make the lvalue returned by substr remember
the original arguments and only adjust the offsets when the assign-
ment happens.

This means that the following now prints z, instead of xyz (which is
actually what I would expect):

$str = "a";
$substr = \substr($str,-1);
$str = "xyz";
print $substr;

12 years agoClarify docs for sv_usepvn_flags
Father Chrysostomos [Sat, 3 Dec 2011 19:02:32 +0000 (11:02 -0800)]
Clarify docs for sv_usepvn_flags

Note that the string must be the start of a mallocked block of memory,
and not a pointer to the middle of it.

12 years agoOn AIX, avoid a shell pipepline by making makedef.pl sort case insenitively.
Nicholas Clark [Fri, 25 Nov 2011 17:16:35 +0000 (18:16 +0100)]
On AIX, avoid a shell pipepline by making makedef.pl sort case insenitively.

Previously the Makefile piped the output of makedef.pl to sort. This had the
side effect of ignoring the exit code from makedef.pl, as make could only
see the exit code of the last command in the pipeline. This concealed the
causes of the parallel make failure when makedef.pl was missing a dependency
on Config.pm

12 years agoSimplify S_parse_body() by calling S_usage() and S_minus_v() directly.
Nicholas Clark [Thu, 24 Nov 2011 21:34:43 +0000 (22:34 +0100)]
Simplify S_parse_body() by calling S_usage() and S_minus_v() directly.

Previously the code for "--help" and "--version" set a local variable to a
string corresponding to the single character option ("h" or "v"
respectively), then restarted the option parsing code, which would then call
into Perl_moreswitches(), which would then use a switch statement to
dispatch to the final code.

This is not as clear as it could be.

12 years agoBreak the -v code out from Perl_moreswitches() into S_minus_v().
Nicholas Clark [Thu, 24 Nov 2011 20:40:40 +0000 (21:40 +0100)]
Break the -v code out from Perl_moreswitches() into S_minus_v().

12 years agoRefactor S_usage() to take 0 parameters and exit directly().
Nicholas Clark [Thu, 24 Nov 2011 20:28:27 +0000 (21:28 +0100)]
Refactor S_usage() to take 0 parameters and exit directly().

This simplifies the code, as it's only called from one spot, in
Perl_moreswitches().

12 years agoUpdate IO-Compress to CPAN version 2.044
Chris 'BinGOs' Williams [Sat, 3 Dec 2011 23:59:33 +0000 (23:59 +0000)]
Update IO-Compress to CPAN version 2.044

  [DELTA]

  2.044 2 December 2011

      * Moved FAQ.pod under the lib directory so it can get installed

      * Added bin/zipdetails

      * IO::Compress::Zip
        - In one-shot mode enable Zip64 mode if the input file/buffer
          >= 0xFFFFFFFF bytes.

      * IO::Compress::FAQ
        - Updates

12 years agoUpdate Compress-Raw-Zlib to CPAN version 2.044
Chris 'BinGOs' Williams [Sat, 3 Dec 2011 23:07:58 +0000 (23:07 +0000)]
Update Compress-Raw-Zlib to CPAN version 2.044

  [DELTA]

  2.044 2 December 2011

      * Moved FAQ.pod under the lib directory so it can get installed

12 years agoUpdate Compress-Raw-Bzip2 to CPAN version 2.044
Chris 'BinGOs' Williams [Sat, 3 Dec 2011 23:00:35 +0000 (23:00 +0000)]
Update Compress-Raw-Bzip2 to CPAN version 2.044

  [DELTA]

  2.044 2 December 2011

      * Moved FAQ.pod under the lib directory so it can get installed

12 years agoRemove the VMS-specific private len in S_mayberelocate.
Craig A. Berry [Sat, 3 Dec 2011 21:55:26 +0000 (15:55 -0600)]
Remove the VMS-specific private len in S_mayberelocate.

This particular C<STRLEN len;> came along almost 15 years ago, way
back in aa6893958c2b.  Back then it was a plain and simple block
scope variable.  But now this code lives in a function that takes
as an argument a variable of the same name and having the same
meaning (i.e., the length of the directory name to be added to
@INC).  Someone looking only at the argument list might reasonably
expect to be able to use len (though luckily there are no subsequent
uses of it currently).  So we really ought to update that len rather
than create our own when we hijack the directory name to make our
unixified version of it.

12 years agoRemove SvTAINT from sv_sethek
Father Chrysostomos [Sat, 3 Dec 2011 17:36:38 +0000 (09:36 -0800)]
Remove SvTAINT from sv_sethek

This was copied from sv_usepvn_flags in commit 58b643af9.  It is
unnecessary, and probably incorrect, as heks are not tainted.

Why sv_sethek used sv_usepvn_flags to begin with I don’t know, but I
imagine it was for brevity’s sake.  This code was ultimately derived
from newSVhek, which doesn’t use sv_usepvn_flags.  Because of that,
and because it is now far enough removed from sv_usepvn_flags, I have
removed the comment referring to it.

12 years agoperl -d bugfixes and tests
Shlomi Fish [Sat, 3 Dec 2011 14:56:53 +0000 (06:56 -0800)]
perl -d bugfixes and tests

This patch fixes some bugs in "perl -d" (see ticket #104820) and adds
some regression tests (for the bugfixes and for better test coverage).

12 years agoStop calling sv_usepvn_flags from sv_sethek
Peter Martini [Sat, 3 Dec 2011 12:01:44 +0000 (07:01 -0500)]
Stop calling sv_usepvn_flags from sv_sethek

sv_usepvn_flags assumes that ptr is at the head of a block
of memory allocated by malloc.  If perl's malloc is in use,
the data structures malloc uses and the data allocated for
perl are intermixed, and accounting done by malloced_size
in sv_usepvn_flags will overwrite valid memory if its called
on an address that is not the start of a malloced block.

The actual work being accomplished by sv_usepvn_flags, and
not undone immediately after by sv_sethek, is limited to 3 calls
on the SV.  Inlining those calls removes the dependency on malloc.

This fixes perl #104034.

12 years agoVMS-specific scope fix for S_mayberelocate.
Craig A. Berry [Sat, 3 Dec 2011 16:36:58 +0000 (10:36 -0600)]
VMS-specific scope fix for S_mayberelocate.

Back in 3185893b8dec106 I moved some code from the beginning of one
block to the middle of a different block.  Bad me.  The compiler
has been lax about allowing declarations in the middle of a block,
so we haven't noticed.  But as of c29067d7797853039, the code moved
to a new function while leaving the block it was in behind and we
end up with conflicting declarations of len.

Making our own block seems like the safest thing to do.  The
indentation in this section of code is a bit wacky -- I chose the
least intrusive alternative for clearer blame logs.

12 years agoSmall tidyups in S_incpush() and S_mayberelocate()
Nicholas Clark [Thu, 24 Nov 2011 19:38:08 +0000 (20:38 +0100)]
Small tidyups in S_incpush() and S_mayberelocate()

Following commit 816005240f1a3b99, which moved VMS-specific code, we can now
assign to subdir at the point of declaration. After the refactoring that
moved code into S_mayberelocate(), we can assign to libdir at the point of
declaration. In turn, this allows the merging of two #ifndef PERL_IS_MINIPERL
blocks. Remove a blank line from S_mayberelocate().

12 years agoAvoid attacks on sitecustomize by using NUL delimiters to wrap filenames.
Nicholas Clark [Thu, 24 Nov 2011 17:11:32 +0000 (18:11 +0100)]
Avoid attacks on sitecustomize by using NUL delimiters to wrap filenames.

Previously the generated code used regular '' strings, which meant that a
crafted pathname containing ' characters could be used to inject code.
Until the previous commit, this was only a problem if building in or
Configuring to install to such a directory. Which, hopefully, would be
"obviously wrong" to anyone capable of building Perl from source.

However, fixing the bug that prevented sitecustomize being subject to
relocatable include now means that for a relocatable pearl, an end-user
controlled path can now reach the sitecusomize code.

12 years agoMake sitecustomize relocatableinc aware
Carl Hayter [Thu, 24 Nov 2011 16:49:50 +0000 (17:49 +0100)]
Make sitecustomize relocatableinc aware

When -Dusesitecustomize is used with -Duserelocatableinc,
SITELIB_EXP/sitecustomize.pl is not found due to SITELIB_EXP having a
'.../..' relocation path.

This patch refactors the path relocation code from S_incpush() into
S_mayberelocate() so that it can be used in both S_incpush() and in
usesitecustomize's use of SITELIB_EXP.

12 years agoTidy up t/re/regexp.t
Nicholas Clark [Sat, 3 Dec 2011 11:59:05 +0000 (11:59 +0000)]
Tidy up t/re/regexp.t

Eliminate the declaration of $numtests, unused since commit 1a6108908b085da4.
Convert $iters and $OP to lexicals. Remove the vestigial logic for finding
t/re/re_tests - the MacOS classic style pathname is redundant now, and the
file can never be found at t/re/re_tests given that there is a chdir 't' in
the BEGIN block.

12 years agoRework vms/vms.c:Perl_flex_stat_int() to avoid underscore ambiguity.
Craig A. Berry [Sat, 3 Dec 2011 03:33:25 +0000 (21:33 -0600)]
Rework vms/vms.c:Perl_flex_stat_int() to avoid underscore ambiguity.

An apparently long-standing bug in the home-grown stat() wrapper
was exposed by b8ab4b0, which added the t/test_pl directory. On
VMS, file test operations using the Perl_flex_stat_int() function
would confuse t/test.pl with t/test_pl because dots are the directory
delimiter and not traditionally allowed in directory names, so when
doing a stat() of t/test.pl it would convert the dot to an underscore
and succeed because that directory now exists.  All tests using
t/test.pl would then fail.

The background is that traditionally, the CRTL stat() could not deal
with directory specifications in native format, so for example,
dev:[dir.dir2] had to be converted to dev:[dir]dir2.DIR for various
operations, including the stat() call, to succeed.  This is now the
exception; it's still necessary for rmdir(), but not for stat(), at
least not on OpenVMS VAX v7.3, OpenVMS Alpha v7.3-2, OpenVMS Alpha
v8.3, and OpenVMS I64 v8.4, i.e., anything released in the last
eight years.  A so-called "fileified" directory spec did not cause
problems on its own, but if converted to native syntax first, the
dot would get replace with the now-ambiguous underscore.

The balance was tipped in 312ac60b381, where the fatal conversion
to a native path was added.  The best path forward seems to be to
do less and allow the CRTL stat() or lstat() to do their thing
unimpeded, which in most cases they do just fine.  This has the
added benefit of optimizing for files instead of directories and
saving some unnecessary filename conversions and filename buffer
allocations.  More refactorings are likely desireable.

There is one new test failure in dist/ExtUtils-Manifest/t/Manifest.t
having to do with a filename containing a space, but this seems
preferable to the hundreds of test failures before this patch.  That
indicates, however, that there is more work to do.

12 years agoAdd Term::ReadLine to write_buildcustomize.pl.
Craig A. Berry [Sat, 3 Dec 2011 03:30:30 +0000 (21:30 -0600)]
Add Term::ReadLine to write_buildcustomize.pl.

If the build fails while building extensions, it's nice to have
the debugger available to help figure out what went wrong.  You
couldn't do that before because lib/perl5db.pl depends on
Term::ReadLine, which wouldn't be available since it hadn't been
built yet.  This commit makes Term::ReadLine available via the
same mechanism that makes other libraries available to miniperl
during the build.

An alternative would be to remove the debugger's dependency on
Term::ReadLine, but that would be more work and more risk for a
situation that hopefully doesn't come up that often.

12 years agomore reliably kill a runaway test process on cygwin
Tony Cook [Fri, 2 Dec 2011 12:23:00 +0000 (23:23 +1100)]
more reliably kill a runaway test process on cygwin

Sometimes a plain kill isn't enough.

Along with the previous change this reliably kills a blocked
t/op/threads.t on cygwin as needed.

This doesn't attempt to fix the underlying bug (which may be in
Win32, cygwin or perl itself)

12 years agodon't depend on threads to do a watchdog when testing threads
Tony Cook [Fri, 2 Dec 2011 12:25:33 +0000 (23:25 +1100)]
don't depend on threads to do a watchdog when testing threads

adds a "process" watchdog method that forces use of a separate
process for the watchdog "watcher".

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.