This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoPOSIX: add lround() to the :math_h_c99 export tag
Aaron Crane [Fri, 13 May 2016 10:29:01 +0000 (11:29 +0100)]
POSIX: add lround() to the :math_h_c99 export tag

Closes RT#127821.

7 years agoperlbug: wrap overly long lines
Niko Tyni [Mon, 25 Apr 2016 13:31:00 +0000 (16:31 +0300)]
perlbug: wrap overly long lines

Mail transport agents limit the length of message lines at SMTP time.
One observed limit is 1000 characters per line. Mail user agents typically
work around these limits by MIME-encoding the message. Since perlbug
doesn't do that, it needs to limit the length of its lines manually to
make sure bug reports get delivered.

The longest lines in perlbug reports normally come from Config::myconfig
output, particularly 'config_args', which has been observed to exceed
1000 characters on some configurations, causing report rejection. While
less likely, the list of local patches is another potential source of
overly long lines.

Use Text::Wrap (if available) to wrap the body of the report at an
arbitrarily chosen and hopefully safe limit of 900 characters. No
indentation or continuation line markers are added, though it would
be easy to add those if desired. Attachments and mail headers are not
wrapped.

Bug-Debian: https://bugs.debian.org/822463

7 years agoperlbug: Refactor duplicated file reading code
Niko Tyni [Thu, 28 Apr 2016 15:50:17 +0000 (18:50 +0300)]
perlbug: Refactor duplicated file reading code

_send_message_mailsend() needs to build the message itself rather than
calling build_complete_message() like the other backends, but they can
still share the file reading code, and so can the 'display report' part.

7 years agoperlbug: Add unit tests
Niko Tyni [Sun, 1 May 2016 19:53:11 +0000 (22:53 +0300)]
perlbug: Add unit tests

Some of these tests have to mimic the interactive interface, which is
probably rather fragile. However, as long as -F overrides any actual
sending, no mail bombs will hopefully result.

7 years agoperlbug: Allow subjects without whitespace in test mode
Niko Tyni [Sun, 1 May 2016 19:19:13 +0000 (22:19 +0300)]
perlbug: Allow subjects without whitespace in test mode

Passing whitespace in an option through test.pl runperl() doesn't seem
to work, so relax the check in test mode (-t) for noninteractive testing.

7 years agoperlbug: quit main loop on empty answer / eof in test mode
Niko Tyni [Sun, 1 May 2016 17:06:37 +0000 (20:06 +0300)]
perlbug: quit main loop on empty answer / eof in test mode

This makes it possible to drive perlbug noninteractively
without having it go to an infinite loop on end of file.

The change has no effect in non-test mode, where the default answer is
the empty string.

This is groundworks for perlbug unit tests.

7 years agoperlbug: Allow noninteractive use in test mode (-t option)
Niko Tyni [Sun, 1 May 2016 17:02:49 +0000 (20:02 +0300)]
perlbug: Allow noninteractive use in test mode (-t option)

This is groundworks for perlbug unit tests.

Not all of the interactive questions can be overridden on
the command line, so we will have to pipe in commands.

Adapt the test mode ("-t"), which used to just override the
recipient address, for this rather than inventing one more
new option.

7 years agoCorrect info in Maintainers.pl for dists already on CPAN
Chris 'BinGOs' Williams [Mon, 16 May 2016 11:29:18 +0000 (12:29 +0100)]
Correct info in Maintainers.pl for dists already on CPAN

7 years agoUpdate Digest-MD5 to CPAN version 2.55
Chris 'BinGOs' Williams [Mon, 16 May 2016 11:26:16 +0000 (12:26 +0100)]
Update Digest-MD5 to CPAN version 2.55

  [DELTA]

