This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
11 years agoUnicode::UCD: Fix blocks to work on early Unicodes
Karl Williamson [Mon, 26 Mar 2012 18:04:22 +0000 (12:04 -0600)]
Unicode::UCD: Fix blocks to work on early Unicodes

Not all Unicode releases supported blocks

11 years agoUnicode::UCD: Fix to work on Unicodes without script property
Karl Williamson [Mon, 26 Mar 2012 17:58:26 +0000 (11:58 -0600)]
Unicode::UCD: Fix to work on Unicodes without script property

11 years agoUnicode::UCD::compexcl(): Fix to work on early Unicodes
Karl Williamson [Mon, 26 Mar 2012 17:53:04 +0000 (11:53 -0600)]
Unicode::UCD::compexcl(): Fix to work on early Unicodes

11 years agoUnicode::UCD::charinfo(): Fix to handle decomps in early Unicode releases
Karl Williamson [Mon, 26 Mar 2012 17:46:44 +0000 (11:46 -0600)]
Unicode::UCD::charinfo(): Fix to handle decomps in early Unicode releases

There are no hangul syllables in early releases.

11 years agoUnicode::UCD::prop_invmap(): Fix so handles dm in earlier Unicodes
Karl Williamson [Mon, 26 Mar 2012 17:43:55 +0000 (11:43 -0600)]
Unicode::UCD::prop_invmap(): Fix so handles dm in earlier Unicodes

Some versions of Unicode did not have hangul syllables; and there is a
bug in handling them that doesn't show up in the latest versions.

11 years agoUnicode::UCD::prop_invmap: Fix so works on very early Unicode
Karl Williamson [Mon, 26 Mar 2012 17:39:51 +0000 (11:39 -0600)]
Unicode::UCD::prop_invmap: Fix so works on very early Unicode

Some versions of Unicode don't have the AHex property.  Instead use
[:xdigit:] which is defined in all versions.

11 years agoUnicode::UCD::prop_invmap(): Fix to work on early Unicodes
Karl Williamson [Mon, 26 Mar 2012 17:36:58 +0000 (11:36 -0600)]
Unicode::UCD::prop_invmap(): Fix to work on early Unicodes

The scf property was originally known as the sfc property.  This handles
both possibilities.

11 years agoUnicode::UCD::num(): Fix so works on early Unicode releases
Karl Williamson [Mon, 26 Mar 2012 17:34:52 +0000 (11:34 -0600)]
Unicode::UCD::num(): Fix so works on early Unicode releases

This has to do extra work for releases prior to 6.0.

11 years agoUnicode::UCD::charinfo(): get ISO comment for earlier Unicodes
Karl Williamson [Mon, 26 Mar 2012 17:30:03 +0000 (11:30 -0600)]
Unicode::UCD::charinfo(): get ISO comment for earlier Unicodes

This field had meaning in earlier Unicode versions.

11 years agoUnicode::UCD: Store v-string Unicode version.
Karl Williamson [Mon, 26 Mar 2012 17:24:05 +0000 (11:24 -0600)]
Unicode::UCD: Store v-string Unicode version.

This value will be used in future commits to make version comparisons
easier.

11 years agomktables: Fix up Unicod 2.18 special casing file
Karl Williamson [Mon, 26 Mar 2012 17:17:48 +0000 (11:17 -0600)]
mktables: Fix up Unicod 2.18 special casing file

which had duplicate entries.

11 years agomktables: Fix-up for Unicode version 1
Karl Williamson [Mon, 26 Mar 2012 17:15:53 +0000 (11:15 -0600)]
mktables: Fix-up for Unicode version 1

The Unicode data files for version 1 have a number of errors and
anomalies in them.

11 years agomktables: Add definitions for missing property value aliases
Karl Williamson [Mon, 26 Mar 2012 17:13:25 +0000 (11:13 -0600)]
mktables: Add definitions for missing property value aliases

This is for early Unicode releases where things were omitted.

11 years agomktables: Add Unicode_1_names if missing from early Unicode releases
Karl Williamson [Mon, 26 Mar 2012 17:11:55 +0000 (11:11 -0600)]
mktables: Add Unicode_1_names if missing from early Unicode releases

11 years agomktables: Allow simple_mapfoo tables to work in early Unicode releases
Karl Williamson [Mon, 26 Mar 2012 17:07:03 +0000 (11:07 -0600)]
mktables: Allow simple_mapfoo tables to work in early Unicode releases

Not all Unicode releases have the special casing file; a previous commit
has already added this necessary processing to the mainline code
execution; no need to do it twice.

11 years agomktables: Work around bug in early Unicode databases
Karl Williamson [Mon, 26 Mar 2012 17:03:56 +0000 (11:03 -0600)]
mktables: Work around bug in early Unicode databases

Fix up the erroneous fields

11 years agomktables: Fix to enable XIDS property in early Unicode releases
Karl Williamson [Mon, 26 Mar 2012 16:50:27 +0000 (10:50 -0600)]
mktables: Fix to enable XIDS property in early Unicode releases

