platform/upstream/perl.git
10 years agoAdd and use macro to return EBCDIC
Karl Williamson [Sun, 17 Feb 2013 19:46:05 +0000 (12:46 -0700)]
Add and use macro to return EBCDIC

The conversion from UTF-8 to code point should generally be to the
native code point.  This adds a macro to do that, and converts the
core calls to the existing macro to use the new one instead.  The old
macro is retained for possible backwards compatibility, though it
probably should be deprecated.

10 years agocharnames: Make work in EBCDIC
Karl Williamson [Sat, 16 Feb 2013 18:05:44 +0000 (11:05 -0700)]
charnames: Make work in EBCDIC

Now that mktables generates native tables, we need to make U+XXXX mean
Unicode instead of native.

10 years agoUnicode::UCD: Work on non-ASCII platforms
Karl Williamson [Sat, 16 Feb 2013 16:35:56 +0000 (09:35 -0700)]
Unicode::UCD: Work on non-ASCII platforms

Now that mktables generates native tables, it is a fairly simple matter
to get Unicode::UCD to work on those platforms.

10 years agomktables: Generate native code-point tables
Karl Williamson [Fri, 15 Feb 2013 05:16:38 +0000 (22:16 -0700)]
mktables: Generate native code-point tables

The output tables for mktables are now in the platform's native
character set.  This means there is no change for ASCII platforms, but
is a change for EBCDIC ones.

Code that didn't realize there was a potential difference between EBCDIC
and non-EBCDIC platforms will now start to work; code that tried to do
the right thing under these circumstances will no longer work.  Fixing
that comes in later commits.

10 years agomktables: Move table creation code
Karl Williamson [Wed, 3 Apr 2013 03:36:28 +0000 (21:36 -0600)]
mktables: Move table creation code

This code is moved later in the process.  This is in preparation for
mktables generating tables in the native character set.  By moving it to
later, the translation to native has already been done, and special
coding need not be done.

This also caught 7 code points that were omitted somehow in the previous
logic

10 years agoFix some EBCDIC problems
Karl Williamson [Thu, 14 Feb 2013 17:50:00 +0000 (10:50 -0700)]
Fix some EBCDIC problems

These spots have native code points, so should be using the macros for
native code points, instead of Unicode ones; this also changes to use
the portable symbolic name of a code point instead of the non-portable
hex.

10 years agoRemove unnecessary temp variable in converting to UTF-8
Karl Williamson [Thu, 14 Feb 2013 05:10:19 +0000 (22:10 -0700)]
Remove unnecessary temp variable in converting to UTF-8

These areas of code included a temporary that is unnecessary.

10 years agoutf8.h: Correct macros for EBCDIC
Karl Williamson [Thu, 14 Feb 2013 05:00:55 +0000 (22:00 -0700)]
utf8.h: Correct macros for EBCDIC

These macros were incorrect for EBCDIC.  The 3 step process given in
utfebcdic.h wasn't being followed.

10 years agoExtract common code to an inline function
Karl Williamson [Sun, 10 Feb 2013 04:23:30 +0000 (21:23 -0700)]
Extract common code to an inline function

This fairly short paradigm is repeated in several places; a later commit
will improve it.

10 years agoDon't use EBCDIC macro for a C language escape
Karl Williamson [Fri, 8 Feb 2013 04:35:57 +0000 (21:35 -0700)]
Don't use EBCDIC macro for a C language escape

C recognizes '\a' (for BEL); just use that instead of a look-up.

regen/unicode_constants.pl could be used to generate the character for
the ESC (set in nearby code), but I didn't do that because of
potential bootstrapping problems when porting to an EBCDIC platform
without a working perl.  (The other characters generated in that .pl are
less likely to cause problems when compiling perl.)

10 years agoUse byte domain EBCDIC/LATIN1 macro where appropriate
Karl Williamson [Fri, 8 Feb 2013 02:53:38 +0000 (19:53 -0700)]
Use byte domain EBCDIC/LATIN1 macro where appropriate

The macros like NATIVE_TO_UNI will work on EBCDIC, but operate on the
whole Unicode range.  In the locations affected by this commit, it is
known that the domain is limited to a single byte, so the simpler ones
whose names contain LATIN1 may be used.

On ASCII platforms, all the macros are null, so there is no effective
change.

10 years agoUse new clearer named #defines
Karl Williamson [Thu, 7 Feb 2013 21:31:09 +0000 (14:31 -0700)]
Use new clearer named #defines

This converts several areas of code to use the more clearly named macros
introduced in the previous commit

10 years agoutf8.h, utfebcdic.h: Create less confusing #defines
Karl Williamson [Thu, 7 Feb 2013 20:52:31 +0000 (13:52 -0700)]
utf8.h, utfebcdic.h: Create less confusing #defines

This commit creates macros whose names mean something to me, and which I
don't find confusing.  The older names are retained for backwards
compatibility.  Future commits will fix bugs I introduced from
misunderstanding the meaning of the older names.

The older names are now #defined in terms of the newer ones, and moved
so that they are only defined once, valid for both ASCII and EBCDIC
platforms.

10 years agopp_ctl.c: Use isCNTRL instead of hard-coded mask
Karl Williamson [Mon, 4 Feb 2013 21:22:02 +0000 (14:22 -0700)]
pp_ctl.c: Use isCNTRL instead of hard-coded mask

