This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
8 years agoDocument and ensure that sv_catpvf() does no argument ordering
Aaron Crane [Tue, 7 Jul 2015 17:16:36 +0000 (18:16 +0100)]
Document and ensure that sv_catpvf() does no argument ordering

sv_catpvf() and friends ultimately end up calling sv_vcatpvfn_flags() with a
C-style va_list argument (rather than with an array of SV pointers). When
the sprintf implementation in sv_vcatpvfn_flags() is called with a va_list
it always ignores any attempt by the format string to reorder the arguments.
This reasonable limitation is now documented, and the implementation throws
an exception when it encounters this situation.

Minimal tests for these exceptions have been added to XS::APItest.

8 years agoSupport reordered precision arguments in (s)printf
Aaron Crane [Tue, 7 Jul 2015 16:12:26 +0000 (17:12 +0100)]
Support reordered precision arguments in (s)printf

The printf builtins gained support for argument reordering in October 2000,
in eb3fce905f8436bbc374998ec8c7c34ce2b73e4e, as part of the 5.7.x blead
release cycle. However, a simple typo meant that it never worked: the
initial implementation stored the argument index in the variable "ewix"
(explicit width-argument index) instead of "epix" (for "precision").

The bug was noticed in July 2002, two days before the 5.8.0 release, so
fixing it at that stage was deemed riskier than documenting it. The commit in
question is 7b8dd722af72d0ca45650fb784c09763c0732e34, which was originally
posted as http://marc.info/?l=perl5-porters&m=102683138220786&w=2 .

For whatever reason, the obvious fix was never subsequently applied. This
commit remedies that, and extends it to also skip all redundant-argument
warnings when the precision is supplied with via an explicit index.

8 years agosv_vcatpvfn_flags(): make warnings more precise
Aaron Crane [Mon, 29 Jun 2015 15:35:11 +0000 (16:35 +0100)]
sv_vcatpvfn_flags(): make warnings more precise

- RT#125469 points out that no "redundant argument" warning should be emitted
  for code like C<< printf '<%*2$s>', "a", 6 >>; that's now fixed.

- We no longer emit a "missing argument" warning for invalid format strings,
  so C<< printf '%4$K %d', 17 >> now emits one "invalid" warning, and no
  other warnings. (Perl 5.12 and subsequent versions have inappropriately
  emitted a "missing argument" warning in this case.)

- We no longer treat the invalid format string in C<< printf '%1$$d', 17 >>
  as containing an explicit index, so (a) we emit an "invalid" warning for
  the double "$", and (b) we emit a "redundant argument" warning for the
  trailing argument. The "redundant argument" warning is new in this
  situation.

8 years agot/op/sprintf.t: include test comment in "ok" output, where available
Aaron Crane [Mon, 29 Jun 2015 15:34:45 +0000 (16:34 +0100)]
t/op/sprintf.t: include test comment in "ok" output, where available

8 years agoUpgrade Unicode-Normalize from version 1.18 to 1.19
Steve Hay [Tue, 14 Jul 2015 08:29:06 +0000 (09:29 +0100)]
Upgrade Unicode-Normalize from version 1.18 to 1.19

8 years agoUpgrade Unicode-Collate from version 1.12 to 1.14
Steve Hay [Tue, 14 Jul 2015 08:26:59 +0000 (09:26 +0100)]
Upgrade Unicode-Collate from version 1.12 to 1.14

8 years agoUpgrade autodie from version 2.28 to 2.29
Steve Hay [Tue, 14 Jul 2015 08:25:08 +0000 (09:25 +0100)]
Upgrade autodie from version 2.28 to 2.29

8 years agotoke.c: Move macro definition
Karl Williamson [Mon, 13 Jul 2015 18:08:32 +0000 (12:08 -0600)]
toke.c: Move macro definition

This moves the definition to before the function it is used in, rather
than disrupting the flow of code within the function.

8 years agoForbid variable names with ASCII non-graphic chars
Karl Williamson [Sat, 11 Jul 2015 18:19:59 +0000 (12:19 -0600)]
Forbid variable names with ASCII non-graphic chars

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

Also, the documentation has been updated beyond this change to clarify
related matters, based on some experimentation.

Previously, spaces couldn't be in variable names; now ASCII control
characters can't be either.  The remaining permissible ASCII characters
in a variable name now must be all graphic ones.

8 years agoperldata: Change pod to reflect reality
Karl Williamson [Sun, 12 Jul 2015 04:37:35 +0000 (22:37 -0600)]
perldata: Change pod to reflect reality

Caret variable names don't have to be limited to $^A through $^Z.  $^],
etc. are also valid.