Construct this property if isn't in the Unicode version being compiled,
as it is needed by the Perl core to function

11 years agomktables: Compile \w correctly on early Unicode versions
Karl Williamson [Mon, 26 Mar 2012 16:37:03 +0000 (10:37 -0600)]
mktables: Compile \w correctly on early Unicode versions

Early Unicode versions did not have the Connector_Punctuation property.
In those cases the underscore should still be part of \p{Word}.

11 years agomktables: Consolidate handling of Cased property
Karl Williamson [Mon, 26 Mar 2012 16:29:43 +0000 (10:29 -0600)]
mktables: Consolidate handling of Cased property

This moves all the handling dealing with Cased to one place, and fixes
it so it works properly when compiling Unicode versions without the
official Cased property.

11 years agomktables: Fix for Unicode versions without fold, special casing
Karl Williamson [Mon, 26 Mar 2012 16:11:51 +0000 (10:11 -0600)]
mktables: Fix for Unicode versions without fold, special casing

This code was supposed to work on early Unicode releases which did not
have the special casing and casefold .txt files in them, but was broken.
Processing is moved earlier to set these tables up before the loop that
populates the default mapping for all Unicode tables, so that that loop
will automatically process these as well.

11 years agomktables: Suppress invalid warning on early Unicode releases
Karl Williamson [Mon, 26 Mar 2012 16:01:57 +0000 (10:01 -0600)]
mktables: Suppress invalid warning on early Unicode releases

When a Unicode release is compile which doesn't have titlecasing the
table is created anyway, but is empty.  This suppresses the empty table
sanity check warning, since it's sane for this to be empty in those
versions

11 years agomktables: Move assignment out of loop
Karl Williamson [Mon, 26 Mar 2012 15:53:29 +0000 (09:53 -0600)]
mktables: Move assignment out of loop

This assignment only needs to be done once.

11 years agomktables: White-space only
Karl Williamson [Mon, 26 Mar 2012 15:51:31 +0000 (09:51 -0600)]
mktables: White-space only

A previous commit removed the block this code was contained in, so can
outdent and reflow the comments to take up the full width available

11 years agomktables: remove now-always-true test
Karl Williamson [Mon, 26 Mar 2012 15:48:43 +0000 (09:48 -0600)]
mktables: remove now-always-true test

A previous commit causes the Name_Alias property to be defined in all
Unicode versions, so no longer have to test it.

11 years agomktables: Extend Name_Alias property to early Unicode releases
Karl Williamson [Sun, 25 Mar 2012 04:01:35 +0000 (22:01 -0600)]
mktables: Extend Name_Alias property to early Unicode releases

This uses this property so that charnames can work on early Unicode
releases, by including all the aliases that were previously defined in
charnames until Unicode 6.1 started defining them itself.

11 years agomktables: Loop should begin at 0
Karl Williamson [Mon, 26 Mar 2012 15:16:17 +0000 (09:16 -0600)]
mktables: Loop should begin at 0

This loop is supposed to flush all the input buffering for the fields of
UCD.txt, but skipped field 0, the name field.  This is not a problem
except for compiling very early Unicode versions where the final entry in
the file could be a real name.  Subsequent versions have the final entry
be for nameless private use code points, so this bug is not triggered
for them.

11 years agomktables: Add input error check and warning
Karl Williamson [Mon, 26 Mar 2012 15:11:10 +0000 (09:11 -0600)]
mktables: Add input error check and warning

11 years agomktables: Add overload for '&=' on property objects
Karl Williamson [Mon, 26 Mar 2012 15:07:34 +0000 (09:07 -0600)]
mktables: Add overload for '&=' on property objects

11 years agomk_invlists.pl: Add error check and die if fails
Karl Williamson [Mon, 26 Mar 2012 15:00:37 +0000 (09:00 -0600)]
mk_invlists.pl: Add error check and die if fails

11 years agomktables: Move dummy table generation earlier
Karl Williamson [Mon, 26 Mar 2012 03:47:42 +0000 (21:47 -0600)]
mktables: Move dummy table generation earlier

These two tables are not furnished by Unicode in early releases, but if
they are not present, Perl's regex code will fail very ungracefully when
trying to deal with \X.  Therefore, we create placeholders for these so
that the code will degrade gracefully when Perl is run with early
Unicode versions.

This patch moves the generation of these placeholder tables to a
function that gets executed earlier in the process.  This allows the
loop that follows the new placement to create the proper match tables
and fill in the defaults, like it does for all other Unicode properties.

This allows this commit to remove special tests for the existence of
these properties as well.

This is an interim patch.  Future commits will actually fill in these
tables, making them non placeholders.

11 years agomktables: Suppress warnings for placeholder tables
Karl Williamson [Mon, 26 Mar 2012 15:30:40 +0000 (09:30 -0600)]
mktables: Suppress warnings for placeholder tables