This is clearer and portable to EBCDIC.

There is a subtle difference in the behavior here, which I believe is a
bug fix.  Before, the code didn't treat DEL as a control, and now it
does.

10 years agoutf8.c: is_utf8_char_slow() should use native length
Karl Williamson [Tue, 26 Feb 2013 20:51:05 +0000 (13:51 -0700)]
utf8.c: is_utf8_char_slow() should use native length

What is passed is the actual length of the native utf8 character.  What
this was calculating was the length it would be if it were a Unicode
character, and then compared, apples to oranges.

10 years agoStop t/op/coreamp.t leaving temporary files behind
Steve Hay [Thu, 29 Aug 2013 12:55:32 +0000 (13:55 +0100)]
Stop t/op/coreamp.t leaving temporary files behind

test.pl will delete any file made by tempfile(), but it won't delete the
*.dir and *.pag files made by dbmopen. Hopefully this is the right way to
delete them, cribbed from lib/AnyDBM_File.t.

10 years agoStop t/io/utf8.t leaving a temporary file behind on Windows
Steve Hay [Thu, 29 Aug 2013 12:42:15 +0000 (13:42 +0100)]
Stop t/io/utf8.t leaving a temporary file behind on Windows

Filehandles need to be closed for unlink to work on Windows.

10 years agoPrevent ExtUtils-CBuilder leaving test output on Windows
Steve Hay [Thu, 29 Aug 2013 12:06:50 +0000 (13:06 +0100)]
Prevent ExtUtils-CBuilder leaving test output on Windows

The link function call in the have_compiler and have_cplusplus tests create
a compilet.def file on Windows which is correctly recorded for cleaning up
when the EU::CB object is destroyed, but if another one gets made in the
meantime then ExtUtils::Mksymlists::Mksymlists moves the first one to
compilet_def.old, which isn't recorded for cleaning up and gets left
behind when the test script has finished. Using a new object each time,
destroying the previous one first, prevents this.

10 years agoUpdate the comments in t/op/magic.t
Nicholas Clark [Thu, 29 Aug 2013 09:02:40 +0000 (11:02 +0200)]
Update the comments in t/op/magic.t

(This should have been part of the previous commit, but I forgot to --amend
it)

10 years ago${^MPEN} had been treated as a synonym of ${^MATCH} due to a missing break;
Nicholas Clark [Thu, 29 Aug 2013 08:47:31 +0000 (10:47 +0200)]
${^MPEN} had been treated as a synonym of ${^MATCH} due to a missing break;

A missing break; in Perl_gv_fetchpvn_flags() meant that the variable ${^MPEN}
had been behaving as a synonym of ${^MATCH}. Adding the break makes ${^MPEN}
behave like all other unused multi-character control character variable.

10 years agoperldelta - Rewordings in the light of fa3234e35d
Steve Hay [Thu, 29 Aug 2013 07:37:10 +0000 (08:37 +0100)]
perldelta - Rewordings in the light of fa3234e35d

10 years agoregen Configure after backports
H.Merijn Brand [Thu, 29 Aug 2013 07:45:07 +0000 (09:45 +0200)]
regen Configure after backports

os-types are sorted

10 years agoperl5200delta: Mention broken modules from #119463
Father Chrysostomos [Thu, 29 Aug 2013 07:12:36 +0000 (00:12 -0700)]
perl5200delta: Mention broken modules from #119463

10 years agoinline.h: Avoid redundant ckWARN call
Father Chrysostomos [Thu, 29 Aug 2013 06:12:07 +0000 (23:12 -0700)]
inline.h: Avoid redundant ckWARN call

ckWARN calls Perl_ckwarn.  So does Perl_ck_warner.  So there is no
need to use both.

10 years agoperldiag: Reword/rewrap embedded null warning
Father Chrysostomos [Thu, 29 Aug 2013 05:45:41 +0000 (22:45 -0700)]
perldiag: Reword/rewrap embedded null warning

‘syscall arguments’ implies arguments to the syscall() function,
which is not the case here.  Also reword the rest to sound better
in English.

10 years agoperlpacktut: mention h2ph
Father Chrysostomos [Thu, 29 Aug 2013 05:40:47 +0000 (22:40 -0700)]
perlpacktut: mention h2ph

Mentioning syscall.ph without saying how to get it is not
as helpful as it could be.

10 years agoIncrease $XS::APItest::VERSION to 0.56
Father Chrysostomos [Thu, 29 Aug 2013 01:36:22 +0000 (18:36 -0700)]
Increase $XS::APItest::VERSION to 0.56

10 years agoMake vivify_defelem allow &PL_sv_undef array entries
Father Chrysostomos [Thu, 29 Aug 2013 01:34:22 +0000 (18:34 -0700)]
Make vivify_defelem allow &PL_sv_undef array entries

This is something I failed to change in commit ce0d59f.  I don’t know
of a way to trigger this in pure-Perl code, hence the use of XS in
the test.  It did show up in pure-Perl code due to a bug fixed by the
previous commit.

10 years agoStop creating defelems for undef in foreach(@_)
Father Chrysostomos [Thu, 29 Aug 2013 01:20:41 +0000 (18:20 -0700)]
Stop creating defelems for undef in foreach(@_)

This is part of ticket #119433.  This particular bug is triggered by
Data::Dump’s test suite.