8 years agotoke.c: Comments, white-space only
Karl Williamson [Sun, 12 Jul 2015 04:39:54 +0000 (22:39 -0600)]
toke.c: Comments, white-space only

Add some clarifying comments, and properly indent some lines to
prevailing level.

8 years agouni/variables.t: Add TODO tests
Karl Williamson [Sat, 11 Jul 2015 18:03:20 +0000 (12:03 -0600)]
uni/variables.t: Add TODO tests

These show a bug in perl parsing where utf8ness makes a difference.
in what happens.  In this case, a syntax error is accompanied by warning
messages when in 'use utf8', and no warnings when not.  I'm not filing a
bug report, as I don't think it is worth fixing, as it is a syntax error
after all.  But I did make tests for it, as TODOs.

8 years agouni/variables.t: Output unexpected warnings
Karl Williamson [Sat, 11 Jul 2015 18:08:42 +0000 (12:08 -0600)]
uni/variables.t: Output unexpected warnings

This helps debug when the test fails.

8 years agouni/variables.t: Fix grammar in comment
Karl Williamson [Sat, 11 Jul 2015 18:01:54 +0000 (12:01 -0600)]
uni/variables.t: Fix grammar in comment

8 years agoEliminate repetitious wording in perldiag
Aaron Crane [Thu, 25 Jun 2015 12:50:43 +0000 (13:50 +0100)]
Eliminate repetitious wording in perldiag

8 years agoDelete experimental autoderef feature
Aaron Crane [Thu, 11 Jun 2015 16:24:13 +0000 (17:24 +0100)]
Delete experimental autoderef feature

8 years agoregen/regcharclass.pl: avoid autoderef feature
Aaron Crane [Wed, 24 Jun 2015 20:17:17 +0000 (21:17 +0100)]
regen/regcharclass.pl: avoid autoderef feature

8 years agoPorting/corelist.pl: avoid autoderef feature
Aaron Crane [Wed, 24 Jun 2015 20:14:49 +0000 (21:14 +0100)]
Porting/corelist.pl: avoid autoderef feature

8 years agoMake postfix dereferencing work without the postderef feature
Aaron Crane [Mon, 13 Jul 2015 11:58:51 +0000 (12:58 +0100)]
Make postfix dereferencing work without the postderef feature

The feature still exists, for compatibility with code that tries to enable
it, but it has no effect. The postderef_qq feature still exists, however.

8 years agochdir.t fix-up for VMS.
Craig A. Berry [Sun, 12 Jul 2015 21:33:26 +0000 (16:33 -0500)]
chdir.t fix-up for VMS.

There is no problem with setting or deleting HOME as there was
back in 58277c145607d, but there is still no way to delete
SYS$LOGIN from the job table.  So we do have to skip testing for
what happens with chdir() when the environment is clear, but it's
not conditional on $Config{d_setenv}.

8 years agoDocument $OLD_PERL_VERSION's history
Karen Etheridge [Thu, 9 Jul 2015 19:10:26 +0000 (12:10 -0700)]
Document $OLD_PERL_VERSION's history

$OLD_PERL_VERSION was added commented-out in Perl 5.6.0, when $PERL_VERSION
became $^V. It remained unimplemented and undocumented until it was added to
perlvar.pod, in the deprecated section, in 5.13.10. It was then implemented in
English.pm in 5.19.10, but remained undocumented until 5.22.0.

8 years agoUse CRTL getlogin and getlogin_r on VMS.
Craig A. Berry [Sun, 12 Jul 2015 03:37:56 +0000 (22:37 -0500)]
Use CRTL getlogin and getlogin_r on VMS.

The CRTL has supplied getlogin since v7.0, so let's not use the
home-made one anymore.  Plus the CRTL als has a reentrant version,
so we'll use that under threads.

8 years agoModule::CoreList->find_version(): refactor for testability.
James E Keenan [Wed, 8 Jul 2015 00:14:58 +0000 (20:14 -0400)]
Module::CoreList->find_version(): refactor for testability.

In order to address weaknesses in the documentation of find_version() in
CoreList.pod, we first had to address its lack of unit tests.  It was
previously only exercised inside the 'corelist' utility.  Refactored
function a bit to expose all its branches for testing.  Then added tests
for the function with and without arguments.  Corrected documentation
for find_version() in CoreList.pod.

Documentation subsequently clarified per feedback from Steve Parker.

For: RT # 125563 (1st of 2 problems cited in that ticket).