2016-03-09   Gisle Aas <gisle@ActiveState.com>

   Release 2.55

   Gordon Stanton (2):
      Make use warnings work including test cases.
      Initial Travis config

   Gisle Aas (1):
      Avoid warning: 'static' is not at beginning of declaration [RT#105646]

7 years agoUpdate IPC-Cmd to CPAN version 0.94
Chris 'BinGOs' Williams [Mon, 16 May 2016 11:21:53 +0000 (12:21 +0100)]
Update IPC-Cmd to CPAN version 0.94

  [DELTA]

0.94 Fri Feb 12 18:55:05 GMT 2016

  Bug fixes:
  * move __END__ above POD in documentation (plicease)
  * Don't clobber $SIG{__DIE__} and $SIG{__WARN__} in open3_run() (avar)
  * Fix 'terminate_on_signal' segfaulting (Petya Kohts)
  * Fix usage of fcntl(..., F_GETFL, ...) (tonyc)

7 years agoUpdate Archive-Tar to CPAN version 2.08
Chris 'BinGOs' Williams [Mon, 16 May 2016 11:20:21 +0000 (12:20 +0100)]
Update Archive-Tar to CPAN version 2.08

7 years ago[perl #128052] make t/test.pl compatible with older Perls
Aaron Crane [Mon, 16 May 2016 11:19:03 +0000 (12:19 +0100)]
[perl #128052] make t/test.pl compatible with older Perls

The RT ticket points out that the threads and threads::shared libraries,
among other CPAN modules, copy t/test.pl and must operate on older versions
of Perl; but that the version in threads 2.07 and threads::shared 1.51
contains constructs that require Perl 5.10.

This change restores 5.8 compatibility in t/test.pl, ready for reimporting
into the CPAN releases of those modules.

I can't see a way to test that this compatibility doesn't get accidentally
broken in the future, unfortunately.

7 years agoupgrade Module-Metadata to 1.000032
Karen Etheridge [Mon, 16 May 2016 02:19:01 +0000 (19:19 -0700)]
upgrade Module-Metadata to 1.000032

7 years agofix typo in RMG
Karen Etheridge [Mon, 16 May 2016 02:18:39 +0000 (19:18 -0700)]
fix typo in RMG

7 years agoMaxwell Carey is now a perl author
Tony Cook [Mon, 16 May 2016 00:59:13 +0000 (10:59 +1000)]
Maxwell Carey is now a perl author

7 years agoClarify description of sprintf "%.1g"
Maxwell Carey [Mon, 9 May 2016 21:33:41 +0000 (15:33 -0600)]
Clarify description of sprintf "%.1g"

sprintf "%.1g" sets the number of *significant* digits, not the
maximum number of digits to show. Added examples for values less
than 1.

7 years agoFix Scalar-List-Utils build on C89 compilers; patch sent upstream
Aaron Crane [Mon, 16 May 2016 00:34:25 +0000 (01:34 +0100)]
Fix Scalar-List-Utils build on C89 compilers; patch sent upstream

7 years agoFix Scalar-List-Utils build on C++ compilers; patch sent upstream
Aaron Crane [Mon, 16 May 2016 00:15:44 +0000 (01:15 +0100)]
Fix Scalar-List-Utils build on C++ compilers; patch sent upstream

7 years ago[cpan#100183] Add missing "<FH> chunk #" phrase to Carp messages
Aaron Crane [Sun, 24 Apr 2016 15:24:43 +0000 (16:24 +0100)]
[cpan#100183] Add missing "<FH> chunk #" phrase to Carp messages

Commit 89988fbd2f7d8a44526a3cd9ab671b3102898bc9 added the relevant phrase for
line-oriented filehandles; this extends that to also cover chunk-oriented
ones.

The patch was supplied by Chris R Donnelly <chris.donnelly@vauto.com> on the
rt.cpan.org ticket; I have extended it to include a test.

7 years agoUpgrade to Scalar-List-Utils 1.45 from CPAN
Jarkko Hietaniemi [Sun, 15 May 2016 22:32:03 +0000 (18:32 -0400)]
Upgrade to Scalar-List-Utils 1.45 from CPAN

7 years agoUpgrade to DB_File 1.838 from CPAN.
Jarkko Hietaniemi [Sun, 15 May 2016 22:03:33 +0000 (18:03 -0400)]
Upgrade to DB_File 1.838 from CPAN.

7 years agosv.c: fix missing word in apidoc
Aaron Crane [Sun, 15 May 2016 21:45:10 +0000 (22:45 +0100)]
sv.c: fix missing word in apidoc

7 years ago[perl #128086] Test the prev commit
Father Chrysostomos [Sun, 15 May 2016 20:49:33 +0000 (13:49 -0700)]
[perl #128086] Test the prev commit

7 years ago[perl #128086] Fix precedence in hv_ename_delete
Hugo van der Sanden [Sun, 15 May 2016 20:48:58 +0000 (13:48 -0700)]
[perl #128086] Fix precedence in hv_ename_delete

A stash’s array of names may have null for the first entry, in which
case it is not one of the effective names, and the name count will
be negative.

The ‘count > 0’ is meant to prevent hv_ename_delete from trying to
read that entry, but a precedence problem introduced in 4643eb699
stopped it from doing that.

[This commit message was written by the committer.]

7 years agoinline.h: Suppress g++ warning under threads
Father Chrysostomos [Sun, 15 May 2016 18:01:36 +0000 (11:01 -0700)]
inline.h: Suppress g++ warning under threads

In file included from perl.h:5853,
                 from op.c:103:
inline.h:712: warning: unused parameter 'my_perl'

7 years agoDump empty-string ENAMEs as empty strings
Father Chrysostomos [Sun, 15 May 2016 17:59:18 +0000 (10:59 -0700)]
Dump empty-string ENAMEs as empty strings

They were coming out as ‘(null)’, which is incorrect and confusing.

7 years agoop.c: Remove special cases for array funcs
Father Chrysostomos [Sun, 15 May 2016 17:56:22 +0000 (10:56 -0700)]
op.c: Remove special cases for array funcs

We no longer need special cases for the prototypes for array functions,
since autodef has been removed, and these are now perfectly regular.

7 years agoMake barewords constant-foldable
Aaron Crane [Sun, 15 May 2016 18:00:53 +0000 (19:00 +0100)]
Make barewords constant-foldable

Commit 11fa937b2766784f0f812687a7f81dd3761e605f, from August 1999, changed
constant folding to treat barewords as unfoldable. Public mailing-list
archives from that period are incomplete, unfortunately, and this change in
particular is no longer well documented; the only message still available
seems to be <199907140903.CAA07505@activestate.com>, with subject "Re:
Unwanted perl helpfullness". That message quotes a bug reporter pointing out
that a constant-folded bareword would fail to trigger the "not allowed while
strict subs in use" error under "use strict".

However, there's no information available about why the bug was fixed in this
way, rather than by merely ensuring that constant folding would produce that
error when necessary. The no_bareword_allowed() routine did already exist at
that point, for example. This change therefore adopts that approach.

This causes one minor change in behaviour: since barewords now take part in
constant folding, concatenating a bareword with another constant in void
context now produces a warning for the concatenated string, rather than for
the concatenation op. This seems like an acceptable change, given that
non-bareword constants already behave in the same way.

7 years agoS_fold_constants(): refactor foldability detection
Aaron Crane [Sun, 15 May 2016 17:44:16 +0000 (18:44 +0100)]
S_fold_constants(): refactor foldability detection

7 years ago[perl #127952] misoptimization for negated constant-ish on lhs of logop
Aaron Crane [Sun, 15 May 2016 14:11:12 +0000 (15:11 +0100)]
[perl #127952] misoptimization for negated constant-ish on lhs of logop

Negations were being incorrectly deleted from the op tree for an OP_AND or
OP_OR (corresponding to Perl code with any of `&& || and or`, or postfix
"if" or "unless") whose left-hand side looks like "!BAREWORD" or "!do {
'const' }" and whose right-hand side is a non-constant-foldable negation.

The symptom in the reported case was an assertion failure in ck_refassign
for an srefgen op, caused by such an OP_NOT having been nulled. But other
cases exist that instead yielded incorrect results.

The underlying cause is that two optimisations in S_new_logop() were
partially interfering with each other. One of those attempts to optimise
code like "!$x && !$y" to the equivalent of "!($x || $y)", saving a
negation op; this is valid by De Morgan's laws. If it detects code of
this form, it nulls out the negations on each side of the "&&", and makes
a note to wrap the op it generates inside a new OP_NOT.

The other optimisation looks at the left-hand arm, and if it's a constant at
compile time, avoids the entire logop in favour of directly evaluating the
lhs or rhs as appropriate, and eliding whichever arm is no longer needed.
This optimisation is important for code like this:

    use constant DEBUG => …;
    print_debug_output() if DEBUG;

because it allows the entire statement to be eliminated when DEBUG is false.

When both conditions were true simultaneously, the De Morgan optimisation
was applied before the constant-based arm elision. But the arm elision
involved returning early from S_new_logop(), so the code later in that
function that wraps the generated op in a new OP_NOT never had a chance to
run. This meant that "!X && !Y" when X is constant was being compiled as if
it were in fact "X || Y", which is clearly incorrect.

This is, however, a very rare situation: it requires the lhs to be an OP_NOT
that dominates an OP_CONST (possibly with some intervening OP_LINESEQ or
similar). But OP_NOT is constant-foldable, so that doesn't normally happen.
The two ways for it to happen are:

- The constant is a bareword (since even though barewords are constants,
  they don't currently participate in constant folding)

- The constant is hidden inside one or more layers of do{} (since that
  serves as a barrier to constant folding, but the arm-elision optimisation
  is smart enough to search recursively through the optree for the real
  constant)

The fix is much simpler than the explanation: apply the optimisations in the
opposite order, so that when arm elision returns early, the negation ops
haven't yet been nulled.

7 years agoop.c: add some explanatory comments to S_new_logop()
Aaron Crane [Sun, 15 May 2016 15:38:48 +0000 (16:38 +0100)]
op.c: add some explanatory comments to S_new_logop()

7 years agoDelete dead null-pointer check in op.c
Aaron Crane [Sun, 15 May 2016 11:21:07 +0000 (12:21 +0100)]
Delete dead null-pointer check in op.c

Code above this point has already used this variable without checking
whether it's null, so this can't accomplish anything.

7 years agoFix misleading indentation in op.c
Aaron Crane [Sat, 14 May 2016 22:29:45 +0000 (23:29 +0100)]
Fix misleading indentation in op.c

7 years agofix symbol detection with gcc 6 link-time optimization (RT #128131)
Lukas Mai [Wed, 11 May 2016 20:15:34 +0000 (22:15 +0200)]
fix symbol detection with gcc 6 link-time optimization (RT #128131)

7 years agoperldelta: OP_PARENT, and require ::Foo::Bar
David Mitchell [Sat, 14 May 2016 14:39:41 +0000 (15:39 +0100)]
perldelta: OP_PARENT, and require ::Foo::Bar

7 years agoadd PERL_OP_PARENT to 'perl -V' output
David Mitchell [Sat, 14 May 2016 14:20:11 +0000 (15:20 +0100)]
add PERL_OP_PARENT to 'perl -V' output

7 years agoenable PERL_OP_PARENT by default.
David Mitchell [Sat, 14 May 2016 14:14:28 +0000 (15:14 +0100)]
enable PERL_OP_PARENT by default.

This makes the last op_sibling field in a chain of OP siblings
point back the parent node rather than being NULL, with the endness
instead being indicated by a flag.

See http://nntp.perl.org/group/perl.perl5.porters/235635

7 years agosv.c: Add comment
Karl Williamson [Fri, 13 May 2016 02:32:21 +0000 (20:32 -0600)]
sv.c: Add comment

7 years agoUse memmem() if available on the platform for Perl_ninstr()
Karl Williamson [Wed, 11 May 2016 04:17:22 +0000 (22:17 -0600)]
Use memmem() if available on the platform for Perl_ninstr()

7 years agoMerge branch to not require mathoms special cases into blead
Karl Williamson [Fri, 13 May 2016 02:21:44 +0000 (20:21 -0600)]
Merge branch to not require mathoms special cases into blead

7 years agomathoms.c: Remove special casing from instr()
Karl Williamson [Wed, 11 May 2016 04:12:06 +0000 (22:12 -0600)]
mathoms.c: Remove special casing from instr()

This function was recently moved to mathoms.  Now that various changes
have been made to the system, the special casing needed to get things to
compile can be removed.  Also, it can just call the macro
implementation, instead of what the macro expands to.

7 years agoMake two functions for 5.005 backcompat MATHOMS
Karl Williamson [Wed, 11 May 2016 03:02:16 +0000 (21:02 -0600)]
Make two functions for 5.005 backcompat MATHOMS

The functions sv_setpviv() and sv_setpviv_mg() exist only for backcompat
with 5.005. (verified with Jarkko and Nicholas).  Make them compile only
when mathoms is present.  They can't be moved to mathoms.c because they
both call a static function visible only in sv.c.

7 years agoembed.fnc: Alter 'b' flag meaning
Karl Williamson [Wed, 11 May 2016 04:01:30 +0000 (22:01 -0600)]
embed.fnc: Alter 'b' flag meaning

This commit changes this flag to mean that the backward compatibility
functions are compiled unless the -DNO_MATHOMS cflag is specified to
Configure.  Previously the meaning was sort of like that but not
precisely.

Doing this means that the prototypes that needed to be manually added to
mathoms.c are no longer needed.  No special parameter assertions have to
be made.  makedef.pl no longer needs to parse mathoms.c and have special
cases for it.  And several special case entries in embed.fnc can be
non-special cased.

7 years agoembed.fnc: Temporarily remove backcompat flag for 2 fcns
Karl Williamson [Thu, 12 May 2016 17:51:10 +0000 (11:51 -0600)]
embed.fnc: Temporarily remove backcompat flag for 2 fcns

Otherwise, the next commit could potentially cause errors when bisecting
under -DNO_MATHOMS.  They will be restored 2 commits hence.

7 years agoregen/embed.pl: Don't: #define FOO FOO
Karl Williamson [Thu, 12 May 2016 17:31:10 +0000 (11:31 -0600)]
regen/embed.pl: Don't: #define FOO FOO

Doing so would be useless.  This doesn't currently happen, but would in
a couple of commits.

7 years agoembed.fnc: Change 'b' flag to not imply 'p' flag
Karl Williamson [Wed, 11 May 2016 03:26:33 +0000 (21:26 -0600)]
embed.fnc: Change 'b' flag to not imply 'p' flag

By doing this, we make it more general, which will be useful in a few
commits.

7 years agoembed.fnc: Indicate ninstr(), rninstr() have documentation
Karl Williamson [Wed, 11 May 2016 00:35:54 +0000 (18:35 -0600)]
embed.fnc: Indicate ninstr(), rninstr() have documentation

7 years agomathoms.c: Fix prototype
Karl Williamson [Tue, 10 May 2016 23:51:58 +0000 (17:51 -0600)]
mathoms.c: Fix prototype

This would probably have refused to compile if anyone were actually
using this function in a threaded build.

7 years agoregen/embed.pl: Verify flags field of embed.fnc
Karl Williamson [Tue, 10 May 2016 23:34:25 +0000 (17:34 -0600)]
regen/embed.pl: Verify flags field of embed.fnc

Make sure that the specified flags are legal.

7 years agoembed.fnc: Remove improper flag character
Karl Williamson [Tue, 10 May 2016 23:32:36 +0000 (17:32 -0600)]
embed.fnc: Remove improper flag character

This was introduced by efaf36747029c85b4d8825318cb4d485a0bb350e;
apparently a typo.

7 years agoPOSIX.pod: Fix grammar
Karl Williamson [Thu, 12 May 2016 15:11:00 +0000 (09:11 -0600)]
POSIX.pod: Fix grammar

7 years agoREADME.freebsd: Add some L<>, C<> to pod
Karl Williamson [Mon, 9 May 2016 17:51:36 +0000 (11:51 -0600)]
README.freebsd: Add some L<>, C<> to pod

7 years agoCroak on unimplemented already at import time
Jarkko Hietaniemi [Tue, 10 May 2016 12:56:13 +0000 (08:56 -0400)]
Croak on unimplemented already at import time

For example

  perl -MPOSIX=atexit -e 1

is never going to work in runtime, so why should it work in compile time.

This will probably break a lot of CPAN code, that have "good reasons"
for their strange imports.

Also the error messages change format, which will no doubt  break another
set of equally righteous CPAN modules.

7 years agoRemove the deprecated POSIX::tmpnam as unsafe
Jarkko Hietaniemi [Tue, 10 May 2016 12:42:37 +0000 (08:42 -0400)]
Remove the deprecated POSIX::tmpnam as unsafe

7 years agoSort the %replacement and %reimpl
Jarkko Hietaniemi [Tue, 10 May 2016 12:41:37 +0000 (08:41 -0400)]
Sort the %replacement and %reimpl

7 years agoupdate GNUmakefile for Test2 too
Tony Cook [Wed, 11 May 2016 04:54:02 +0000 (14:54 +1000)]
update GNUmakefile for Test2 too

7 years agoUpdate to the latest Test-Simple cpan dist
Chad Granum [Tue, 10 May 2016 14:44:27 +0000 (07:44 -0700)]
Update to the latest Test-Simple cpan dist

7 years agofix link to crosby paper on hash complexity attack
Doug Bell [Wed, 11 May 2016 16:10:40 +0000 (11:10 -0500)]
fix link to crosby paper on hash complexity attack

7 years agodocument the ?pair option to beforemaintrelease
Ricardo Signes [Wed, 11 May 2016 19:27:46 +0000 (15:27 -0400)]
document the ?pair option to beforemaintrelease

7 years ago[perl #128106] Fix reset with non-globs
Father Chrysostomos [Tue, 10 May 2016 21:14:40 +0000 (14:14 -0700)]
[perl #128106] Fix reset with non-globs

reset with a string argument was assuming that anything in a
stash would be a glob.  It crashed on anything else.

7 years agoSync Config::Perl::V with release 0.26
H.Merijn Brand [Tue, 10 May 2016 14:45:12 +0000 (16:45 +0200)]
Sync Config::Perl::V with release 0.26

7 years agoUpdate Archive-Tar to CPAN version 2.06
Chris 'BinGOs' Williams [Tue, 10 May 2016 11:05:38 +0000 (12:05 +0100)]
Update Archive-Tar to CPAN version 2.06

  [DELTA]

2.06  24/04/2016 (ISHIGAKI && BOOK)
- changed some of the "A"s in the UNPACK constant to "a"
  to allow trailing whitespaces in an archived filename
- roundtrip tests

7 years agoUpdate perlfaq to CPAN version 5.021011
Chris 'BinGOs' Williams [Tue, 10 May 2016 11:03:25 +0000 (12:03 +0100)]
Update perlfaq to CPAN version 5.021011

  [DELTA]

5.021011    20162016-03-04 20:04:08Z
  * update info on Perl 6
  * fix LICENSE address and update prereq for its content
  * excluded README.pod from the shipped tarball distribution

7 years agoUpdate Locale-Codes to CPAN version 3.38
Chris 'BinGOs' Williams [Tue, 10 May 2016 11:02:32 +0000 (12:02 +0100)]
Update Locale-Codes to CPAN version 3.38

7 years ago[MERGE] disallow 'require ::Foo::Bar' etc
David Mitchell [Tue, 10 May 2016 10:16:00 +0000 (11:16 +0100)]
[MERGE] disallow 'require ::Foo::Bar' etc

7 years agoload-module.t: re-indent and add some comments.
David Mitchell [Tue, 10 May 2016 09:48:18 +0000 (10:48 +0100)]
load-module.t: re-indent and add some comments.

No functional changes.

7 years agomake 'require ::Foo::Bar' die
David Mitchell [Sat, 19 Mar 2016 20:16:22 +0000 (20:16 +0000)]
make 'require ::Foo::Bar' die

Originally, 'require ::Foo::Bar' would try to load /Foo/Bar.pm.

The previous commit changed it so that  ::Foo::Bar mapped to Foo::Bar,
and so loaded Foo/Bar.pm in the @INC path.

This commit takes the different approach of, instead of mapping, making
any bareword require that starts with '::' into an error instead.

It introduces a new error message:

    $ perl -e'require ::Foo::Bar'
    Bareword in require must not start with a double-colon: "::Foo::Bar"
    $

See the thread at:
    http://www.nntp.perl.org/group/perl.perl5.porters/2012/07/msg189909.html

( I originally used '"::"' rather than 'a double-colon', but that
made the message a bit unpenetrable:

    Bareword in require must not start with "::": "::Foo::Bar"
)

7 years agoValidate the 'require Bare::Word' pathname.
Nicholas Clark [Wed, 27 Jun 2012 21:34:04 +0000 (23:34 +0200)]
Validate the 'require Bare::Word' pathname.

At runtime in require, validate the generated filename after translation
of '::' to '/' (and possible conversion from VMS to Unix format) to keep
the code simpler.  Reject empty module names, module names starting with
'/' or '.'  (ie absolute paths, hidden files, and '..'), and module names
containing NUL bytes or '/.' (ie hidden files and '..').

Add a test for Perl_load_module(), and check that it now rejects module
names which fall foul of the above rules.

Most of these can't trigger for a sinple bareword require since the
illegal module name will already have been rejected during parsing. However,
the Perl_load_module() fakes up a rquire optree including a bareword
OP_CONST, which *isn't* restricted by the lexer.

Note that this doesn't apply to non-bareword pathnames: these are both
unaffected:

    require "/foo/bar.pm";
    $x =  "/foo/bar.pm"; require $x;

[ This is cherry-picked from a branch Nicholas wrote 4 years ago, but
which was never merged. I've kept the body of the diff the same, modulo
rebasing, but re-worded the commit title and message.
Only one test was changed: the final one in load-module.t, since a
\0 in a pathname is now trapped earlier and gives a "can't locate" error
instead. For the same reason, it also required the addition of
"no warnings 'syscalls';".
- DAPM ]

7 years agoTreat require ::foo::bar; the same as foo::bar;
Nicholas Clark [Thu, 28 Jun 2012 20:35:20 +0000 (22:35 +0200)]
Treat require ::foo::bar; the same as  foo::bar;

[ This is cherry-picked from a branch Nicholas wrote 4 years ago, but
which was never merged. In the meantime it was agreed that 'require
::foo' should die instead of doing 'require foo'; but I've pulled it in
anyway as an interim commit, to make later cherry-picks easier. The die
will come in a later commit.
]

7 years agoreindent S_require_version()
David Mitchell [Sat, 19 Mar 2016 15:24:49 +0000 (15:24 +0000)]
reindent S_require_version()

Whitespace-only change.

7 years agoSplit the guts of pp_require into two static fns
David Mitchell [Sat, 19 Mar 2016 15:16:50 +0000 (15:16 +0000)]
Split the guts of pp_require into two static fns

S_require_version() and S_require_file() do the 'require 5.010001'
and 'require Foo::Bar' actions respectively.

This makes it clear that pp_require is effectively 2 disjoint functions,
and that all the local variables previously declared at the start of
pp_require actually belong exclusively to the file loading functionality.

This is based on a patch by Nicholas from 4 years ago, except that
I did the split from scratch since pp_require has been touched quite a
bit since then.

This commit splits it in such a way that the diff is kept as small as
possible. The next commit will re-indent.

7 years agofix #128109 - do not move RExC_open_parens[0] in reginsert
Yves Orton [Tue, 10 May 2016 07:44:31 +0000 (09:44 +0200)]
fix #128109 - do not move RExC_open_parens[0] in reginsert

In d5a00e4af6b155495be31a35728b8fef8e671ebe I merged GOSUB and GOSTART,
part of which involved making RExC_open_parens[0] refer to the start of
the pattern, and RExC_close_parens[0] referring to the end of the pattern.

This tripped up in reginsert in a subtle way, the start of the pattern
cannot and should not move in reginsert(). Unlike a paren that might
be at the start of the pattern which should move when something is inserted
in front of it, the start is a fixed point and should never move.

This patches fixes this up, and adds an assert to check that reginsert()
is not called once study_chunk() starts, as reginsert() does not adjust
RExC_recurse.

This was noticed by hv while debugging [perl #128085], thanks hugo!

7 years agofix #128085 - SIGSEGV in S_regmatch with S_study_chunk: Assertion "!frame" failed.
Yves Orton [Mon, 9 May 2016 06:52:16 +0000 (08:52 +0200)]
fix #128085 - SIGSEGV in S_regmatch with S_study_chunk: Assertion "!frame" failed.

The goto target should have been before the if (frame) block.

Clearly this code is not well tested in our test suite. This patch
does NOT include tests.

7 years ago(perl #127923) add blacklists/whitelists to Locale::Maketext
Tony Cook [Tue, 10 May 2016 02:03:02 +0000 (12:03 +1000)]
(perl #127923) add blacklists/whitelists to Locale::Maketext

7 years ago(perl #127923) note priority between the white and blacklist
Tony Cook [Wed, 20 Apr 2016 06:30:05 +0000 (16:30 +1000)]
(perl #127923) note priority between the white and blacklist

7 years ago(perl #127923) pass porting tests
Tony Cook [Wed, 20 Apr 2016 06:27:09 +0000 (16:27 +1000)]
(perl #127923) pass porting tests

- update MANIFEST, AUTHORS
- bump $Locale::Maketext::VERSION

7 years agoAdd blacklist and whitelist support to Locale::Maketext.
John Lightsey [Thu, 17 Mar 2016 16:06:09 +0000 (16:06 +0000)]
Add blacklist and whitelist support to Locale::Maketext.

Format string attacks against Locale::Maketext have been discovered in
several popular web applications and addresed by pre-filtering maketext
strings before they are fed into the maketext() method. It is now
possible to restrict the allowed bracked notation methods directly in
Maketext.

This commit also introduces a default blacklist that prevents using the
object and class methods in the Locale::Maketext namespace that were not
intended as bracked notation methods.

7 years agoperldelta for e71f25b35412
Tony Cook [Tue, 10 May 2016 01:35:50 +0000 (11:35 +1000)]
perldelta for e71f25b35412

I'm not sure that's in the right section, but I think it's a better
fit than the others I considered.

7 years agofix make test failures in -Accflags=-DPERL_TRACE_OPS
Jim Cromie [Wed, 20 Jan 2016 23:11:34 +0000 (16:11 -0700)]
fix make test failures in -Accflags=-DPERL_TRACE_OPS

builds with -DPERL_TRACE_OPS currently fail make test, on ~124 files,
for both normal & -DDEBUGGING, and plain & threaded configs.  These
tests fail because they check STDERR content, and reject the extra
output issued by perl_destruct() in these builds.  It turns out that
"Trace of all OPs executed:" by itself is enough to cause the failures.

The easiest fix is to silence -DPERL_TRACE_OPS printing by default,
and enable it if $ENV{PERL_TRACE_OPS} > 0.  Due to various aspects of
the design, this is also the best fix.

 - OP-counting is only done in runops_debug(). runops_standard()
   avoids all counting overhead, so the only 'cost' then is the extra
   space in the interpreter structure.

 - use of runops_debug() vs runops_standard() varies at build, with -DDEBUGGING,
   and can be changed at runtime, with -MDevel::Peek -e 'BEGIN{runops_debug(0 or 1)}'

 - when runops_standard is used, perl_destruct() reports ALL-0s
   OP-exec-counts.  This is wrong, silence is better.

 - when runops_* is toggled, OP-counts will only reflect part of the work done.

Given the flexibilty of use, perl_destruct() cannot really know the
counts are good, and shouldnt just spew them to STDERR.  With this
patch, the user asks for the output at runtime.

 - with patch, the build is not noisy, more usable, no stderr to deal with.
   miniperl is also silent, reducing `make` output too.

 - via simple XS, data can be read, cleared, at any compilation phase.
   with this, data to stderr is just a convienience, not "the way" to get data.
   Ive got Devel::TraceOps on-deck.

I also took the liberty of suppressing "<optype>: 0" prints entirely.

 - no real info provided (0 count is inferrable by silence)
 - 0 is usually wrong, unless other OP-counts (from same interp) are non-0
 - `make test` on a non-debug threaded build emits 5 million of them

And now './perl -e 'print "foo\n"' becomes readably small:
foo
Trace of all OPs executed:
  pushmark: 1
  gvsv: 1
  nextstate: 1
  enter: 1
  leave: 1
  print: 1

NOTES:

Since the PERL_TRACE_OPs counting overhead is runtime selectable, it
seemed useful to measure and report it:

 function run_trace_overhead() {
    for i in seq 1 2; do
perf stat -r5 -- ./perl -Ilib -MDevel::Peek -e 'BEGIN{runops_debug(0)}' -e 'for (1..9_999_999){$i++}'
perf stat -r5 -- ./perl -Ilib -MDevel::Peek -e 'BEGIN{runops_debug(1)}' -e 'for (1..9_999_999){$i++}'
    done 2>&1 | grep -E 'Performance|instructions'
 }

bench.pl couldnt do this, not without different --perlargs per contestant.

[jimc@popeye perl]$ run_trace_overhead
 Performance counter stats for './perl -MDevel::Peek -e BEGIN{runops_debug(0)} -e for (1..9_999_999){$i++}' (5 runs):
     3,460,280,502      instructions              #    1.57  insns per cycle          (25.01%)
 Performance counter stats for './perl -MDevel::Peek -e BEGIN{runops_debug(1)} -e for (1..9_999_999){$i++}' (5 runs):
     3,857,253,945      instructions              #    2.00  insns per cycle          (25.07%)
 Performance counter stats for './perl -MDevel::Peek -e BEGIN{runops_debug(0)} -e for (1..9_999_999){$i++}' (5 runs):
     3,437,504,999      instructions              #    1.57  insns per cycle          (25.07%)
 Performance counter stats for './perl -MDevel::Peek -e BEGIN{runops_debug(1)} -e for (1..9_999_999){$i++}' (5 runs):
     3,859,640,318      instructions              #    2.00  insns per cycle          (25.09%)

IE: when swapping runops_debug for runops_standard, the instruction
count predictably goes up: by 3.8/3.4 = 1.12 in these results.
Subject to many caveats, this is a reasonable estimate of the
worst-case cost overhead of OP-counting.

NB: the insns per cycle above are garbage, on this older 32bit box.
but the instruction counts look plausible (I didnt look at the
assembly code), and the per-cycle numbers are sane on a 64bit cpu
(with a newer PMU).

7 years agoperldelta for 23695c073f41
Tony Cook [Tue, 10 May 2016 00:52:19 +0000 (10:52 +1000)]
perldelta for 23695c073f41

7 years agoFix the Configure escape with usecrosscompile but no targethost
Niko Tyni [Sun, 10 Jan 2016 20:35:53 +0000 (22:35 +0200)]
Fix the Configure escape with usecrosscompile but no targethost

Commit 97076f2 added a graceful exit to Configure when targethost is
not defined but usecrosscompile is. However, this is not reached because
there is a similar check a bit earlier that makes Configure bail out.

Make the earlier check warn instead of croaking.

The use case for this combination is supplying an external config.sh
suitable for the target platform, avoiding the need for configuration
probes.

7 years agoUpdate to IPC-SysV 2.07 from CPAN
Jarkko Hietaniemi [Mon, 9 May 2016 22:27:40 +0000 (18:27 -0400)]
Update to IPC-SysV 2.07 from CPAN

No functional changes (the customized 2.06_01 already had them).

7 years agoFix test failure in lib/perl5db.t when mandoc is installed
Andreas Voegele [Tue, 26 Apr 2016 07:08:50 +0000 (09:08 +0200)]
Fix test failure in lib/perl5db.t when mandoc is installed

7 years agolocale.c, sv.c: Add, fix some comments
Karl Williamson [Sat, 9 Apr 2016 21:03:48 +0000 (15:03 -0600)]
locale.c, sv.c: Add, fix some comments

And a couple empty lines

7 years agolocale.c: Some nano-optimizations
Karl Williamson [Sat, 9 Apr 2016 21:16:59 +0000 (15:16 -0600)]
locale.c: Some nano-optimizations

Reorder two branches so the most likely is tested before the much less
likely, and add some UNLIKELY()

7 years agolocale.c: Clarify a debugging statement
Karl Williamson [Sat, 9 Apr 2016 20:47:21 +0000 (14:47 -0600)]
locale.c: Clarify a debugging statement

7 years agoPOSIX.pod: Add some caveats about strcoll(), strxfrm()
Karl Williamson [Fri, 8 Apr 2016 19:46:24 +0000 (13:46 -0600)]
POSIX.pod: Add some caveats about strcoll(), strxfrm()

7 years agoFinish mathomizing Perl_instr.
Craig A. Berry [Thu, 7 Apr 2016 01:59:12 +0000 (20:59 -0500)]
Finish mathomizing Perl_instr.

fea1d2dd5d210564d4 turned instr into a macro.  It also left the
actual function in util.c while commenting out the prototype
in proto.h (via the m flag in embed.fnc).

A function compiled without a prototype under C++ does not get
declared with extern "C" and thus gets mangled, which breaks the
build with a strict linker (VMS, possibly AIX) because the
expected symbol name is no longer produced.  Without a strict
linker, it just breaks the binary compatibility that was presumably
the nominal reason for leaving the function around in the first
place.

So move the function into mathoms.c and put its prototype in the
extern "C"-guarded section at the top of the same file.

We also have to fake the PERL_ARGS_ASSERT_INSTR macro since its
original declaration in proto.h is commented out but the porting
test t/porting/args_assert.t will take revenge if it doesn't
find the macro being used somewhere.

7 years agoReinstate "Make instr() a macro"
Karl Williamson [Fri, 8 Apr 2016 18:34:09 +0000 (12:34 -0600)]
Reinstate "Make instr() a macro"

This reverts commit 2e08dfb2b133af0fbcb4346f8d096ca68454ca54, thus
reinstating the commit it reverted.   This was delayed until 5.25.  The
next commit will solve some problems with c++ that this commit causes

7 years agoRequire literal '{' in patterns to be escaped
Karl Williamson [Fri, 8 Apr 2016 18:13:06 +0000 (12:13 -0600)]
Require literal '{' in patterns to be escaped

This has been deprecated since v5.16, with a deprecation message
displayed starting in v5.22.

7 years agoext/B/t/OptreeCheck.pm: Escape literal pattern '{'
Karl Williamson [Fri, 8 Apr 2016 18:07:05 +0000 (12:07 -0600)]
ext/B/t/OptreeCheck.pm: Escape literal pattern '{'

The deprecated warnings were getting suppressed, but literal '{' in
patterns needs to be escaped.

7 years agoMake deprecated qr//xx fatal
Karl Williamson [Tue, 29 Mar 2016 03:26:41 +0000 (21:26 -0600)]
Make deprecated qr//xx fatal

This has been deprecated since v5.22

7 years agoRemove deprecated literal control char variable names
Karl Williamson [Tue, 29 Mar 2016 03:15:50 +0000 (21:15 -0600)]
Remove deprecated literal control char variable names

These were deprecated in v5.20

7 years agotoke.c: Fix comment
Karl Williamson [Tue, 29 Mar 2016 03:14:58 +0000 (21:14 -0600)]
toke.c: Fix comment

7 years agoStop accepting deprecated NBSP in \N{}
Karl Williamson [Tue, 29 Mar 2016 03:04:40 +0000 (21:04 -0600)]
Stop accepting deprecated NBSP in \N{}

As scheduled for 5.26, this construct will no longer be accepted.

7 years agomktables: Don't destroy a data structure too soon.
Karl Williamson [Mon, 28 Mar 2016 03:39:28 +0000 (21:39 -0600)]
mktables: Don't destroy a data structure too soon.

It can happen that one table depends on another table for its
contents.  This adds a crude mechanism to prevent the depended-upon
table from being destroyed prematurely.  So far this has only shown up
during debugging, but it could have happened generally.

7 years agomktables: Add info under -annotate option
Karl Williamson [Tue, 5 Jan 2016 05:09:55 +0000 (22:09 -0700)]
mktables: Add info under -annotate option

This adds some helpful text when this option is used, which is for examining the Unicode database in great detail

7 years agomktables: Add stack trace facility
Karl Williamson [Mon, 28 Mar 2016 03:36:05 +0000 (21:36 -0600)]
mktables: Add stack trace facility

This can be used for debugging.

7 years agoCall PERL_ASYNC_CHECK when we backtrack in the regex engine
Yves Orton [Tue, 15 Mar 2016 20:07:05 +0000 (21:07 +0100)]
Call PERL_ASYNC_CHECK when we backtrack in the regex engine

7 years ago[perl #127877] Emit undef warning on sassign+concat
Aaron Crane [Sun, 8 May 2016 17:13:30 +0000 (18:13 +0100)]
[perl #127877] Emit undef warning on sassign+concat

Code like this:

    my $x;
    $x .= 'a';

is specifically exempted from "use of uninitialized value" warnings,
according to the "Declarations" section of perlsyn, to allow the idiom of
building up a value piecemeal. The same is true of the += and -= operators.
However, breaking the combined assignment up into the underlying operator
and a simple assignment, as in this code:

    my $x;
    $x = $x . 'a';

*should* produce a warning.

That warning was correctly being emitted for addition and subtraction, but
concatenation was behaving as the ".=" case, because "$x = $x . EXPR" is
optimized to the equivalent of "$x .= EXPR".

So we now explicitly detect this case, and emit the desired warning.