Placeholder tables are anomalous, and so may run afoul of sanity checks,
unless those are suppressed for them.

11 years agomktables: Lowercase property name to conform with Unicode
Karl Williamson [Fri, 23 Mar 2012 17:59:42 +0000 (11:59 -0600)]
mktables: Lowercase property name to conform with Unicode

For some reason, they use the name lowercased; this change makes it
easier for mktables to work in earlier versions of Unicode when this
property is not available, and mktables constructs a dummy one itself

11 years agomktables: Remove unnecessary code
Karl Williamson [Fri, 23 Mar 2012 17:49:19 +0000 (11:49 -0600)]
mktables: Remove unnecessary code

These lines just duplicate what's in the subsequent 'else'

11 years agomktables: White-space only
Karl Williamson [Fri, 23 Mar 2012 17:37:20 +0000 (11:37 -0600)]
mktables: White-space only

This indents the loop to correctly align under a newly added block, and
reflows to fit in 80 columns

11 years agomktables: skip some processing in debug mode
Karl Williamson [Fri, 23 Mar 2012 17:35:26 +0000 (11:35 -0600)]
mktables: skip some processing in debug mode

Otherwise, it tends to fail.

11 years agomktables: Optionally create normalization test file
Karl Williamson [Fri, 23 Mar 2012 17:31:31 +0000 (11:31 -0600)]
mktables: Optionally create normalization test file

Unicode furnishes a rather complete normalization test suite.  This code
adds an option to mktables to use that input to create a test file for
Perl.

Due to its slowness, about 400K tests, this is not currently enabled by
default.

11 years agomktables: Shorten test file name
Karl Williamson [Fri, 23 Mar 2012 17:29:08 +0000 (11:29 -0600)]
mktables: Shorten test file name

This is in preparation for actually using it.  This makes sure it works
on DOS 8.3 filenames.

11 years agopodcheck.t: Fix more transitory file problems
Karl Williamson [Fri, 1 Jun 2012 19:32:43 +0000 (13:32 -0600)]
podcheck.t: Fix more transitory file problems

If a file has been removed since it was first found, it is considered
transitory, and its pod, if any, should  not be checked.  This fixes two
places where podcheck.t just died when this happens.

11 years agoBump Locale-Codes from 3.21 to 3.22
Sullivan Beck [Wed, 30 May 2012 14:25:47 +0000 (10:25 -0400)]
Bump Locale-Codes from 3.21 to 3.22

11 years agoIf kill 0, PPID works, use it to avoid race conditions in t/op/getppid.t
Nicholas Clark [Fri, 1 Jun 2012 15:45:12 +0000 (17:45 +0200)]
If kill 0, PPID works, use it to avoid race conditions in t/op/getppid.t

POSIX allows one to use kill 0, PPID to detect if a process exists.
(Strictly that the current process is permitted to signal it, which is the
case here). If the system is sufficiently POSIXy, use kill 0, PPID to detect
that the parent has terminated, instead of just sleeping and hoping for the
best.

(Strictly to ensure the test terminates, there is still a race condition,
but if your test system is so loaded that a process takes more than 10
seconds to terminate, you've likely got bigger problems you need to address
first.)

11 years agoIn t/op/getppid.t remove most race conditions by signaling using pipes.
Nicholas Clark [Fri, 1 Jun 2012 13:40:51 +0000 (15:40 +0200)]
In t/op/getppid.t remove most race conditions by signaling using pipes.

Previously t/op/getppid.t used sleep calls in the child and grandchild to
(attempt to) sequence actions between them. This was a subtle race condition,
which could come unstuck on busy systems causing spurious test failures.

Instead use EOF on pipes as a cheap portable way to synchronise between
processes. This eliminates one sleep call completely. Unfortunately, we can't
completely eliminate the other, as the grandchild spots that the child's
exit has closed the pipe *before* the child completely exits. Hence retain
the sleep to (usually) give time for the child to completely exit. This
reduces the race condition to "sleep 2" vs "child finishes exiting", which
is much less than the previous race condition of "sleep 2" vs "child does
everything from returning from fork to exiting".

11 years agoIn t/op/getppid.t, die if any pipe close fails.
Nicholas Clark [Fri, 1 Jun 2012 13:32:47 +0000 (15:32 +0200)]
In t/op/getppid.t, die if any pipe close fails.

It shouldn't happen, but the diagnostics will be useful if does.

11 years agoperldelta for c6ed316378d6d1918fa7626803c875b84f0ec8ea
Tony Cook [Sat, 2 Jun 2012 02:36:02 +0000 (12:36 +1000)]
perldelta for c6ed316378d6d1918fa7626803c875b84f0ec8ea