8 years agoClarify that deprecated_in() returns a perl version.
James E Keenan [Tue, 7 Jul 2015 22:59:40 +0000 (18:59 -0400)]
Clarify that deprecated_in() returns a perl version.

I.e., a string like 5.010001.  This makes documentation of deprecated_in()
consistent with that of other Module::CoreList functions.

For: RT # 125563 (2nd of two problems raised)

8 years agoRemove obsolete __GNUC__isms under vms/.
Craig A. Berry [Thu, 9 Jul 2015 23:06:00 +0000 (18:06 -0500)]
Remove obsolete __GNUC__isms under vms/.

There used to be some version of GCC 2.x that ran only on VAX that
was capable of building Perl.  But that was 18-20 years ago and
there have been no recent reports of building Perl with gcc on VMS.

If and when a modern version of GCC is ported to VMS (and the
underpinnings are reportedly there as part of GNAT Pro Ada, just
nothing complete or publicly available), these ancient workarounds
are at least as likely to do harm as good.  So get rid of them.

8 years agoDon't create zero-length filename on VMS in Typemap.t
Craig A. Berry [Thu, 9 Jul 2015 22:31:40 +0000 (17:31 -0500)]
Don't create zero-length filename on VMS in Typemap.t

It turns out it's quite legal but then causes other mayhem, such
as confusing things that are looking for the "." directory (because
there is no such thing as a file without an extension so passing
an empty string to fopen creates ".;1" on disk).

Also make this test clean up its test files.

8 years agoimprove debugging of padlist API
Daniel Dragan [Thu, 2 Jul 2015 21:15:19 +0000 (17:15 -0400)]
improve debugging of padlist API

xpadl_alloc should really be pointer to a struct with a flexible array
member, but flexible array members aren't portable enough among CCs. While
debugging the padlist API for memory corruption (caused by an unrelated
XS module), I saw that the pointer in the first slice of xpadl_alloc
pointed to an AV head of gibberish but 2nd slice was fine. This was
confusing and led me to belive the memory corruption was a bad write to
the array in xpadl_alloc. PadlistARRAY's POD a couple pages down mentions
that index 0 is not an AV *, but the struct comments just said
"pointer to beginning of array of AVs " and didnt mention index 0.

Fix the comments to make it clear what xpadl_alloc is. Add a union so it
is easier to analyze a crash dump/breakpoint with a C debugger, without
writing new code "PADNAMELIST * pnl =  PadlistNAMES(pl);" in many places
and recompiling the interp with -O0, just to be able to inspect the
padnamelist struct.

8 years agoperldelta: Fix typo
Karl Williamson [Wed, 8 Jul 2015 16:07:06 +0000 (10:07 -0600)]
perldelta: Fix typo

8 years agoall SV inheriter types have DEBUG_LEAKING_SCALARS data, so always show it
Daniel Dragan [Thu, 2 Jul 2015 21:22:09 +0000 (17:22 -0400)]
all SV inheriter types have DEBUG_LEAKING_SCALARS data, so always show it

I noticed AV *s in my C debugger didn't the sv_debug_* members, but if I
casted the AV * to a SV * in my C debugger using a expession in my watch
tab, all the info was there. Put the DEBUG_LEAKING_SCALARS in
_SV_HEAD_UNION so the sv_debug_* members appear everywhere (CV/HV/AV/etc),
not just for SVs.

8 years agodont report a $@ exception with uninitialized $!'s message in IPC::Open3
Daniel Dragan [Tue, 7 Jul 2015 16:59:01 +0000 (12:59 -0400)]
dont report a $@ exception with uninitialized $!'s message in IPC::Open3

Commit a24d8dfd08 "Make IPC::Open3 work without fork()" from 5.003 created
an eval block, and if that eval block threw an exception, instead of
propagating $@, the code propagated $!, even though no system call was done
and $! is effectivly unintialized data. In one case for me, a taint
exception inside system was turned into open3() throwing an exception
about "Inappropriate I/O control operation" or "Bad file descriptor", which
had nothing to do with the real fault which was a Perl C level croak with
the message "Insecure $ENV{PATH} while running with -T switch at ..."
which was called as Perl_pp_system->Perl_taint_env->Perl_taint_proper->
Perl_croak->Perl_vcroak. This patch does not try to fix the ambiguity of
the error messages between the !DO_SPAWN and IO::Pipe
branches/implementations of _open3.

8 years agofix #124181 double free/refcnt problems in IO types in typemap
Daniel Dragan [Wed, 24 Jun 2015 19:48:12 +0000 (15:48 -0400)]
fix #124181 double free/refcnt problems in IO types in typemap