Commit ce0d59f changed arrays to use NULL for nonexistent elements,
instead of &PL_sv_undef (the special scalar returned by Perl’s ‘undef’
operator).

‘foreach’ was not updated to account.  It was still treating
&PL_sv_undef as a nonexistent element.  This was causing ‘Modifica-
tion of non-creatable array value attempted, subscript 0’, due to a
similar bug in vivify_defelem, which the next commit will fix.

(Fixing vivify_defelem without fixing foreach will make the test pass,
but for foreach to create a defelem to begin with is inefficient and
should be addressed anyway.)

10 years agoperldelta: typo
Father Chrysostomos [Wed, 28 Aug 2013 23:36:12 +0000 (16:36 -0700)]
perldelta: typo

10 years agormg: provide a link to edit-a-ticket page to check versions
Ricardo Signes [Thu, 29 Aug 2013 01:24:30 +0000 (21:24 -0400)]
rmg: provide a link to edit-a-ticket page to check versions

10 years agoperlhist: 5.17.11 was missing!
Ricardo Signes [Wed, 28 Aug 2013 01:15:14 +0000 (21:15 -0400)]
perlhist: 5.17.11 was missing!

10 years agoperldelta - Fill in descriptions of module upgrades and new tests
Steve Hay [Wed, 28 Aug 2013 08:26:52 +0000 (09:26 +0100)]
perldelta - Fill in descriptions of module upgrades and new tests

10 years agoMove the thrice-repeated "64bitint is buggy?" test from hints to Configure.
Nicholas Clark [Fri, 23 Aug 2013 14:32:08 +0000 (16:32 +0200)]
Move the thrice-repeated "64bitint is buggy?" test from hints to Configure.

OpenBSD and its two* forks each have the same "is 64 bit int support buggy?"
test code as a callback unit duplicated in their hints files. As the code is
portable C, there seems to be no harm in moving it to Configure, and running
the test on all platforms. This reduces code duplication, and will reduce it
further if another OpenBSD fork appears.

* This week.

10 years agoOnly predeclare S_sv_or_pv_pos_u2b for -DPERL_CORE or -DPERL_EXT
Nicholas Clark [Wed, 28 Aug 2013 08:47:42 +0000 (10:47 +0200)]
Only predeclare S_sv_or_pv_pos_u2b for -DPERL_CORE or -DPERL_EXT

Otherwise when compiling XS code, there is a declaration for a function
which is never used, which can cause some compilers to issue a warning.

10 years agomg.h: Suppress compiler warning
Father Chrysostomos [Tue, 27 Aug 2013 20:00:24 +0000 (13:00 -0700)]
mg.h: Suppress compiler warning

GCC says:
pp_hot.c: In function 'Perl_pp_match':
pp_hot.c:1453: warning: signed and unsigned type in conditional expression

10 years agoB::INVLIST isa B::PV (for now)
Reini Urban [Tue, 27 Aug 2013 16:32:02 +0000 (11:32 -0500)]
B::INVLIST isa B::PV (for now)

If the compiler stumbles over a B::INVLIST treat it as B::PV
and do not error.
Also restore rudimentary B versioning support for BIND and INVLIST.

10 years agoModule-Build wasn't listed as DEPRECATED
Chris 'BinGOs' Williams [Tue, 27 Aug 2013 19:17:24 +0000 (20:17 +0100)]
Module-Build wasn't listed as DEPRECATED

10 years agoUpdate ExtUtils-MakerMaker to CPAN version 6.74
Chris 'BinGOs' Williams [Tue, 27 Aug 2013 12:04:44 +0000 (13:04 +0100)]
Update ExtUtils-MakerMaker to CPAN version 6.74

  [DELTA]

6.74 Tue Aug 27 12:43:05 BST 2013
    No changes from 6.73_12

6.73_12 Fri Aug 23 10:49:13 BST 2013
    Bug Fixes:
    * Preserve runtime requires when PREREQ_PM argument is empty or undef
      (miyagawa)
    * RT#88037 regen run of Makefile.PL will use same -MCross arg as
      initial .PL run (bulk88)

6.73_11 Sat Aug 17 22:51:14 BST 2013
    Bug Fixes:
    * RT#87911 prepend SUFFIX with a '.' if one isn't supplied

6.73_10 Fri Aug 16 16:40:09 BST 2013
    Bug Fixes:
    * RT#87839 resolve bootstrap problems when required prereqs
      are missing

6.73_09 Fri Aug  9 19:58:32 BST 2013
    Bug Fixes:
    * Bundle code from Text::ParseWords to handle splitting
      PERL_MM_OPT (actually removing Text::ParseWords this time).

6.73_08 Fri Aug  9 19:49:27 BST 2013
    Bug Fixes:
    * Bundle code from Text::ParseWords to handle splitting
      PERL_MM_OPT.

6.73_07 Wed Aug  7 16:07:04 BST 2013
    Bug Fixes:
    * Set ACTIVEPERL_CONFIG_SILENT=1 during tests to make
      ActivePerl less vocal about things

6.73_06 Tue Aug  6 00:50:08 BST 2013
    New features:
    * RT#70201 replace -M with Time::HiRes::stat

    Bug Fixes:
    * Split PERL_MM_OPT like a shell would, instead of split ' '

    Win32 Fixes:
    * Correct an oversight with Liblist Kid fix