11 years ago[perl #64772] allow for sync on read only handles
Tony Cook [Sat, 2 Jun 2012 02:15:21 +0000 (12:15 +1000)]
[perl #64772] allow for sync on read only handles

This is useful on Linux for when you open a directory with open() and
then sync the directory eg, after a rename.

Tested on Linux, NetBSD, Solaris, Haiku-OS, Darwin, cygwin.

Tests are skipped on VMS (where I have no idea if it will work), Win32
(for which opening directories requires special permissions).

11 years ago[perl #64772] check both input and output file handles for sync
Evan Miller [Thu, 31 May 2012 13:52:26 +0000 (23:52 +1000)]
[perl #64772] check both input and output file handles for sync

This allows sync() to be called on directory handles.

Originally supplied as a diff, applied and updated to pass tests by
Tony Cook.

11 years agoadd Evan Miller to AUTHORS
Tony Cook [Thu, 31 May 2012 13:43:18 +0000 (23:43 +1000)]
add Evan Miller to AUTHORS

11 years ago[perl #64772] TODO test for sync on read only handle
Tony Cook [Thu, 31 May 2012 09:34:44 +0000 (19:34 +1000)]
[perl #64772] TODO test for sync on read only handle

11 years agoconvert dist/IO/t/io_xs.t to Test::More
Tony Cook [Thu, 31 May 2012 09:27:45 +0000 (19:27 +1000)]
convert dist/IO/t/io_xs.t to Test::More

11 years agoFix K & R-style function definition in VMS::Stdio.
Craig A. Berry [Fri, 1 Jun 2012 03:02:21 +0000 (22:02 -0500)]
Fix K & R-style function definition in VMS::Stdio.

C++ doesn't speak K & R.

11 years agoMerge refactoring of t/op/filetest.t into blead.
Nicholas Clark [Thu, 31 May 2012 21:02:23 +0000 (23:02 +0200)]
Merge refactoring of t/op/filetest.t into blead.

11 years agoUse is() and isnt() in t/op/filetest.t, in place of ok().
Nicholas Clark [Thu, 24 May 2012 14:05:08 +0000 (16:05 +0200)]
Use is() and isnt() in t/op/filetest.t, in place of ok().

These automatically give diagnostics on failure, allowing the elimination
of two explicit calls to diag(). Also split one ok(... && ...) test into
two.

11 years agoIn t/op/filetest.t, test -s -f 'TEST' against the size from stat 'TEST'.
Nicholas Clark [Thu, 24 May 2012 13:49:08 +0000 (15:49 +0200)]
In t/op/filetest.t, test -s -f 'TEST' against the size from stat 'TEST'.

Previously the test was "is it greater than 1?"

11 years agoIn t/op/filetest.t, use the tempfile instead of t/TEST in two tests.
Nicholas Clark [Thu, 24 May 2012 09:57:21 +0000 (11:57 +0200)]
In t/op/filetest.t, use the tempfile instead of t/TEST in two tests.

This avoids needing to skip the two tests if t/TEST is a symlink, which is
the case when building with -Dmksymlinks.

11 years agoIn t/op/filetest.t, use one temporary file for testing instead of two.
Nicholas Clark [Thu, 24 May 2012 09:40:41 +0000 (11:40 +0200)]
In t/op/filetest.t, use one temporary file for testing instead of two.

The readonly file tests aren't worried about the file's length, and the
zero-length file tests aren't concerned about whether it's writable, so it's
possible to use the same file in both tests.

11 years agoIn t/op/filetest.t, simplify the logic for testing read-only files.
Nicholas Clark [Thu, 24 May 2012 09:23:06 +0000 (11:23 +0200)]
In t/op/filetest.t, simplify the logic for testing read-only files.

Only attempted to change the effective user ID if the test is running as
root. Don't bother consulting $Config to see whether assigning to $> is going
to work - just try it in an eval, and skip if it didn't. Only restore $> if
we know we changed it, and as we only change it from root, we already know
which value to restore it to.

The previous code to check $Config{d_seteuid} was incomplete, as it should
also have been checking for $Config{d_setreuid} and $Config{d_setresuid}, as
$> can use any of these.

11 years agoIn t/op/filetest.t, simplify the skip logic when testing -r and -w on op.
Nicholas Clark [Thu, 24 May 2012 08:45:00 +0000 (09:45 +0100)]
In t/op/filetest.t, simplify the skip logic when testing -r and -w on op.

This code has got excessively hairy. Originally, t/op/filetest.t was added
to test that various file test operators worked as expected. (Commit
42e55ab11744b52a in Oct 1998.) It used the file t/TEST and the directory
t/op for targets. To test that read-only files were detected correctly, it
would chmod 0555 TEST to set it read only.

The test would fail if run as root, because root can write to anything. So
logic was added to set the effective user ID to 1 by assigning to $> in an
eval (unconditionally), and restoring $> afterwards. (Commit 846f25a3508eb6a4
in Nov 1988.) Curiously, the restoration was done after the test for
C<-r op>, rather than before it.

Most strangely, a skip was then added for the C<-w op> test based on
$Config{d_seteuid}. The test runs after $> has been restored, so should have
nothing to do with setuid. It was added as part of the VMS-related changes of
commit 3eeba6fb8b434fcb in May 1999. As d_seteuid is not defined in VMS, this
makes the test skip on VMS.

Commit 15fe5983b126b2ad in July 1999 added a skip for the read-only file
test if d_seteuid is undefined. Which is actually the only test where having
a working seteuid() *might* matter (but only if running as root, so that $>
can be used to drop root privileges).

Commit fd1e013efb606b51 in August 1999 moved the restoration of $> earlier,
ahead of the test for C<-r op>, as that test could fail if run as root with
the source tree unpacked with a restrictive umask. (Bug ID 19990727.039)

11 years agot/porting/checkcase.t shouldn't scan .git for case-clashing files.
Nicholas Clark [Thu, 31 May 2012 09:28:21 +0000 (11:28 +0200)]
t/porting/checkcase.t shouldn't scan .git for case-clashing files.

The contents of the .git directory are outside our control. In particular,
as fetch doesn't default to --prune, someone pushing a branch upstream with
a name which case-conflicts with a previously deleted branch will cause
action-at-a-distance failures, because locally .git/logs/refs/remotes will
contain both.

11 years agot/porting/checkcase.t should find() from the top level, not from '..'
Nicholas Clark [Thu, 31 May 2012 09:15:20 +0000 (11:15 +0200)]
t/porting/checkcase.t should find() from the top level, not from '..'

This permits it to be usefully run from the top level of the build tree.
Previously it would find() on '..', which meant that one needed to chdir into
t/ else it would report errors for the contents of the directory containing
the build tree.

11 years agoA more C++-friendly dNOOP.
Craig A. Berry [Wed, 30 May 2012 23:57:51 +0000 (18:57 -0500)]
A more C++-friendly dNOOP.

The problem with Perl___notused under C++ is that in some cases
it's merely extern, and in some cases (via the XS macro via the
XSPROTO macro) it's extern "C".  Object code analysis shows that
you do actually get one mangled and one unmangled version of the
symbol, which wouldn't matter since the whole point is to have
something we never use.

Except that one very picky C++ compiler (HP C++ for OpenVMS) sees
what we're up to and slaps us down hard.  Since declaration after
statement has always been allowed in C++, just go ahead and do a
real noop statement for C++ and avoid the use of an external
symbol.

11 years agoDon't install HTML docs for 'ext' folder
Steve Hay [Wed, 30 May 2012 13:06:55 +0000 (14:06 +0100)]
Don't install HTML docs for 'ext' folder

After building, everything in 'ext' is in 'lib' anyway so including
the 'ext' folder as well as 'lib' just results in duplicate docs in
a slightly different folder structure.

11 years ago[Merge] Yank study
Father Chrysostomos [Wed, 30 May 2012 06:55:55 +0000 (23:55 -0700)]
[Merge] Yank study

study was made a no-op in 5.16, but the code was left in place,
unused.  This branch removes the code implementing study, leaving
pp_study and screaminstr as stubs.

11 years agosv.h: Document the only use of SvSCREAM
Father Chrysostomos [Thu, 24 May 2012 21:54:29 +0000 (14:54 -0700)]
sv.h: Document the only use of SvSCREAM

Now that studied scalars are gone, SvSCREAM is used only for the DOES
method name hack, so update sv.h accordingly.

11 years agoDelete two instance of SvSCREAM_off
Father Chrysostomos [Thu, 24 May 2012 21:53:38 +0000 (14:53 -0700)]
Delete two instance of SvSCREAM_off

that no longer have any effect.

11 years agoUse isGV_with_GP in util.c:fbm_compile
Father Chrysostomos [Thu, 24 May 2012 21:49:19 +0000 (14:49 -0700)]
Use isGV_with_GP in util.c:fbm_compile

This little statement:

    if (SvSCREAM(sv))
return;

filters out not only studied strings, but also GVs.

Since studied strings are gone, it only filters out GVs now.  Since
fbm_compile coerces its argument, we still want to filter out GVs, so
we use isGV_with_GP to make the intent clear.

11 years agoAway with REXEC_SCREAM!
Father Chrysostomos [Thu, 24 May 2012 21:45:41 +0000 (14:45 -0700)]
Away with REXEC_SCREAM!

Actually, we cannot remove the definition, as there are CPAN modules
that need it; but they only test the flag, and never set it, so perl
doesn’t need to keep testing it itself.

11 years agoExpunge study magic
Father Chrysostomos [Thu, 24 May 2012 21:04:02 +0000 (14:04 -0700)]
Expunge study magic

I’m running out of synonyms for ‘remove’.

11 years agoGut screaminstr
Father Chrysostomos [Thu, 24 May 2012 21:00:56 +0000 (14:00 -0700)]
Gut screaminstr

How did this ever end up in the API?

Anyway, this commit guts it by removing its guts and replacing it with
a panic message.  This function would fail assertions if passed an
unstudied scalar, so it should never be called any more.  But XS mod-
ules that still do if (SvSCREAM(sv)) screaminstr(...) should still be
able to compile.

11 years agoRemove most code conditional on SvSCREAM
Father Chrysostomos [Thu, 24 May 2012 20:52:32 +0000 (13:52 -0700)]
Remove most code conditional on SvSCREAM

Since pp_study is now a no-op, SvSCREAM should always be false on
non-GVs, except for the method name hack.

11 years agoCorrect apidoc varnames for util.c:fbm_instr
Father Chrysostomos [Thu, 24 May 2012 20:47:39 +0000 (13:47 -0700)]
Correct apidoc varnames for util.c:fbm_instr

11 years agoDelete the contents of pp_study
Father Chrysostomos [Thu, 24 May 2012 06:54:14 +0000 (23:54 -0700)]
Delete the contents of pp_study

11 years agoDon’t clone closures in rv2cv
Father Chrysostomos [Thu, 24 May 2012 05:44:25 +0000 (22:44 -0700)]
Don’t clone closures in rv2cv

Commit 07055b4c536 (Support named closures) added code to make refer-
encing a closure prototype clone the prototype.  Commit 28757baaaeaa
(inseparable changes from patch from perl5.003_19 to perl5.003_20),
which includes ‘Subject: Rescind named closures’ in its log, appar-
ently did not rescind ‘named closures’ completely, leaving a line of
code that was completetly unused and untested, until just now when I
tried doing something bizarre to see whether some other piece of code
was buggy.  This wasn’t what I expected. :-)

$ ./perl -Ilib -e 'sub MODIFY_CODE_ATTRIBUTES{\&{$_[1]};} my $x; +sub :bar{$x}'
Assertion failed: (depth || SvTYPE(proto) == SVt_PVFM), function Perl_cv_clone, file pad.c, line 1890.
Abort trap

11 years agoRemove ‘Runaway prototype’ warning
Father Chrysostomos [Thu, 24 May 2012 04:51:45 +0000 (21:51 -0700)]
Remove ‘Runaway prototype’ warning

This has been here since commit 8472ac73d, which was merged into blead
in commit 55d729e4e15, if I understand the history correctly.

This warning is undocumented, and triggerable only by stash
manipulation.

It appears to be an internal check, similar to a ‘panic’ error, but
its wording doesn’t suggest anything of the sort.

A ‘sub foo;’ declaration doesn’t actually create the sub yet, but
simply puts -1 in the stash element.  ‘sub foo($);’ puts '$' in the
stash element.

If newATTRSUB sees something there it doesn’t recognise, it unhelp-
fully carps ‘Runaway prototype’, but it is pretty random:

This is OK:

$ perl -e 'BEGIN{$::{foo}=undef} sub foo;'

But this is not:

$ perl -e 'BEGIN{$::{foo}=-1; $::{foo}=undef} sub foo;'
Runaway prototype at -e line 1.

Also, it only happens when the sub has no body, not for ‘sub foo {}’:

$ perl -e 'BEGIN{$::{foo}=56} sub foo{}'
$ perl -e 'BEGIN{$::{foo}=56} sub foo;'
Runaway prototype at -e line 1.

This warning is random, incomprehensible, and not at all helpful, so
we should just remove it.

11 years agoupdate the editor hints for spaces, not tabs
Ricardo Signes [Fri, 25 May 2012 12:40:18 +0000 (08:40 -0400)]
update the editor hints for spaces, not tabs

This updates the editor hints in our files for Emacs and vim to request
that tabs be inserted as spaces.

11 years agoclarify that it must be a simple identifier in {}
Ricardo Signes [Mon, 14 May 2012 13:01:06 +0000 (09:01 -0400)]
clarify that it must be a simple identifier in {}

suggestion from Aristotle Pagaltzis in
https://rt.perl.org/rt3/Ticket/Display.html?id=112914

11 years agorelated to [perl #113060] assert CopSTASH(cx->blk_oldcop)
Reini Urban [Tue, 29 May 2012 21:06:00 +0000 (16:06 -0500)]
related to [perl #113060] assert CopSTASH(cx->blk_oldcop)

HvNAME_HEK((HV*)CopSTASH(cx->blk_oldcop)) does some implicit assumptions, which should
better be asserted. Also record CX pp_caller reads besides PUSH and POP.

11 years ago[perl #113060] Save cop_stashlen threaded even with shared cop pv
Reini Urban [Tue, 29 May 2012 20:46:13 +0000 (15:46 -0500)]
[perl #113060] Save cop_stashlen threaded even with shared cop pv

Perl_sv_compile_2op_is_broken() does at line 3354 a LEAVE_with_name("eval"),
a SSPOPSTR via SAVEt_SHARED_PVREF for the localized cop_stashpv, but
not for the cop_stashlen.
The cop in question is PL_compiling, which was "AutoSplit" before with
len=9 and restores it back to "main" but keeps len 9. Thus leading to a
heap-overflow in gv_stashpvn.

11 years ago[perl #97478] Make ‘Can’t find opnumber’ UTF-8- and null-clean
Father Chrysostomos [Sun, 22 Apr 2012 02:12:21 +0000 (19:12 -0700)]
[perl #97478] Make ‘Can’t find opnumber’ UTF-8- and null-clean

11 years ago[Merge] More coresubs
Father Chrysostomos [Tue, 29 May 2012 16:38:19 +0000 (09:38 -0700)]
[Merge] More coresubs

Until now, only overridable keywords had subs in the CORE:: namespace.

This branch adds subs to the CORE:: namespace for those non-overrida-
ble keywords that can be implemented without custom parsers.

11 years agobproto.t: Test pos(1,$b)
Father Chrysostomos [Sat, 26 May 2012 12:47:08 +0000 (05:47 -0700)]
bproto.t: Test pos(1,$b)

I nearly broke this.

11 years agoUpdate CORE.pod to reflect the new coresubs
Father Chrysostomos [Tue, 15 May 2012 21:42:50 +0000 (14:42 -0700)]
Update CORE.pod to reflect the new coresubs

11 years agoMake &CORE::undef(\*_) undefine it properly
Father Chrysostomos [Tue, 15 May 2012 05:26:15 +0000 (22:26 -0700)]
Make &CORE::undef(\*_) undefine it properly

Unless called as &CORE::undef (without parentheses) after @_ has been
set to \*_, it leaves @_ in the ARRAY slot.

This is an implementation detail leaking through.

pp_entersub temporarily aliases @_ to a new array, which is restored
to its previous value on sub exit.

Since &CORE::undef is a perl sub with an op tree containing
an undef op,

$ ./perl -Ilib -MO=Concise,CORE::undef -e '\&CORE::undef'
CORE::undef:
3  <1> leavesublv[1 ref] K/REFC,1 ->(end)
2     <1> undef sKP/1 ->3
1        <$> coreargs(IV 44) s ->2
-e syntax OK

the undef op runs while @_ is localised.

So we should un-localise @_ if we detect that case.

Doing this in pp_coreargs might be a bit of a hack, but it’s less
code than rewriting &CORE::undef as an XSUB, which would be the
other option.

Either way, we need a special case, since undef is the only named op
that touches the ARRAY slot of the glob passed to it.

11 years ago&CORE::undef should be an lvalue sub
Father Chrysostomos [Sun, 13 May 2012 06:18:50 +0000 (23:18 -0700)]
&CORE::undef should be an lvalue sub

11 years agoAdd &CORE::undef
Father Chrysostomos [Sun, 13 May 2012 02:05:24 +0000 (19:05 -0700)]
Add &CORE::undef

In the error message, we can’t say ‘&CORE::undef operator’, so we
should be using the op name, rather than the op description.

Instead of using OP_NAME(PL_op->op_next), which would expand to

    PL_op->op_next->op_type == OP_CUSTOM
? XopENTRY(Perl_custom_op_xop(aTHX_ PL_op->op_next), xop_name)
: PL_op_name[PL_op->op_next->op_type]

we can simply use PL_op_name[opnum], which should be quicker.

pp_undef can already handle nulls on the stack.

There is one remaining problem.  If &CORE::undef(\*_) is called, *_
will be undefined while @_ is localised during the sub call, so it
won’t have the same effect as undef *_.  I don’t know whether this
should be considered a bug or not, but I could solve it by making
pp_undef an XSUB.

11 years agoAdd &CORE::study
Father Chrysostomos [Sat, 12 May 2012 05:06:29 +0000 (22:06 -0700)]
Add &CORE::study

11 years agoAdd &CORE::split
Father Chrysostomos [Sat, 12 May 2012 05:03:55 +0000 (22:03 -0700)]
Add &CORE::split

11 years agoAdd &CORE::scalar
Father Chrysostomos [Sat, 12 May 2012 04:54:03 +0000 (21:54 -0700)]
Add &CORE::scalar

11 years agoAdd &CORE::prototype
Father Chrysostomos [Mon, 30 Apr 2012 15:49:32 +0000 (08:49 -0700)]
Add &CORE::prototype

11 years agoAdd &CORE::pos
Father Chrysostomos [Mon, 30 Apr 2012 04:15:25 +0000 (21:15 -0700)]
Add &CORE::pos

11 years agoMake pos use ck_fun and OA_SCALARREF
Father Chrysostomos [Sun, 13 May 2012 05:30:06 +0000 (22:30 -0700)]
Make pos use ck_fun and OA_SCALARREF

See the previous commit.  The same applies here.

In short, this allows core_prototype and pp_coreargs to be simpler.

11 years agoMake undef use ck_fun and OA_SCALARREF
Father Chrysostomos [Sat, 12 May 2012 21:25:44 +0000 (14:25 -0700)]
Make undef use ck_fun and OA_SCALARREF

In regen/opcodes, we have some operators that use ck_fun and have R
for the argument.  And there are some that use ck_lfun and have S for
the argument.

These both amount to more or less the same thing.

ck_fun/R goes through the OA_SCALARREF case in ck_fun, which calls
op_lvalue(scalar()) on the child op.

ck_lfun/S goes through the OA_SCALAR case in ck_fun, which calls
scalar(), and then ck_lfun sees to it that op_lvalue is called.

The only real difference is that the OA_SCALAR case makes sure there
are not too many arguments.

Since both core_prototype and pp_coreargs need special cases to deal
with OA_SCALAR that is really ‘supposed’ to be OA_SCALARREF, it
becomes simpler to add &CORE::undef if undef uses R.  In that case,
we also have to put the argument-checking in the OA_SCALARREF, but we
make it conditional on the op being an undef op, for the sake of doing
one thing at a time.  (This is a bit of a mess; see ticket #96006.)

11 years agoAdd &CORE::glob
Father Chrysostomos [Mon, 30 Apr 2012 00:58:44 +0000 (17:58 -0700)]
Add &CORE::glob

I added a special case for OP_GLOB to pp_coreargs, since glob does not
have the u flag in regen/opcodes; hence PL_opargs[opnum] & OA_DEFGV is
false, even though glob does imply $_.

Adding the flag to regen/opcodes is not so simple, as the code in
ck_fun that adds the DEFSV op does not account for list ops, but
leaves op_last unchanged.

Changing ck_fun to account requires adding more code than this special
case in pp_coreargs.

OPf_SPECIAL indicates that glob was called with the CORE:: prefix.

11 years agopp.c:pp_coreargs: use PL_op_desc instead of OP_DESC
Father Chrysostomos [Sat, 12 May 2012 04:48:58 +0000 (21:48 -0700)]
pp.c:pp_coreargs: use PL_op_desc instead of OP_DESC

Instead of using OP_DESC on op_next, since we already know the op
number, we can just go straight to PL_op_desc, which is what OP_DESC
itself uses after looking inside op_next to find out what the op
number is.

BTW, &CORE::scalar will need this, since a scalar op is never actu-
ally executed, making coreargs’ op_next pointer point to another op
than expected:

2  <1> leavesublv[1 ref] K/REFC,1 ->(end)
-     <1> scalar sKP/1 ->2
1        <$> coreargs(IV 2) s ->2
-e syntax OK

Otherwise we get ‘Not enough arguments for lvalue subroutine return’.

11 years agoAdd &CORE::exists
Father Chrysostomos [Fri, 27 Apr 2012 16:53:16 +0000 (09:53 -0700)]
Add &CORE::exists

11 years agoAdd &CORE::delete
Father Chrysostomos [Fri, 27 Apr 2012 03:40:48 +0000 (20:40 -0700)]
Add &CORE::delete

11 years agoAdd &CORE::defined
Father Chrysostomos [Fri, 27 Apr 2012 03:38:37 +0000 (20:38 -0700)]
Add &CORE::defined

11 years agocoresubs.t: Explicitly skip all unsupported keywords
Father Chrysostomos [Fri, 27 Apr 2012 03:36:03 +0000 (20:36 -0700)]
coresubs.t: Explicitly skip all unsupported keywords

Instead of skipping positive keywords (those that cannot be over-
ridden) because of their positivity, list them explicitly in the
skip list.

This will allow them to be removed one by one.

11 years agocoreamp.t: Explicitly skip all unsupported keywords
Father Chrysostomos [Fri, 27 Apr 2012 03:31:22 +0000 (20:31 -0700)]
coreamp.t: Explicitly skip all unsupported keywords

Instead of skipping positive keywords (those that cannot be over-
ridden) because of their positivity, list them explicitly in the
skip list.

This will allow them to be removed one by one.

11 years agogv.c: List all keywords with no coresubs
Father Chrysostomos [Fri, 27 Apr 2012 00:56:46 +0000 (17:56 -0700)]
gv.c: List all keywords with no coresubs

S_maybe_add_coresub returns NULL for any keywords that are not
overridable.

Instead of identifying them by the positivity of their codes, list
them all explicitly.

This will allow coresubs to be added for them one by one.

11 years agoUpdate perlfunc/prototype
Father Chrysostomos [Tue, 24 Apr 2012 05:55:48 +0000 (22:55 -0700)]
Update perlfunc/prototype

to account for the new inconsequentiality of non-overridability.

11 years agoAdd protos for positive keywords
Father Chrysostomos [Sat, 21 Apr 2012 19:50:25 +0000 (12:50 -0700)]
Add protos for positive keywords

‘Positive’ means having a + before it in regen/keywords.pl; i.e., key-
words that cannot be overridden.

Since all keywords are going to be added as subs to the CORE:: name-
space, with prototypes wherever they can apply, it makes sense to
return prototypes for all that can have them, which turns out to be
only a handful.