commit 50e5165b96 "stop T_IN/OUT/INOUT/STDIO typemaps leaking" changed
newRV to newRV_noinc, but the GV * returned by newGVgen() is owned by the
package tree, like the SV * returned by get_sv(). Now when the RV to GV is
freed on mortal stack, the GV * in the package tree is freed, and now there
is a freed GV * in the package tree, if you turn on "PERL_DESTRUCT_LEVEL=2"
(and perhaps DEBUGGING is needed too), the package tree is destroyed SV *
by SV *, and perl will eventually warn with
"Attempt to free unreferenced scalar" which a very bad panic type warning.

commit 50e5165b96 was reverted in commit bae466e878
"Revert "stop T_IN/OUT/INOUT/STDIO typemaps leaking" for 5.22's release
to stop the panic, but reintroduced the SV/RV leak. So fix the RV leak (the val
passed as source arg of sv_setsv) by freeing it after the copying. In a very
unlikely scenario, the RV could still leak if sv_setsv dies.

Also fix the problem, that if this OUTPUT: type is being used for an
incoming arg, not the outgoing RETVAL arg, you can't assign a new SV*
ontop of the old one, that only works for perl stack return args, so
replace "$arg = &PL_sv_undef;" with "sv_setsv($arg, &PL_sv_undef);" if its
not RETVAL, this way OUTPUT on incoming args also works if it goes down the
error path. For efficiency, in a RETVAL siutation, let the undef original
SV* in $arg which is typically obtained from sv_newmortal() by xsubpp pass
through if we error out.

Also for efficiency, if it is RETVAL (which is more common) dont do the
sv_setsv/SvREFCNT_dec_NN stuff (2 function calls), just mortalize
(1 function call) the ex-temp RV and arrange for the RV to wind up on
perl stack.

Also, the GV * already knows what HV * stash it belongs to, so avoid the
stash lookup done by gv_stashpv() and just use GvSTASH which are simple
pointer derefs.

8 years agoadd test that fails for #124181 to Typemap.t
Daniel Dragan [Sun, 10 May 2015 15:36:05 +0000 (11:36 -0400)]
add test that fails for #124181 to Typemap.t

These tests will either fail with harness, and randomly SEGV for
me, which is intentional since they are testing memory
corruption.