6.73_05 Mon Aug  5 17:44:00 BST 2013
    Win32 fixes:
    * Fix hash randomisation problems with Liblist Kid

6.73_04 Thu Aug  1 22:34:31 BST 2013
    Doc fixes:
    * Corrected example for PM => {}

6.73_03 Tue Jul 30 22:09:52 BST 2013
    Bug Fixes:
    * Fix clean_subdirs target that was generating
      warning on BSD

6.73_02 Fri Jul 26 13:32:43 BST 2013
    Misc:
    * Updated bundled Parse::CPAN::Meta

6.73_01 Wed Jul 24 23:49:56 BST 2013
    Bug Fixes:
    * Robustified parse_version()

10 years agoperldelta - Start noting module upgrades and new test files
Steve Hay [Tue, 27 Aug 2013 12:06:20 +0000 (13:06 +0100)]
perldelta - Start noting module upgrades and new test files

10 years agoperldelta - Add missing =item directive
Steve Hay [Tue, 27 Aug 2013 12:05:47 +0000 (13:05 +0100)]
perldelta - Add missing =item directive

10 years ago[perl #119311] Keep CvDEPTH and savestack in sync
Father Chrysostomos [Tue, 27 Aug 2013 06:21:26 +0000 (23:21 -0700)]
[perl #119311] Keep CvDEPTH and savestack in sync

when unwinding sub and format calls.

The comments in the added test file explain what the problem is.

The fix is to call LEAVE_SCOPE in POPSUB and POPFORMAT (to free their
lexicals) before lowering CvDEPTH.

If the context has already been popped via cxstack_ix--, then
LEAVE_SCOPE could overwrite it, so accessing cx after LEAVE_SCOPE is
unsafe.  Hence the changes to POPSUB and POPFORMAT are a bit involved.
Some callers of POPSUB do a temporary cxstack_ix++ first so they
can access cx afterwards.  Two cases needed to be changed to
work that way.

10 years ago[perl #119351] the test note isn't a note but an object description
Tony Cook [Tue, 27 Aug 2013 05:13:00 +0000 (15:13 +1000)]
[perl #119351] the test note isn't a note but an object description

avoid:

ok 239 - GV on a lexical sub isa B::SPECIAL isa B::SPECIAL

10 years agorelease schedule: Steve Hay will release in 2013-09
Ricardo Signes [Mon, 26 Aug 2013 21:55:28 +0000 (17:55 -0400)]
release schedule: Steve Hay will release in 2013-09

10 years agoperldelta for 6ca940a96, ed51a345f
Tony Cook [Mon, 26 Aug 2013 06:41:20 +0000 (16:41 +1000)]
perldelta for 6ca940a96ed51a345f

10 years ago[perl #85104] save platform specific error code across signal handlers
Tony Cook [Mon, 26 Aug 2013 06:32:48 +0000 (16:32 +1000)]
[perl #85104] save platform specific error code across signal handlers

This was previously done for VMS, add it (tested) for Win32 and
(untested) for OS/2.

10 years ago[perl #85104] work harder to save error numbers
Tony Cook [Mon, 26 Aug 2013 05:07:44 +0000 (15:07 +1000)]
[perl #85104] work harder to save error numbers

Updates the errno save macros to save the platform error number where
needed for more than just VMS.

The OS/2 code is untested.

10 years ago[perl #85104] TODO test for preserving $^E across signal handlers
Tony Cook [Mon, 26 Aug 2013 05:32:36 +0000 (15:32 +1000)]
[perl #85104] TODO test for preserving $^E across signal handlers

and tests Win32 signal emulation too

10 years agoperldelta for c8028aa68
Tony Cook [Mon, 26 Aug 2013 04:35:17 +0000 (14:35 +1000)]
perldelta for c8028aa68

10 years agofix a type in the find2perl perldelta entry
Tony Cook [Mon, 26 Aug 2013 04:34:41 +0000 (14:34 +1000)]
fix a type in the find2perl perldelta entry

10 years ago[perl #117265] safesyscalls: check embedded nul in syscall args
Tony Cook [Mon, 26 Aug 2013 01:26:19 +0000 (11:26 +1000)]
[perl #117265] safesyscalls: check embedded nul in syscall args

Check for the nul char in pathnames and string arguments to
syscalls, return undef and set errno to ENOENT.
Added to the io warnings category syscalls.

Strings with embedded \0 chars were prev. ignored in the syscall but
kept in perl. The hidden payloads in these invalid string args may cause
unnoticed security problems, as they are hard to detect, ignored by
the syscalls but kept around in perl PVs.
Allow an ending \0 though, as several modules add a \0 to
such strings without adjusting the length.

This is based on a change originally by Reini Urban, but pretty much
all of the code has been replaced.

10 years ago[perl #119351] update the test note for the changed B::CV::GV test
Tony Cook [Mon, 26 Aug 2013 01:35:21 +0000 (11:35 +1000)]
[perl #119351] update the test note for the changed B::CV::GV test

10 years agoperldelta for f244b0855, d80ab086, 4883c539
Tony Cook [Sun, 25 Aug 2013 23:26:15 +0000 (09:26 +1000)]
perldelta for f244b0855d80ab0864883c539

10 years ago[perl #119351] fix regression in B::CV::GV
Tony Cook [Sun, 25 Aug 2013 23:04:47 +0000 (09:04 +1000)]
[perl #119351] fix regression in B::CV::GV

The fix for [perl #118525] introduced a regression in the behavior of
B::CV::GV.

Previously it would return a B::SPECIAL when the GV slot was NULL, the
incorrect fix changed it to return undef.

This change fixes B::CV::GV to return a B::SPECIAL for NULL for both
B::main_cv and for B::CV objects created from lexical subs.

10 years agobump B to 1.46
Tony Cook [Sun, 25 Aug 2013 23:03:56 +0000 (09:03 +1000)]
bump B to 1.46

10 years ago[perl #119351] fix B::CV::GV to return a B::SPECIAL on NULL
Tony Cook [Wed, 21 Aug 2013 23:38:24 +0000 (09:38 +1000)]
[perl #119351] fix B::CV::GV to return a B::SPECIAL on NULL

10 years agoIncrease $re::VERSION to 0.26
Father Chrysostomos [Sun, 25 Aug 2013 20:20:57 +0000 (13:20 -0700)]
Increase $re::VERSION to 0.26

10 years agoCorrect sub signature in re.xs
Father Chrysostomos [Sun, 25 Aug 2013 20:18:45 +0000 (13:18 -0700)]
Correct sub signature in re.xs

10 years agoFix assert fail when fetching pos clobbers ref with undef
Father Chrysostomos [Fri, 26 Jul 2013 08:26:54 +0000 (01:26 -0700)]
Fix assert fail when fetching pos clobbers ref with undef

pos($x) returns a special magical scalar that sets the match position
on $x.  Calling pos($x) twice will provide two such scalars.  If we
set one of them to a reference, set the other to undef, and then read
the first, all hail breaks loose, because of the use of SvOK_off.

SvOK_off is not sufficient if arbitrary values can be assigned by Perl
code.  Globs, refs and regexps (among others) need special handling,
which sv_setsv knows how to do.

10 years agoStop values from ‘sticking’ to @- and @+ elems
Father Chrysostomos [Fri, 26 Jul 2013 01:08:23 +0000 (18:08 -0700)]
Stop values from ‘sticking’ to @- and @+ elems

These arrays are very similar to tied arrays, in that the elements are
created on the fly when looked up.  So push @_, \$+[0], \$+[0], will
push references to two different scalars on to @_.

That they are created on the fly prevents this bug from showing up
in most code:  If you reference the element you can observe that, on
FETCH, it gets set to the corresponding offset *if* the last match has
a set of capturing parentheses with the right number.  Otherwise, the
value in the element is left as-is.

So, doing another pattern match with, say, 5 captures and then another
with fewer will leave $+[5] and $-[5] holding values from the first
match, if there is a FETCH in between the two matches:

$ perl -le '"  "=~/()()()()(..)/; $_ = \$+[5]; print $$_; ""=~ /()/; print $$_;'
2
2

And attempts at assignment will succeed, even though they croak:

$ perl -le 'for ($-[0]) { eval { $_ = *foo }; print $_ }'
*main::foo

The solution here is to make the magic ‘get’ handler set the SV
no matter what, instead of just setting it when it refers to a
valid offset.

10 years agopp_hot.c: Show lengths in -Dr output for minlen optimisation
Father Chrysostomos [Thu, 25 Jul 2013 01:14:06 +0000 (18:14 -0700)]
pp_hot.c: Show lengths in -Dr output for minlen optimisation

10 years ago[Merge] Regexp long string support
Father Chrysostomos [Sun, 25 Aug 2013 19:24:04 +0000 (12:24 -0700)]
[Merge] Regexp long string support

10 years agoUse SSize_t/STRLEN in more places in regexp code
Father Chrysostomos [Sun, 18 Aug 2013 21:03:06 +0000 (14:03 -0700)]
Use SSize_t/STRLEN in more places in regexp code

As part of getting the regexp engine to handle long strings, this com-
mit changes any variables, parameters and struct members that hold
lengths of the string being matched against (or parts thereof) to use
SSize_t or STRLEN instead of [IU]32.

To avoid having to change any logic, I kept the signedness the same.

I did not change anything that affects the length of the regular
expression itself, so regexps are still practically limited to
I32_MAX.  Changing that would involve changing the size of regnodes,
which would be a lot more involved.

These changes should fix bugs, but are very hard to test.  In most
cases, I don’t know the regexp engine well enough to come up with test
cases that test the paths in question with long strings.  In other
cases I don’t have a box with enough memory to test the fix.

10 years agoStop substr re optimisation from rejecting long strs
Father Chrysostomos [Wed, 31 Jul 2013 06:49:58 +0000 (23:49 -0700)]
Stop substr re optimisation from rejecting long strs

Using I32 for the fields that record information about the location of
a fixed string that must be found for a regular expression to match
can result in match failures, because I32 is not large enough to store
offsets >= 2**31.

SSize_t is appropriate, since it is 64 bits on 64-bit platforms and 32
bits on 32-bit platforms.

This commit changes enough instances of I32 to SSize_t to get the
added test passing and suppress compiler warnings.  A later commit
will change many more.

10 years agoMake @- and @+ return correct offsets beyond 2**31
Father Chrysostomos [Thu, 25 Jul 2013 23:52:59 +0000 (16:52 -0700)]
Make @- and @+ return correct offsets beyond 2**31

10 years agoMake $' work past the 2**31 threshold
Father Chrysostomos [Thu, 25 Jul 2013 23:41:01 +0000 (16:41 -0700)]
Make $' work past the 2**31 threshold

10 years ago[perl #116907] Allow //g matching past 2**31 threshold
Father Chrysostomos [Thu, 25 Jul 2013 07:41:07 +0000 (00:41 -0700)]
[perl #116907] Allow //g matching past 2**31 threshold

Change the internal fields for storing positions so that //g in scalar
context can move past the 2**31 character threshold.  Before this com-
mit, the numbers would wrap, resulting in assertion failures.

The changes in this commit are only enough to get the added test pass-
ing.  Stay tuned for more.

10 years agoStop minlen regexp optimisation from rejecting long strings
Father Chrysostomos [Wed, 24 Jul 2013 21:23:54 +0000 (14:23 -0700)]
Stop minlen regexp optimisation from rejecting long strings

This fixes #112790 and part of #116907.

The length of the string is cast to I32, so it wraps and end up less
than the minimum length.

For now, simply skip this optimisation if minlen itself wraps and
becomes negative.

10 years agoregexec.c:regexec_flags: Remove unused var
Father Chrysostomos [Sat, 27 Jul 2013 14:10:08 +0000 (07:10 -0700)]
regexec.c:regexec_flags: Remove unused var

This variable, end_shift, only ever holds the value 0.  It is used in
only one place, where its value is assigned to another variable.

The history is interesting:

start_shift and end_shift were added in c277df42229, which added sub-
string optimisations.  146174a91a192 rearranged stuff a bit, causing
these variables to be unused.  155aba94f6 commented out the unused
start_shift to suppress a compiler warning.  1df70142a966e remove=
the start_shift comment, leaving the comment describing end_shift
nonsensical.

10 years agoStop pos() from being confused by changing utf8ness
Father Chrysostomos [Tue, 23 Jul 2013 20:15:34 +0000 (13:15 -0700)]
Stop pos() from being confused by changing utf8ness

The value of pos() is stored as a byte offset.  If it is stored on a
tied variable or a reference (or glob), then the stringification could
change, resulting in pos() now pointing to a different character off-
set or pointing to the middle of a character:

$ ./perl -Ilib -le '$x = bless [], chr 256; pos $x=1; bless $x, a; print pos $x'
2
$ ./perl -Ilib -le '$x = bless [], chr 256; pos $x=1; bless $x, "\x{1000}"; print pos $x'
Malformed UTF-8 character (unexpected end of string) in match position at -e line 1.
0

So pos() should be stored as a character offset.

The regular expression engine expects byte offsets always, so allow it
to store bytes when possible (a pure non-magical string) but use char-
acters otherwise.

This does result in more complexity than I should like, but the alter-
native (always storing a character offset) would slow down regular
expressions, which is a big no-no.

10 years agoDon’t push nulls on to the stack in pp_padav
Father Chrysostomos [Sun, 25 Aug 2013 18:19:44 +0000 (11:19 -0700)]
Don’t push nulls on to the stack in pp_padav

This is something that ce0d59fdd1c missed.

This will probably fix most of the modules mentioned in
ticket #119433.

10 years ago$Increase B::Concise::VERSION to 0.99
Father Chrysostomos [Sun, 25 Aug 2013 14:12:21 +0000 (07:12 -0700)]
$Increase B::Concise::VERSION to 0.99

10 years agoUnbreak Concise glob output
Father Chrysostomos [Sun, 25 Aug 2013 14:07:37 +0000 (07:07 -0700)]
Unbreak Concise glob output

$ ./perl -MO=Concise -Ilib -le '; print <\n>'
8  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 23 -e:1) v:{ ->3
7     <@> print vK ->8
3        <0> pushmark s ->4
6        <@> glob[t2] lK/1 ->7
-           <0> ex-pushmark s ->4
4           <$> const[PV "\n"] s ->5
Can't locate object method "NAME" via package "B::SPECIAL" at lib/B/Concise.pm line 707.
CHECK failed--call queue aborted.

e88567f2acf38fe5ed90a88569b808e82cd3eca1 is the first bad commit
commit e88567f2acf38fe5ed90a88569b808e82cd3eca1
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Sun Nov 4 20:18:51 2012 -0800

    Stop the glob operator from leaking GVs

    It was adding GVs to the symbol table (via newGVgen), so they
    would never be freed, even after the op was freed, unless done so
    explicitly.

    There is no reason for these GVs to be exposed.

That means $gv->STASH returns a B::SPECIAL.  B::Concise was not pre-
pared to handle that.

10 years agotoke.c:scan_str: Document args in one spot
Father Chrysostomos [Sun, 25 Aug 2013 07:21:14 +0000 (00:21 -0700)]
toke.c:scan_str: Document args in one spot

and space for readability

10 years agoMake __DATA__ use the right pkg
Father Chrysostomos [Sun, 25 Aug 2013 00:50:52 +0000 (17:50 -0700)]
Make __DATA__ use the right pkg

__DATA__ is supposed to stuff the rest of the file into the DATA han-
dle belonging to the package in scope where __DATA__ is encountered.
That means this should always print 123:

print <DATA>;
__DATA__
123

But it fails if the package has been renamed through glob assignment:

package foo;
BEGIN{*foo::=*bar::}
print <DATA>;
__DATA__
123

(Prints nothing.)

The code for stuffing DATA was stringifying the package and then look-
ing it up again.  Not only is it more correct to avoid the stringifi-
cation, but faster, too.

10 years agonote Module::Build's core-deprecation
Zefram [Sun, 25 Aug 2013 19:06:13 +0000 (20:06 +0100)]
note Module::Build's core-deprecation

Module::Build reports that it's deprecated from core from version 5.19.0,
but this information was missing from Module::CoreList.

10 years agopp_ctl.c:pp_flop: Avoid redundant SvNV calls
Father Chrysostomos [Sun, 25 Aug 2013 08:30:18 +0000 (01:30 -0700)]
pp_ctl.c:pp_flop: Avoid redundant SvNV calls

Calling SvNV on an SV that is IOK is unnecessary, and results in an
extra function call if the SV is not NOKp.  If an NV is out of range
and has been used as an int, it will be IOKp but not IOK.

10 years agoIncrease $mro::VERSION to 1.14
Father Chrysostomos [Sun, 25 Aug 2013 07:13:33 +0000 (00:13 -0700)]
Increase $mro::VERSION to 1.14

10 years agoIncrease $Math::BigInt::FastCalc::VERSION to 0.31
Father Chrysostomos [Sun, 25 Aug 2013 07:11:34 +0000 (00:11 -0700)]
Increase $Math::BigInt::FastCalc::VERSION to 0.31

10 years agoIncrease $Data::Dumper::VERSION to 2.149
Father Chrysostomos [Sun, 25 Aug 2013 07:10:16 +0000 (00:10 -0700)]
Increase $Data::Dumper::VERSION to 2.149

10 years agoStifle diag.t
Father Chrysostomos [Sun, 25 Aug 2013 06:45:46 +0000 (23:45 -0700)]
Stifle diag.t

Maybe we should extend it at some point to run things through
splain and see whether there is a match.

10 years agoUse SSize_t for arrays
Father Chrysostomos [Sun, 25 Aug 2013 07:08:21 +0000 (00:08 -0700)]
Use SSize_t for arrays

Make the array interface 64-bit safe by using SSize_t instead of I32
for array indices.

This is based on a patch by Chip Salzenberg.

This completes what the previous commit began when it changed
av_extend.

10 years agoCroak when range tries to extend stack too far
Father Chrysostomos [Sun, 25 Aug 2013 05:51:40 +0000 (22:51 -0700)]
Croak when range tries to extend stack too far

This fixes the rest of ticket #119161.

The range operator uses IVs internally to hold the current value for
integer ranges.  It already checks that the arguments are within the
IV range and croaks otherwise.  However, on 32-bit platforms with
64-bit integers, the different between the range’s endpoints can
exceed the maximum allowed memory allocation.  This resulted in a
crash for 1..2**31, because EXTEND was passed a value which, when
cast to SSize_t, became -1, resulting in no reallocation.  Then
pp_flop proceeded to write past the end of the stack.

No tests are included in this commit, as 1..2**31 could give three
different results depending on the platform.

10 years agoUse SSize_t when extending the stack
Father Chrysostomos [Sun, 25 Aug 2013 02:09:59 +0000 (19:09 -0700)]
Use SSize_t when extending the stack

(I am referring to what is usually known simply as The Stack.)

This partially fixes #119161.

By casting the argument to int, we can end up truncating/wrapping
it on 64-bit systems, so EXTEND(SP, 2147483648) translates into
EXTEND(SP, -1), which does not extend the stack at all.  Then writing
to the stack in code like ()=1..1000000000000 goes past the end of
allocated memory and crashes.

I can’t really write a test for this, since instead of crashing it
will use more memory than I have available (and then I’ll start for-
getting things).

10 years agoUse SSize_t for tmps stack offsets
Father Chrysostomos [Sun, 25 Aug 2013 01:02:09 +0000 (18:02 -0700)]
Use SSize_t for tmps stack offsets

This is a partial fix for #119161.

On 64-bit platforms, I32 is too small to hold offsets into a stack
that can grow larger than I32_MAX.  What happens is the offsets can
wrap so we end up referencing and modifying elements with negative
indices, corrupting memory, and causing crashes.

With this commit, ()=1..1000000000000 stops crashing immediately.
Instead, it gobbles up all your memory first, and then, if your com-
puter still survives, crashes.  The second crash happesn bcause of
a similar bug with the argument stack, which the next commit will
take care of.

10 years agoinstall useful Regexp::CARP_TRACE from Carp
Zefram [Sun, 25 Aug 2013 11:23:19 +0000 (12:23 +0100)]
install useful Regexp::CARP_TRACE from Carp

Regexp is a built-in class for which no module is normally loaded, so it
can't provide its own CARP_TRACE method.  Carp must therefore supply it.
The method formats a regexp reference as a qr() expression as much as
possible.  Like string arg formatting, it uses \x{} escapes for literal
characters that are not ASCII printable, and it truncates according
to $Carp::MaxArgLen.  The truncation happens at a different stage of
processing from its position in string arg formatting, because regexp
stringification presents an already-partly-escaped form of the regexp.

10 years agoremove stray debugging print statements
Zefram [Sun, 25 Aug 2013 10:45:48 +0000 (11:45 +0100)]
remove stray debugging print statements

Debugging code was left in the version of Carp's string arg formatting
that handles upgraded strings on older perls.

10 years agomore tests for $Carp::MaxArgLen
Zefram [Sun, 25 Aug 2013 10:28:27 +0000 (11:28 +0100)]
more tests for $Carp::MaxArgLen

10 years agoperlexperiment: Unicode on EBCDIC is not backtracking
Ricardo Signes [Sun, 25 Aug 2013 02:50:29 +0000 (22:50 -0400)]
perlexperiment: Unicode on EBCDIC is not backtracking

10 years agoperlexperiment: ticket for pluggable keywords
Ricardo Signes [Sun, 25 Aug 2013 02:23:24 +0000 (22:23 -0400)]
perlexperiment: ticket for pluggable keywords

10 years agoperlexperiment: ticket for :win32 pseudolayer
Ricardo Signes [Sun, 25 Aug 2013 02:09:22 +0000 (22:09 -0400)]
perlexperiment: ticket for :win32 pseudolayer

10 years agoperlexperiment: ticket link for regex_sets
Ricardo Signes [Sun, 25 Aug 2013 01:52:35 +0000 (21:52 -0400)]
perlexperiment: ticket link for regex_sets

10 years agorelease schedule: the rest of 2013 (except September!)
Ricardo Signes [Sun, 25 Aug 2013 01:36:38 +0000 (21:36 -0400)]
release schedule: the rest of 2013 (except September!)

10 years agorelease schedule: 5.18.1 is out and 5.14.x is EOL
Ricardo Signes [Sun, 25 Aug 2013 01:31:02 +0000 (21:31 -0400)]
release schedule: 5.18.1 is out and 5.14.x is EOL

10 years agoupdate copyright years for Carp dual-life release
Zefram [Sat, 24 Aug 2013 19:30:09 +0000 (20:30 +0100)]
update copyright years for Carp dual-life release

10 years agoupdate autodie test for new Carp stack trace form
Zefram [Sat, 24 Aug 2013 18:10:31 +0000 (19:10 +0100)]
update autodie test for new Carp stack trace form

10 years agoconsistently escape args in Carp stack trace
Zefram [Sat, 24 Aug 2013 17:00:36 +0000 (18:00 +0100)]
consistently escape args in Carp stack trace

Previously, an upgraded string argument would be wrapped in quote
characters but have all of its characters represented literally in
the stack trace, including control characters.  Also, the escaping of
unprintable characters for downgraded string arguments wasn't consistent
with Perl syntax: it used \x{} escapes inside single quotes.

The new way is that string arguments (except those that look numeric)
are represented as double-quoted strings, using correct Perl syntax.
Characters outside the ASCII printable range always get \x{} escaping,
whether the string is upgraded or downgraded.  ASCII printables that
require backslash escaping get it.  Where an argument is truncated
due to length, the added ellipsis appears outside the double quotes,
to avoid ambiguity with a string that contains actual dots.

Implementing this is complicated by problems with applying regexps to
upgraded strings, which are particularly a problem in the constrained
environment in which Carp must run.  This has previously inhibited us
from implementing correct handling of upgraded strings.  The problems
were all resolved in Perl 5.13.11, so from there on we can just use the
simple regexp implementation.  On older Perls upgraded strings now get
the same treatment, but implemented in a less efficient manner that does
not use regexps.

Non-string arguments, most notably references, are now are not represented
as quoted strings.  The overload::StrVal() representation is safely
distinct from other argument representations.  This in particular allows
distinguishing between an argument that is a reference and an argument
that is the result of stringifying a reference.

10 years agoFor SDBM_File, stop EU::MM from generating its default subdirs rule.
Nicholas Clark [Thu, 22 Aug 2013 09:48:29 +0000 (11:48 +0200)]
For SDBM_File, stop EU::MM from generating its default subdirs rule.

The default subdirs rule creates a race condition with the rule that
Makefile.PL explicitly adds to generate libsdbm.a, which can cause parallel
makes to fail.

10 years agoDon’t give unavailability warnings about our vars
Father Chrysostomos [Sat, 24 Aug 2013 12:54:23 +0000 (05:54 -0700)]
Don’t give unavailability warnings about our vars

Commit ce0d59fdd1c started using NULL to indicate nonexistent array
elements.  Since pads are AVs, they are filled with NULLs initially,
rather than &PL_sv_undef.

For ‘our’ vars, the pad entry is never actually touched.  Only one
piece of code was inspecting it, namely S_cv_clone_pad.  &PL_sv_undef
just happens to pass the checks that make sure the var is not stale.
However, we really should not be checking that at all if this is an
‘our’ var.

Even if we change ‘our’ vars back to having a &PL_sv_undef pad
entry, this fix should stay, as it makes the code clearer and makes
S_cv_clone_pad more robust.

10 years agopodcheck.t: Skip perl5200delta
Father Chrysostomos [Sat, 24 Aug 2013 01:26:47 +0000 (18:26 -0700)]
podcheck.t: Skip perl5200delta

I would have to change the header to something other than
‘perldelta’, even though that is what the final document
will have.

I would also have to start adding modules to the known modules
list which will not have to be there in the final release.

That is more work than necessary, so just skip this file for now.