8 years ago[perl #125373] set $! in chdir() if env not set, clarify docs
Tony Cook [Tue, 23 Jun 2015 00:21:45 +0000 (10:21 +1000)]
[perl #125373] set $! in chdir() if env not set, clarify docs

8 years agoChange wording of warning due to Unicode Standard change
Karl Williamson [Wed, 13 May 2015 23:57:06 +0000 (17:57 -0600)]
Change wording of warning due to Unicode Standard change

Non-characters are no longer forbidden as of Unicode 7.0; they are just
"not recommended".  The wording of the warning changes accordingly.

8 years agoRegenerate Configure after backports and small fixes
H.Merijn Brand [Mon, 6 Jul 2015 14:02:15 +0000 (16:02 +0200)]
Regenerate Configure after backports and small fixes

8 years agofix variable name in case of unknown NAN
H.Merijn Brand [Mon, 6 Jul 2015 07:06:10 +0000 (09:06 +0200)]
fix variable name in case of unknown NAN

8 years agoCreate try.c afresh for pointersize test
H.Merijn Brand [Mon, 6 Jul 2015 06:31:24 +0000 (08:31 +0200)]
Create try.c afresh for pointersize test

8 years agoSome nits in perlsub
Rafael Garcia-Suarez [Mon, 6 Jul 2015 06:09:04 +0000 (08:09 +0200)]
Some nits in perlsub

- DOES was not listed in the list of methods with reserved names
- Remove one useless instance of empty list assignment
- Punctuation

8 years agoperldelta for the shift work.
Jarkko Hietaniemi [Sat, 4 Jul 2015 19:49:23 +0000 (15:49 -0400)]
perldelta for the shift work.

8 years agoperlcommunity.pod updates
Herbert Breunung [Sat, 4 Jul 2015 13:36:48 +0000 (09:36 -0400)]
perlcommunity.pod updates

edits by rjbs

8 years agorestore the perldelta changes moved from perl5230delta
Ricardo Signes [Sat, 4 Jul 2015 02:54:53 +0000 (22:54 -0400)]
restore the perldelta changes moved from perl5230delta

i.e., move them from perl5230delta to the 5.23.1 delta where they
belong

This does not re-add the module changes, as those can be generated
automatically when needed.

8 years agoremove things added to v5.23.0 delta but meant for v5.23.1
Ricardo Signes [Sat, 4 Jul 2015 02:53:10 +0000 (22:53 -0400)]
remove things added to v5.23.0 delta but meant for v5.23.1

8 years agobelatedly set up delta for 5.23.1
Ricardo Signes [Sat, 4 Jul 2015 02:47:23 +0000 (22:47 -0400)]
belatedly set up delta for 5.23.1

8 years agoFix skip count for non-fchdir like win32.
Jarkko Hietaniemi [Sat, 4 Jul 2015 00:21:47 +0000 (20:21 -0400)]
Fix skip count for non-fchdir like win32.

8 years agoTest the warnings.
Jarkko Hietaniemi [Fri, 3 Jul 2015 21:26:57 +0000 (17:26 -0400)]
Test the warnings.

Also allow running the test from the top level: ./miniperl t/op/chdir.t

8 years agoSuperfluous null ptr test warnings by clang 3.7
Jarkko Hietaniemi [Fri, 3 Jul 2015 21:17:51 +0000 (17:17 -0400)]
Superfluous null ptr test warnings by clang 3.7

... nonnull parameter 'stash' will evaluate to 'true' on
first encounter [-Wpointer-bool-conversion]

For similar changes, see 3dc78631ef832e5b64aa86228917984dc5b14f5e

8 years agogcc 5.1.0 thinks RETVAL might end up unset.
Jarkko Hietaniemi [Fri, 3 Jul 2015 14:34:39 +0000 (10:34 -0400)]
gcc 5.1.0 thinks RETVAL might end up unset.

8 years agoLeft overshift of negatives under use integer was still wrong.
Jarkko Hietaniemi [Fri, 3 Jul 2015 13:32:13 +0000 (09:32 -0400)]
Left overshift of negatives under use integer was still wrong.

Follow-up on b3498293: the -1 stuckiness on overshift should apply
only on right shift, not left shift (which should return zero).

8 years agoNon-invasive mojibake fixes
Stanislaw Pusep [Tue, 23 Jun 2015 09:43:10 +0000 (11:43 +0200)]
Non-invasive mojibake fixes

Fixing minor encoding inconsistencies found by scan_mojibake utility
(https://metacpan.org/pod/distribution/Test-Mojibake/bin/scan_mojibake)
This patch is touching only comments/POD/__DATA__

8 years agoperldelta entry for 054a3baf7ca16fe.
Craig A. Berry [Thu, 2 Jul 2015 22:48:40 +0000 (17:48 -0500)]
perldelta entry for 054a3baf7ca16fe.

8 years agoRemove gettimeofday() workarounds for VMS in util.c.
Craig A. Berry [Thu, 2 Jul 2015 22:49:48 +0000 (17:49 -0500)]
Remove gettimeofday() workarounds for VMS in util.c.

VMS has had gettimeofday() since v7.0, released in 1999, so there's
no reason now to be special casing native workarounds.

8 years agoVarious corrections to Porting/Maintainers.pl
Steve Hay [Wed, 1 Jul 2015 07:47:51 +0000 (08:47 +0100)]
Various corrections to Porting/Maintainers.pl

8 years agoUpgrade Encode from version 2.73 to 2.75
Steve Hay [Tue, 30 Jun 2015 12:37:33 +0000 (13:37 +0100)]
Upgrade Encode from version 2.73 to 2.75

8 years agoUpgrade Socket from version 2.019 to 2.020
Steve Hay [Tue, 30 Jun 2015 07:51:45 +0000 (08:51 +0100)]
Upgrade Socket from version 2.019 to 2.020

8 years agoRemove NEW_ from PERL_NEW_COPY_ON_WRITE
Father Chrysostomos [Mon, 29 Jun 2015 01:30:29 +0000 (18:30 -0700)]
Remove NEW_ from PERL_NEW_COPY_ON_WRITE

8 years agoRemove SvRELEASE_IVX
Father Chrysostomos [Mon, 29 Jun 2015 01:27:45 +0000 (18:27 -0700)]
Remove SvRELEASE_IVX

Now that PERL_OLD_COPY_ON_WRITE is gone, it no longer does anything.

8 years agoRemove PERL_OLD_COPY_ON_WRITE
Father Chrysostomos [Mon, 29 Jun 2015 01:26:42 +0000 (18:26 -0700)]
Remove PERL_OLD_COPY_ON_WRITE

8 years ago[perl #125305] handle chdir to closed handle correctly
Tony Cook [Thu, 25 Jun 2015 03:58:57 +0000 (13:58 +1000)]
[perl #125305] handle chdir to closed handle correctly

8 years agobop.t -w clean
Jarkko Hietaniemi [Sun, 28 Jun 2015 15:32:43 +0000 (11:32 -0400)]
bop.t -w clean

8 years agoDocument the new shift behaviors.
Jarkko Hietaniemi [Sun, 28 Jun 2015 12:47:25 +0000 (08:47 -0400)]
Document the new shift behaviors.

8 years agoExplicitly mention that even negative shiftees become UVs first.
Jarkko Hietaniemi [Sun, 28 Jun 2015 12:41:34 +0000 (08:41 -0400)]
Explicitly mention that even negative shiftees become UVs first.

8 years agoDefine left/right shift by negative to mean the reverse shift
Jarkko Hietaniemi [Sun, 28 Jun 2015 02:51:38 +0000 (22:51 -0400)]
Define left/right shift by negative to mean the reverse shift

Coverity CIDs 104765 and 104766

While at it, also define shifting by more than wordsize in bits to be
zero, except that undef 'use integer' (use IVs) right overshift for
negative shiftees means -1.  (This is another corner where C leaves
things undefined.  A common behavior is "shift by modulo worbits",
so that e.g. 1 >> 64 == 1 >> (64 % 64) == 1 >> 0, but this is completely
accidental.)  (Coverity didn't flag this, harder to detect statically.)

Discussion thread at
http://www.nntp.perl.org/group/perl.perl5.porters/2015/06/msg228842.html

8 years agoRequire v7.3-2 or later for VMS builds.
Craig A. Berry [Sun, 28 Jun 2015 17:37:27 +0000 (12:37 -0500)]
Require v7.3-2 or later for VMS builds.

OpenVMS v7.3-2 was released in 2003.  Regular support ended in 2006
and even prior version support will be ending in 2015, so this
seems like a pretty generous minimum for future Perl versions.

A side of effect of this is that OpenVMS VAX will no longer be
supported.  The terminal software release for VAX was v7.3 in 2001
with support ending in 2012.  VAX was a truly great architecture
in the 1970s, 1980s, and 1990s, but it's just missing too many of
the things expected in architectures, file systems and C run-times
of the current century.

De-supporting this older stuff allows quite a bit of code removal
and simplification, hopefully easing the maintenance burden a bit.

8 years agoThe postderef feature is no longer experimental
Aaron Crane [Thu, 11 Jun 2015 12:26:53 +0000 (13:26 +0100)]
The postderef feature is no longer experimental

As proposed by RJBS.

The "5.24" feature bundle (and therefore C<< use v5.24 >>) now enable
postderef and postderef_qq.

I can't find any precedent for what to do with the relevant experimental::*
warnings category when an experimental feature graduates to acceptance. I
have elected to leave the category in place, so that code doing C<< no
warnings "experimental::postderef" >> will continue to work. This means that
C<< use warnings "experimental::postderef" >> is also accepted, but has no
effect.

8 years agoPorting/bisect-runner.pl: Wrap pod lines to 79 cols
Karl Williamson [Sat, 27 Jun 2015 18:57:03 +0000 (12:57 -0600)]
Porting/bisect-runner.pl: Wrap pod lines to 79 cols

8 years agoIncrement $VERSION in 4 .pm files whose .xs has changed.
James E Keenan [Sat, 27 Jun 2015 17:51:28 +0000 (13:51 -0400)]
Increment $VERSION in 4 .pm files whose .xs has changed.

Storable.pm
I18N-Langinfo.pm
POSIX.pm
scalar.pm

8 years agoMissing breaks.
Jarkko Hietaniemi [Wed, 24 Jun 2015 22:45:16 +0000 (18:45 -0400)]
Missing breaks.

Coverity CIDs 118700 and 118701.

8 years agoCannot truncate to negative size.
Jarkko Hietaniemi [Fri, 26 Jun 2015 00:03:38 +0000 (20:03 -0400)]
Cannot truncate to negative size.

Coverity CID 104848

8 years agomkdir() mode is unsigned.
Jarkko Hietaniemi [Thu, 25 Jun 2015 01:25:44 +0000 (21:25 -0400)]
mkdir() mode is unsigned.

Coverity CID 104787.

Of course we could join the new millennium and use mode_t.

8 years agogid_t signedness.
Jarkko Hietaniemi [Thu, 25 Jun 2015 01:23:06 +0000 (21:23 -0400)]
gid_t signedness.

Coverity CID 104786.

8 years agoself cannot be NULL here because PerlIO_push() will deref it.
Jarkko Hietaniemi [Thu, 25 Jun 2015 00:54:07 +0000 (20:54 -0400)]
self cannot be NULL here because PerlIO_push() will deref it.

Coverity CID 104779.

Follow-up on Coverity CID 28973, and the respective commit 316ebaf2.

8 years agoassert(arg) before derefing it since it can be NULL.
Jarkko Hietaniemi [Thu, 25 Jun 2015 01:03:21 +0000 (21:03 -0400)]
assert(arg) before derefing it since it can be NULL.

Coverity CID 104813.

8 years agoassert(cSVOPo) before derefing it.
Jarkko Hietaniemi [Thu, 25 Jun 2015 00:19:55 +0000 (20:19 -0400)]
assert(cSVOPo) before derefing it.

8 years agoassert(key) before it is derefed.
Jarkko Hietaniemi [Wed, 24 Jun 2015 23:52:27 +0000 (19:52 -0400)]
assert(key) before it is derefed.

Coverity CID 104855.

8 years agoassert(perinterp_sv) before sv_setiv() derefs NULL.
Jarkko Hietaniemi [Thu, 25 Jun 2015 00:14:39 +0000 (20:14 -0400)]
assert(perinterp_sv) before sv_setiv() derefs NULL.

Coverity CID 104842.

8 years agoCheck success of store().
Jarkko Hietaniemi [Thu, 25 Jun 2015 00:00:55 +0000 (20:00 -0400)]
Check success of store().

Coverity CID 118699.

8 years agoThere is no SSize_t_size.
Jarkko Hietaniemi [Thu, 25 Jun 2015 01:58:51 +0000 (21:58 -0400)]
There is no SSize_t_size.

Coverity CID 104775.

Seemed to be the only one.

8 years agoIf IVSIZE == LONGSIZE, long cannot be beyond IV_MIN/IV_MAX.
Jarkko Hietaniemi [Wed, 24 Jun 2015 02:28:57 +0000 (22:28 -0400)]
If IVSIZE == LONGSIZE, long cannot be beyond IV_MIN/IV_MAX.

It can be if LONGSIZE > IVSIZE, which should be rather rare
(since Perl aims for at least long, someone would have to
force IV to be 32 bits?)

Coverity CID 104770.

8 years agolseek() SEEK_SET pos may not be negative
Jarkko Hietaniemi [Fri, 26 Jun 2015 12:03:14 +0000 (08:03 -0400)]
lseek() SEEK_SET pos may not be negative

Coverity CID 104832

8 years agonl_langinfo code can be negative.
Jarkko Hietaniemi [Thu, 25 Jun 2015 12:41:13 +0000 (08:41 -0400)]
nl_langinfo code can be negative.

Coverity CID 104814.

8 years agostrtol and strtoul base should be [2, 36] or zero.
Jarkko Hietaniemi [Tue, 23 Jun 2015 11:21:03 +0000 (07:21 -0400)]
strtol and strtoul base should be [2, 36] or zero.

Coverity CID 104817 and CID 104836.

8 years agoshmat id can be invalid.
Jarkko Hietaniemi [Tue, 23 Jun 2015 11:30:58 +0000 (07:30 -0400)]
shmat id can be invalid.

Coverity CID 104852.

8 years agomsgrcv id can be invalid.
Jarkko Hietaniemi [Tue, 23 Jun 2015 11:32:43 +0000 (07:32 -0400)]
msgrcv id can be invalid.

Coverity CID 104825.

8 years agomsgsnd id can be invalid.
Jarkko Hietaniemi [Tue, 23 Jun 2015 11:26:46 +0000 (07:26 -0400)]
msgsnd id can be invalid.

Coverity CID 104833.

8 years agotcsetattr optional_actions can be invalid.
Jarkko Hietaniemi [Thu, 25 Jun 2015 12:56:59 +0000 (08:56 -0400)]
tcsetattr optional_actions can be invalid.

Coverity CID 104815.

8 years agotcsetattr fd can be bad.
Jarkko Hietaniemi [Tue, 23 Jun 2015 11:12:08 +0000 (07:12 -0400)]
tcsetattr fd can be bad.

Coverity CID 104815

8 years agodup2 fds can be bad.
Jarkko Hietaniemi [Tue, 23 Jun 2015 10:58:35 +0000 (06:58 -0400)]
dup2 fds can be bad.

Coverity CID 104812.

8 years agotcdrain fd can be bad.
Jarkko Hietaniemi [Tue, 23 Jun 2015 11:28:57 +0000 (07:28 -0400)]
tcdrain fd can be bad.

Coverity CID 104838.

8 years agotcflush/tcflow/tcsendbreak fd/action can be bad.
Jarkko Hietaniemi [Tue, 23 Jun 2015 10:55:45 +0000 (06:55 -0400)]
tcflush/tcflow/tcsendbreak fd/action can be bad.

Coverity CID 104807.

8 years agolseek fd can be bad.
Jarkko Hietaniemi [Tue, 23 Jun 2015 10:51:37 +0000 (06:51 -0400)]
lseek fd can be bad.

Coverity CID 104788

8 years agoImpossible for entry to be NULL at this point.
Jarkko Hietaniemi [Tue, 23 Jun 2015 02:47:50 +0000 (22:47 -0400)]
Impossible for entry to be NULL at this point.

740        if (return_svp) {
           notnull: At condition entry, the value of entry cannot be NULL.
           dead_error_condition: The condition entry must be true.

CID 104777: Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach the expression NULL inside this statement: return entry ? (void *)&ent....
741            return entry ? (void *) &HeVAL(entry) : NULL;

8 years agoHaving both assert() and if () for maxlen is redundant.
Jarkko Hietaniemi [Tue, 23 Jun 2015 02:25:52 +0000 (22:25 -0400)]
Having both assert() and if () for maxlen is redundant.

Coverity CID 104784

8 years agoCannot do much if putc fails in debug output.
Jarkko Hietaniemi [Tue, 23 Jun 2015 01:57:36 +0000 (21:57 -0400)]
Cannot do much if putc fails in debug output.

Coverity CID 104782 (only flagged the deb.c spot)

8 years agomg_find can return NULL.
Jarkko Hietaniemi [Tue, 23 Jun 2015 01:46:09 +0000 (21:46 -0400)]
mg_find can return NULL.

CID 104831: Dereference null return value (NULL_RETURNS)
43. dereference: Dereferencing a pointer that might be null Perl_mg_find(sv, 112) when calling Perl_magic_existspack. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
499                magic_existspack(svret, mg_find(sv, PERL_MAGIC_tiedelem));

8 years agoPossible NULL cxt derefs.
Jarkko Hietaniemi [Tue, 23 Jun 2015 01:31:36 +0000 (21:31 -0400)]
Possible NULL cxt derefs.

Coverity CIDs 104819, 104820, 104821, 104827, 104859, 104860

Using assert() instead of Storable ASSERT() because Coverity
understands the first one.

8 years agosizeof * and sizeof ** not necessarily the same.
Jarkko Hietaniemi [Mon, 22 Jun 2015 23:05:51 +0000 (19:05 -0400)]
sizeof * and sizeof ** not necessarily the same.

Coverity CID 104792.

8 years agofileno might return negative.
Jarkko Hietaniemi [Mon, 22 Jun 2015 11:25:27 +0000 (07:25 -0400)]
fileno might return negative.

(Coverity CID 104853)

Also rewrite the fstat call to test for zero (success) explicitly,
instead of the sneaky bang-negation.

8 years agosleep() with negative argument makes no sense.
Jarkko Hietaniemi [Mon, 22 Jun 2015 10:50:34 +0000 (06:50 -0400)]
sleep() with negative argument makes no sense.

Give by default a warning, do not sleep, and return zero.

(the signedness problem detected by Coverity, CID 104844)

Other options would include not giving a warning at all,
giving a warning only if asked, and finally croaking.
(Python had this problem earlier, and chose croaking.)

Earlier discussion in
http://www.nntp.perl.org/group/perl.perl5.porters/2015/03/msg226304.html

See also:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html
http://linux.die.net/man/3/sleep
https://www.freebsd.org/cgi/man.cgi?query=sleep&sektion=3

8 years agoalarm() with negative argument makes no sense.
Jarkko Hietaniemi [Thu, 5 Mar 2015 12:57:14 +0000 (07:57 -0500)]
alarm() with negative argument makes no sense.

Give by default a warning, do not set the alarm, and return undef.

(the signedness problem detected by Coverity, CID 104837)

alarm() takes and returns unsigned int, not signed.

In other words, the C library function alarm() cannot fail, ever.
See for example:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/alarm.html
http://linux.die.net/man/3/alarm
https://www.freebsd.org/cgi/man.cgi?query=alarm&sektion=3

8 years agoUpdate File::Spec advice in perlport.
Craig A. Berry [Fri, 26 Jun 2015 21:50:27 +0000 (16:50 -0500)]
Update File::Spec advice in perlport.

Eighteen years ago, with Mac OS Classic in full swing and Unix
emulation on VMS spotty or non-existent, it made some sense to
reach for File::Spec sooner rather than later.  This is no longer
sound advice, so attempt to describe succinctly how things
actually work now, fix the broken examples, and drop the ancient
history of the File::Spec module.