Shlomi Fish [Sun, 11 Dec 2011 19:49:29 +0000 (21:49 +0200)]
perl -d: test for 'T'.
Shlomi Fish [Sat, 10 Dec 2011 15:23:04 +0000 (17:23 +0200)]
perl -d: add test for the x command.
Shlomi Fish [Sat, 10 Dec 2011 14:17:04 +0000 (16:17 +0200)]
Add a test for the debugger p command.
Chris 'BinGOs' Williams [Fri, 30 Dec 2011 15:35:54 +0000 (15:35 +0000)]
Update CGI to CPAN version 3.59
[DELTA]
Version 3.59 Dec 29th, 2011
[BUG FIXES]
- We no longer read from STDIN when the Content-Length is not set, preventing
requests with no Content-Length from freezing in some cases. This is consistent
with the CGI RFC 3875, and is also consistent with CGI::Simple. However, the old
behavior may have been expected by some command-line uses of CGI.pm.
Thanks to Philip Potter and Yanick Champoux. See RT#52469 for details:
https://rt.cpan.org/Public/Bug/Display.html?id=52469
[INTERNALS]
- remove tmpdirs more aggressively. Thanks to rjbs (RT#73288)
- use Text::ParseWords instead of ancient shellwords.pl. Thanks to AlexBio.
- remove use of define(@arr). Thanks to rjbs.
- spelling fixes. Thanks to Gregor Herrmann and Alessandro Ghedini.
- fix test count and warning in t/fast.t. Thanks to Yanick.
Eric Brine [Fri, 30 Dec 2011 05:55:40 +0000 (21:55 -0800)]
Clarify that \Q, \U, \L don't require \E
Signed-off-by: Abigail <abigail@abigail.be>
Nicholas Clark [Fri, 30 Dec 2011 13:23:53 +0000 (14:23 +0100)]
Note POSIX changes in perldelta.
Nicholas Clark [Fri, 9 Dec 2011 12:09:07 +0000 (13:09 +0100)]
Provide the correct POSIX return value for POSIX::dup2() on Win32.
Microsoft, in their wisdom, chose to ignore the POSIX spec when implementing
their dup2(), and have theirs return 0 on success, instead of the file
descriptor. It seems that no other vendor is this, um, "special", so code
the exception directly, as we don't run Configure on Win32, so there's little
point probing for this.
This resolves RT #98912.
Nicholas Clark [Thu, 8 Dec 2011 15:46:21 +0000 (16:46 +0100)]
Convert POSIX::sleep to an XS wrapper for PerlProc_sleep().
Previously it was a Perl wrapper for CORE::sleep, converting CORE::sleep's
return value of elapsed time slept into the POSIX return value of seconds
remaining. However, that approach could sometimes return a negative result
if CORE::sleep had slept for more than a second longer than the requested
time.
Karl Williamson [Fri, 30 Dec 2011 04:52:45 +0000 (21:52 -0700)]
perldelta for Unicode::UCD change
Karl Williamson [Fri, 30 Dec 2011 02:14:07 +0000 (19:14 -0700)]
Unicode::UCD: Use 6.1 format for Name_Alias
The Name_Alias property is changing significantly in Unicode 6.1. It
will have an extra value for each alias (and there will be a lot more
aliases). That extra value is considered informative, and gives the
type of alias this is. prop_invmap() should return both the alias and
its type. This commit changes it so that even in 6.0, it will return
what it is going to return in 6.1 (for the 6.0 aliases).
This function has not been released in a stable Perl version. Thus,
this gets the ultimate format into Perl before anyone has come to depend
on the earlier one.
squish
Karl Williamson [Fri, 23 Dec 2011 00:58:20 +0000 (17:58 -0700)]
regcomp.c: Silence valgrind warning
This happens only in doing debug output. Initialize these two debugging
variables
Karl Williamson [Tue, 27 Dec 2011 20:47:36 +0000 (13:47 -0700)]
mktables: Add comment
Karl Williamson [Tue, 27 Dec 2011 18:12:47 +0000 (11:12 -0700)]
mktables: Arrange to handle 6.1 ScriptExtensions.txt
Unlike 6.0, this property is listed in 6.1's PropValueAliases.txt, so is
automatically created in 6.1. Thus this needs to be checked for and the
initialization moved out of the constructor.
Karl Williamson [Tue, 27 Dec 2011 17:51:58 +0000 (10:51 -0700)]
mktables: Accommodate new @missings in Unicode 6.1
The Unicode 6.1 release candidate includes a new @missings line for the
ScriptExtenstions.txt file which we need to know about and deal with.
Karl Williamson [Tue, 27 Dec 2011 17:46:54 +0000 (10:46 -0700)]
mktables: Make protected method available
This is needed in 6.1 for a special case. It still should be used only
in limited circumstances so is still protected (meaning only that its
name begins with an underscore).
Karl Williamson [Tue, 27 Dec 2011 17:12:26 +0000 (10:12 -0700)]
mktables: Add capability to add dup FIFO
This is in preparation for Unicode 6.1. This adds the capability for a
duplicate code point to be added to a table after all existing
duplicates. Previously, new duplicates were added before any existing
ones.
Karl Williamson [Tue, 27 Dec 2011 16:57:53 +0000 (09:57 -0700)]
mktables: Rename variable
This is in preparation for Unicode 6.1. The variable means LIFO, and in
6.1, a FIFO mode will also be required, so indicate that the current
variable means LIFO.
Karl Williamson [Tue, 27 Dec 2011 02:30:45 +0000 (19:30 -0700)]
charnames.t: Skip null name test
In versions of Unicode earlier than 6.1, there was no possibility of a
name being empty here; but 6.1 will make that happen, so guard against
it.
Karl Williamson [Tue, 27 Dec 2011 02:28:03 +0000 (19:28 -0700)]
charnames.t: Add test names
This adds test names to nearly all the ones that were missing. Most
were done via a global substituted in a text editor.
Karl Williamson [Tue, 27 Dec 2011 02:23:53 +0000 (19:23 -0700)]
charnames.t: Fix test that passed whether or not it should
This test was calling grep, then the comma operator, then the non-empty
string after the comment operator caused it to always succeed.
Karl Williamson [Tue, 27 Dec 2011 00:38:44 +0000 (17:38 -0700)]
mktables: Comments only
Karl Williamson [Mon, 26 Dec 2011 20:05:10 +0000 (13:05 -0700)]
Unicode/UCD.t: Avoid early prototype messages
Add an ampersand before the calls to silence these warnings
Karl Williamson [Mon, 26 Dec 2011 19:45:17 +0000 (12:45 -0700)]
mktables: Ignore @missing lines in certain source files
This is in preparation for Unicode 6.1. The release candidate version of these files
changes the syntax of this line in several of its files, so that
mktables sees them as a problem. And, they aren't used anyway.
Karl Williamson [Fri, 23 Dec 2011 23:58:31 +0000 (16:58 -0700)]
perlunicode: nit
Karl Williamson [Mon, 26 Dec 2011 19:17:10 +0000 (12:17 -0700)]
mktables: Account for 2 provisional files
This is in preparation for Unicode 6.1. These two provisional
properties are available starting in 6.0, but the rest of the data base
did not refer to them, so we could safely ignore them. But in the beta
6.1, they are referred to elsewhere, which makes mktables generate hooks
for them, and then complains when those hooks are unused.
This patch should work no matter how 6.1 final comes out, and allows
someone who really wants to use these provisional properties to
recompile Perl without having to delve too far into the mktables code to
get it to work.
Karl Williamson [Mon, 26 Dec 2011 19:08:47 +0000 (12:08 -0700)]
mktables: Need to have two classes of unused files
The current code works only when skipped files aren't actually present.
Otherwise, it deletes them from a hash, which causes a wrong warning to
be output. By creating a separate hash for skipped files, we avoid
that.
Karl Williamson [Mon, 26 Dec 2011 18:51:21 +0000 (11:51 -0700)]
mktables: Consistently store lc of key in hash
In most places, the keys to this hash are stored in lowercase, but not
formerly this one. This enables not having to lc in other places.
Karl Williamson [Mon, 26 Dec 2011 18:45:16 +0000 (11:45 -0700)]
mktables: Can skip processing suppressed properties
Karl Williamson [Mon, 26 Dec 2011 18:21:54 +0000 (11:21 -0700)]
mktables: White-space only
To make vertically line up based on an added test
Karl Williamson [Mon, 26 Dec 2011 18:10:28 +0000 (11:10 -0700)]
mktables: Don't test suppressed table validity
This omits the test for should a table be full for suppressed tables.
Other actions in the code may or may not bypass filling them, knowing
they are suppressed.
Karl Williamson [Sat, 24 Dec 2011 23:31:17 +0000 (16:31 -0700)]
mktables: reorder two tests
This simply swaps two blocks so that the fate of a table is fully
figured out before deciding if it should match everything or not.
Matthew Horsfall (alh) [Sun, 25 Dec 2011 16:56:02 +0000 (11:56 -0500)]
Expand tabs in Artistic license to spaces
This addresses [rt.perl.org #74046] and Debian #572245
( http://bugs.debian.org/572245 )
Craig A. Berry [Thu, 29 Dec 2011 22:57:24 +0000 (16:57 -0600)]
Allow diag.t to pass tests for multi-line warnings.
It's been sending the full warning text to t/test.pl's pass()
function. If there are newlines in the the warning, t/TEST (though
not t/harness) will spew "Unexpected output at ..." messages and
fail the test. In this context, the warning is just a message
printed by the test infrastructure, so we might as well use the
version of the warning that's already had newlines replaced with
spaces.
Father Chrysostomos [Thu, 29 Dec 2011 19:13:57 +0000 (11:13 -0800)]
Increase $POSIX::VERSION to 1.28
Leon Timmermans [Mon, 26 Dec 2011 17:06:54 +0000 (19:06 +0200)]
Signal handlers must run before sigsuspend returns
The whole point of sigsuspend and pause is to wait until a signal has
arrived, and then return *after* it has been triggered. Currently
delayed/"safe" signals prevent that from happening, which might cause
race conditions.
This patch prevents that (as far as possible) by running the signal
handlers ASAP.
Steffen Mueller [Thu, 29 Dec 2011 16:54:37 +0000 (17:54 +0100)]
ExtUtils::ParseXS: Bump versions to 3.11
This is necessary for a CPAN release that fixes a versioning problem in
version 3.09 (CPAN RT #73555).
No functional changes.
Leon Timmermans [Mon, 4 Jul 2011 11:05:39 +0000 (13:05 +0200)]
Export PerlIOBase_open
Shlomi Fish [Sat, 10 Dec 2011 11:35:41 +0000 (13:35 +0200)]
perl -d: display lines inside subroutines.
This is another fix to the perl debugger while making sure that lines
inside subroutines will be printed in the run-time display of the perl
debugger: https://rt.perl.org/rt3/Ticket/Display.html?id=104820 .
Father Chrysostomos [Thu, 29 Dec 2011 07:04:04 +0000 (23:04 -0800)]
Croak when setting a tied @DB::args
In commit
f8c105437 I stopped the setting of a tied @DB::args from
crashing, by untying the array. Untying an array automatically with-
out saying anything seems a little too much like action at a distance.
For now, let’s just croak, as we can always change it later once we
decide what should happen. At least that’s better than crashing.
Father Chrysostomos [Thu, 29 Dec 2011 07:00:57 +0000 (23:00 -0800)]
[Merge] perldiag/diag.t clean-up
This is a random sequence of a about one and a half dozen commits that
all happen to be in the same area.
At least one of these changes the wording of a message, so it should
probably go in perldelta.
Father Chrysostomos [Wed, 28 Dec 2011 05:40:57 +0000 (21:40 -0800)]
Speed up diag.t slightly
By using strings instead of creating qr// things that get flattened,
we can reduce the run time by 5%.
Father Chrysostomos [Wed, 28 Dec 2011 05:27:00 +0000 (21:27 -0800)]
perldiag: Delete redundant entry
This was made redundant three commits ago when I added more
descriptive entries for the two variations of this message.
Father Chrysostomos [Wed, 28 Dec 2011 02:12:20 +0000 (18:12 -0800)]
diag.t: Delete documented items from to-do
Father Chrysostomos [Wed, 28 Dec 2011 02:11:28 +0000 (18:11 -0800)]
Regen pod issues
podcheck.t doesn’t like links with formatting codes, even though the
spec says to do it that way.
Father Chrysostomos [Wed, 28 Dec 2011 02:04:17 +0000 (18:04 -0800)]
Document various messages in perldiag
Father Chrysostomos [Tue, 27 Dec 2011 22:52:21 +0000 (14:52 -0800)]
diag_listed_as galore
In two instances, I actually modified to code to avoid %s for a
constant string, as it should be faster that way.
Father Chrysostomos [Tue, 27 Dec 2011 20:44:43 +0000 (12:44 -0800)]
diag_listed_as for -S error
Also teach diag.t not to mistake /* die */ for a die() call, as
it did in this case, consequently ignoring the diag_listed_as,
which it thought was in the middle of the call.
Father Chrysostomos [Tue, 27 Dec 2011 18:09:01 +0000 (10:09 -0800)]
diag_listed_as for another lv sub error
Father Chrysostomos [Tue, 27 Dec 2011 18:06:44 +0000 (10:06 -0800)]
diag_listed_as for lvalue scalar context errors
Father Chrysostomos [Tue, 27 Dec 2011 18:05:04 +0000 (10:05 -0800)]
perldiag: Consistent formatting of categories
Father Chrysostomos [Tue, 27 Dec 2011 17:57:59 +0000 (09:57 -0800)]
perldiag: Tweak pack/% message
to match the actual message perl emits.
Father Chrysostomos [Tue, 27 Dec 2011 17:56:25 +0000 (09:56 -0800)]
diag.t: perldiag does not escape %
It’s primarily for human consumption, and escaping % doesn’t avoid
ambiguities anyway, as some messages contain a literal \ followed
by a format sequence.
Father Chrysostomos [Tue, 27 Dec 2011 17:49:48 +0000 (09:49 -0800)]
Document ‘Can't reset %ENV’ in perldiag
Father Chrysostomos [Tue, 27 Dec 2011 17:43:06 +0000 (09:43 -0800)]
Teach diag.t about "CONSTANTS" in msgs
After writing this code, I found that "Can't open "BIT_BUCKET"..." was
the only message affected, so I could have added an exception, but
I’ve already done this, so why not?
Father Chrysostomos [Tue, 27 Dec 2011 17:07:44 +0000 (09:07 -0800)]
perldiag: Document 2 more ‘Can't open’ messages
Father Chrysostomos [Tue, 27 Dec 2011 16:51:53 +0000 (08:51 -0800)]
perldiag: Tweak ‘Can't open perl script’
to match what’s in the source code more closely.
Father Chrysostomos [Tue, 27 Dec 2011 16:33:18 +0000 (08:33 -0800)]
Correct spelling of sv_insert error msg
It is already documented in perldiag with the right spelling.
Father Chrysostomos [Tue, 27 Dec 2011 16:31:06 +0000 (08:31 -0800)]
More diag_listed_as
Shlomi Fish [Mon, 12 Dec 2011 14:51:00 +0000 (16:51 +0200)]
perl -d: fixes "b . COND()".
break-dot for filename was broken due to previous commits. It was fixed
now. Also documented it in pod/perldebug.pod, because it was
undocumented.
Steffen Mueller [Wed, 28 Dec 2011 18:05:35 +0000 (19:05 +0100)]
Refer to ExtUtils::ParseXS 3.09 in Maintainers.pl
Steffen Mueller [Wed, 28 Dec 2011 17:47:49 +0000 (18:47 +0100)]
Escape double-quotes in generated #line directives
#line directives can be generated from commands. Those may be using
double quotes. That may not be considered friendly by preprocessors when
the result looks anything like this
#line 123 "perl -e "foo""
Input on whether the following is portable would be appreciated.
#line 123 "perl -e \"foo\""
gcc is happy with it. I know. The world's not just win32, osx, and linux
with a choice between three compilers.
Father Chrysostomos [Tue, 27 Dec 2011 08:58:23 +0000 (00:58 -0800)]
pp_hot.c: diag_listed_as for method error
Father Chrysostomos [Tue, 27 Dec 2011 08:56:45 +0000 (00:56 -0800)]
perldiag: Document ‘Bizarre SvTYPE’
Father Chrysostomos [Tue, 27 Dec 2011 08:54:41 +0000 (00:54 -0800)]
diag.t: Rmv warning about "0" from to-do list
This was already documented, but diag.t didn’t start realising that
until commit
ca53083acb.
Father Chrysostomos [Tue, 27 Dec 2011 08:53:21 +0000 (00:53 -0800)]
perldiag: Remove ‘in %s’ from bizarre copy msg
so that splain can find the message even when there is no op
mentioned.
Father Chrysostomos [Tue, 27 Dec 2011 08:46:10 +0000 (00:46 -0800)]
Move diag_listed_as entry in gv.c
It wasn’t close enough for diag.t to see it.
Father Chrysostomos [Tue, 27 Dec 2011 08:42:28 +0000 (00:42 -0800)]
Teach diag.t that %s%s == %s
Father Chrysostomos [Tue, 27 Dec 2011 08:40:30 +0000 (00:40 -0800)]
perldiag: Correct ‘Bad name after %s::’
This message can occur with either package separator (Bad name after
foo'), so having :: in the header stops splain from finding it.
Father Chrysostomos [Tue, 27 Dec 2011 08:35:39 +0000 (00:35 -0800)]
Remove item from diag.t’s to-do list
Father Chrysostomos [Tue, 27 Dec 2011 08:14:00 +0000 (00:14 -0800)]
av.c: Consistent use of spaces after dots in apidocs
Father Chrysostomos [Tue, 27 Dec 2011 08:12:24 +0000 (00:12 -0800)]
Document the av_reify warning in perldiag
Father Chrysostomos [Tue, 27 Dec 2011 08:11:29 +0000 (00:11 -0800)]
Fix compiler warning in perl.c
Father Chrysostomos [Tue, 27 Dec 2011 08:11:12 +0000 (00:11 -0800)]
Don’t check for tied @DB'args when not REAL
This should make things just a smidgen faster in the most common case.
As of the previous commit, tied arrays are always AvREAL.
Father Chrysostomos [Tue, 27 Dec 2011 08:10:05 +0000 (00:10 -0800)]
Turn on AvREAL for tied arrays
It turns out that it is possible to trigger the av_reify warning:
./perl -Ilib -lwe '
sub TIEARRAY{bless[]}
sub {
tie @_, "";
\@_;
}->(1);
'
av_reify called on tied array at -e line 7.
Father Chrysostomos [Tue, 27 Dec 2011 07:46:35 +0000 (23:46 -0800)]
Fix crash when tying @DB::args
I was looking at diag.t to see what messages I could document.
‘av_reify called on tied array’ looked interesting, so I decided to
see whether I could trigger it. I got something else:
./perl -Ilib -lwe '
sub TIEARRAY{bless[]}
sub CLEAR{}
sub EXTEND{}
tie @DB::args, "";
package DB; sub {() = caller 0;}->(1,2,3);
'
Name "DB::args" used only once: possible typo at -e line 5.
Bus error
How exciting!
What’s happening is that Perl_init_dbargs turns off AvREAL after
clearing a real array. Then pp_caller does av_extend and merrily
tries to copy into AvARRAY(PL_dbargs). But AvARRAY has not been allo-
cated, because av_extend called EXTEND instead.
I fixed this by untying the array before turning off AvREAL. I don’t
know whether that is the best fix. Alternatives would be to croak
or to do the assignment in pp_caller differently for tied arrays (in
which case tying @DB::args would cause objects to leak unexpectedly,
until the next caller() call in the DB package).
Father Chrysostomos [Tue, 27 Dec 2011 06:46:22 +0000 (22:46 -0800)]
perlxstut: keep indentation consistent within example
Dave Rolsky [Tue, 27 Dec 2011 07:05:35 +0000 (01:05 -0600)]
Only skip updating dev.perl.org for RC releases
Dave Rolsky [Tue, 27 Dec 2011 07:02:17 +0000 (01:02 -0600)]
Make sure to close any lists in the generated checklist
Father Chrysostomos [Tue, 27 Dec 2011 06:41:28 +0000 (22:41 -0800)]
[perl #102622] perlxstut: Add SvGETMAGIC to example
Father Chrysostomos [Tue, 27 Dec 2011 06:31:04 +0000 (22:31 -0800)]
Document the unknown error in perldiag
Father Chrysostomos [Tue, 27 Dec 2011 06:26:38 +0000 (22:26 -0800)]
Teach diag.t about multiline messages
A few commits ago I taught diagnostics.pm how to deal with these.
This applies things like "Attempt to reload %s aborted.\nCompilation
failed...", which is listed as two entries in perldiag.
If there is no match on a multiline message, it is treated as multi-
ple messages. If any of those cannot be found, the whole message is
reported as a failure.
Father Chrysostomos [Tue, 27 Dec 2011 06:26:20 +0000 (22:26 -0800)]
Fix up diagnostic.pm’s backtrace for multiline msgs
I hope you agree this backtrace does not look very good:
$ ./perl -Ilib -Mdiagnostics -e '
sub foo { bar () }
sub bar { baz() }
sub baz {
die "Attempt to reload foo aborted.\nCompilation failed in require"} foo
'
Attempt to reload foo aborted (#1)
(F) You tried to load a file with use or require that failed to
compile once already. Perl will not try to compile this file again
unless you delete its entry from %INC. See "require" in perlfunc and
"%INC" in perlvar.
Compilation failed in require at -e line 1 (#2)
(F) Perl could not compile a file specified in a require statement.
Perl uses this generic message when none of the errors that it
encountered were severe enough to halt compilation immediately.
Uncaught exception from user code:
Attempt to reload foo aborted.
Compilation failed in require at -e line 1.
main::baz() called at -e line 1
main::bar() called at -e line 1
main::foo() called at -e line 1
Father Chrysostomos [Tue, 27 Dec 2011 04:39:19 +0000 (20:39 -0800)]
Add support for multiline messages to splain
All the ‘Compilation failed’ messages are actually multiline mes-
sages, like "Attempt to reload foo aborted.\nCompilation failed in
require at ...".
perldiag has separate entries for each line of the message, so it
makes sense to have it look up each line. It can’t split it into
lines by default, but must check for a possible description first, as
sometimes syntax errors quote code with line breaks in it.
I had to rip out the nasty file-wide lexical $_, as I couldn’t local-
ise it, and I undid
d923656e4 in the process.
Father Chrysostomos [Tue, 27 Dec 2011 04:16:17 +0000 (20:16 -0800)]
diagnostics.t: Test errors ending with dots
Father Chrysostomos [Tue, 27 Dec 2011 00:56:14 +0000 (16:56 -0800)]
Remove unnecessary code from diagnostics.pm
As of commit
58618f23, it has been setting %CarpInternal, so
setting $CarpLevel is unnecessary.
Father Chrysostomos [Tue, 27 Dec 2011 00:55:35 +0000 (16:55 -0800)]
Fix diagnostic.pm’s backtraces
Currently a user-defined error message is printed out like this:
-----
Uncaught exception from user code:
panick: at -e line 1.
at -e line 1
main::baz() called at -e line 1
main::bar() called at -e line 1
main::foo() called at -e line 1
-----
Errors generated from perl itself are printed like this:
-----
panic: at -e line 1 (#1)
(P) An internal error.
Uncaught exception from user code:
panic: at -e line 1.
at -e line 1
main::baz() called at -e line 1
main::bar() called at -e line 1
main::foo() called at -e line 1
-----
By using Carp::confess(), we end up with a screwy backtrace. Some-
times it just ends up repeating the error and line number:
-----
panic: at -e line 1 (#1)
(P) An internal error.
Uncaught exception from user code:
panic: at -e line 1.
at -e line 1
-----
Uncaught exception from user code:
panick at -e line 1.
at -e line 1
-----
This commit cleans these up to print like this:
-----
Uncaught exception from user code:
panick: at -e line 1.
main::baz() called at -e line 1
main::bar() called at -e line 1
main::foo() called at -e line 1
-----
panic: at -e line 1 (#1)
(P) An internal error.
Uncaught exception from user code:
panic: at -e line 1.
main::baz() called at -e line 1
main::bar() called at -e line 1
main::foo() called at -e line 1
-----
panic: at -e line 1 (#1)
(P) An internal error.
Uncaught exception from user code:
panic: at -e line 1.
-----
Uncaught exception from user code:
panick at -e line 1.
-----
You might ask: Why not remove the ‘uncaught exception’ message alto-
gether after an error description. It’s because the error description
is a diagnostic, which only prints once for each error or warning
encountered. So you could have eval { die } somewhere else in the
code, which causes a description to be printed. And later you have a
die() that exits the program, but nothing gets printed.
In other words, the description of the message does not replace
the error.
Father Chrysostomos [Mon, 26 Dec 2011 22:17:03 +0000 (14:17 -0800)]
Consistent use of spaces after dots in diagnostics.pm
Father Chrysostomos [Mon, 26 Dec 2011 22:08:02 +0000 (14:08 -0800)]
Increase $diagnostics::VERSION to 1.27
Father Chrysostomos [Mon, 26 Dec 2011 21:58:48 +0000 (13:58 -0800)]
Convert diagnostics.t to test.pl
so that runperl is available
Father Chrysostomos [Mon, 26 Dec 2011 21:25:31 +0000 (13:25 -0800)]
Fix two (er, four) sub:lvalue { &$x } bugs
The lvalue context that the last statement of an lvalue subroutine
provides, when applied to entersub, causes the ops below the entersub
to be complied oddly. Compare regular subs and lvalue subs:
$ ./perl -Ilib -MO=Concise,bar,foo -e 'sub bar { &$x } sub foo:lvalue { &$x }'
main::bar:
5 <1> leavesub[1 ref] K/REFC,1 ->(end)
- <@> lineseq KP ->5
1 <;> nextstate(main 1 -e:1) v ->2
4 <1> entersub[t2] K/TARG ->5
- <1> ex-list K ->4
2 <0> pushmark s ->3
- <1> ex-rv2cv vK ->-
- <1> ex-rv2sv sK/1 ->-
3 <#> gvsv[*x] s ->4
main::foo:
b <1> leavesublv[1 ref] K/REFC,1 ->(end)
- <@> lineseq KP ->b
6 <;> nextstate(main 2 -e:1) v ->7
a <1> entersub[t2] K/LVINTRO,TARG,INARGS ->b
- <1> ex-list K ->a
7 <0> pushmark s ->8
9 <1> rv2cv vK/NO() ->a
- <1> ex-rv2sv sK/1 ->9
8 <#> gvsv[*x] s ->9
-e syntax OK
Notice that, in the second case, the rv2cv is not being optimised
away. Under strict mode, this allows a sub call on a string, since
rv2cv is not subject to strict refs.
It’s this code in op.c:op_lvalue_flags that is to blame:
if (kid->op_type != OP_GV) {
/* Restore RV2CV to check lvalueness */
restore_2cv:
if (kid->op_next && kid->op_next != kid) { /* Happens? */
okid->op_next = kid->op_next;
kid->op_next = okid;
}
else
okid->op_next = NULL;
okid->op_type = OP_RV2CV;
okid->op_targ = 0;
okid->op_ppaddr = PL_ppaddr[OP_RV2CV];
okid->op_private |= OPpLVAL_INTRO;
okid->op_private &= ~1;
break;
}
This code is a little strange. Using rv2cv to check lvalueness causes
the problem with strict refs. The lvalue check could just as well go
in entersub.
The way this is currently written (and this is something I missed when
supposedly fixing lvalue subs), the rv2cv op will reject a non-lvalue
subroutine even when the caller is not called in lvalue context.
So we actually have two bugs.
Presumably the check was done in rv2cv to keep entersub fast. But the
code I quoted above is only part of it. There is also a special block
to create an rv2cv op anew to deal with method calls.
This commit fixes both issues by moving the run-time lvalueness check
to entersub. I put it after PUSHSUB for speed in the most common
case (when there is no error). PUSHSUB already calls a function
(was_lvalue_sub) to determine whether the current sub call is happen-
ing in lvalue context. So the check I am adding after it only has to
check a couple of flags, instead of calling was_lvalue_sub itself.
This also fixes a bug I introduced earlier in the 5.15.x series. This
is supposed to die (in fact, I made the mistake earlier of changing
tests that were checking for this, but so many tests were wrong back
then it was an easy mistake to make):
$ ./perl -Ilib -e 'sub bar {$x} sub foo:lvalue { bar}; foo=3'
And a fourth bug I discovered when writing tests:
sub AUTOLOAD :lvalue { warn autoloading; $x }
sub _102486 { warn "called" }
&{'_102486'} = 72;
warn $x
__END__
autoloading at - line 1.
72 at - line 4.
And it happens even if there is an lvalue sub defined under that name:
sub AUTOLOAD :lvalue { warn autoloading; $x }
sub _102486 :lvalue { warn "called" }
&{'_102486'} = 72;
warn $x
__END__
autoloading at - line 1.
72 at - line 4.
Since the sub cannot be seen at compile time, the lvalue check in
rv2cv, as mentioned above. The autoloading is happening in rv2cv,
too, instead of entersub (the code is repeated), but the sub is not
checked for definition first. It was put in rv2cv because it had to
come before the lvalue check. Putting the latter in entersub lets us
delete that repeated autoload code, which is completely wrong anyway.
Father Chrysostomos [Mon, 26 Dec 2011 15:53:22 +0000 (07:53 -0800)]
perldiag: Remove msg deleted in 5.8.0
Father Chrysostomos [Mon, 26 Dec 2011 01:50:20 +0000 (17:50 -0800)]
Skip failing DD tests under 5.6
Father Chrysostomos [Mon, 26 Dec 2011 00:53:16 +0000 (16:53 -0800)]
Fix DD’s vstring tests unter 5.6
Father Chrysostomos [Mon, 26 Dec 2011 00:42:54 +0000 (16:42 -0800)]
Make DD dump *{''} correctly under 5.6
5.6 is strangely buggy, in that *{""} stringifies as "*main::\0". And
then there are some other strange eval bugs that the tests have to
work around.
Father Chrysostomos [Mon, 26 Dec 2011 00:09:59 +0000 (16:09 -0800)]
perldiag: Make 2 errors match the actual message
Father Chrysostomos [Mon, 26 Dec 2011 00:07:26 +0000 (16:07 -0800)]
Make DD dump *{''} properly
This typeglob is an oddity, in that it stringifies as *main::,
but cannot be reached under that name, because *main:: produces
*main::main::. The former is $::{""}; the latter $::{"main::"}.
I was inadvertently triggering this in 5.8 when I added a test a while
back for typeglobs will nulls in their names.
Father Chrysostomos [Sun, 25 Dec 2011 21:56:50 +0000 (13:56 -0800)]
Update concise-xs.t for recent DD change
Father Chrysostomos [Sun, 25 Dec 2011 21:45:31 +0000 (13:45 -0800)]
[perl #101162] DD support for vstrings
This commit adds support for vstrings to Data::Dumper, in both Perl
and XS implementations.
Since the actual vstring cannot be obtained from pure Perl, there is a
new _vstring XS function that the PP implementation uses, falling back
to sprintf "%vd" if XS is not available. The former dumps v1.2_3 cor-
rectly, while the latter produces v1.23. (I could make it use B to
extract the correct string, but XS is likely to be unavailable in
those circumstances where B is also unavailable [i.e., miniperl], so
it didn’t seem worth the effort.)
Some Perl versions (read: *all* released versions as of this message)
let vstring magic linger too long on strings that have been modified.
So that is checked for, but the bug is probed at compile time and the
code is #ifdeffed or use-constanted out when the bug is not present.
Due to the definition of the _bad_vsmg constant, I had to move
XSLoader::load into the BEGIN block. Since I was putting it there,
I combined it, the $Useperl = 1 and the eval{} into one statement,
for speed.
Since I was putting XSLoader::load into a BEGIN block, $VERSION needed
to be in one, too.
Father Chrysostomos [Sun, 25 Dec 2011 08:56:27 +0000 (00:56 -0800)]
Increase $Data::Dumper::VERSION to 2.135_02
Father Chrysostomos [Sun, 25 Dec 2011 21:09:58 +0000 (13:09 -0800)]
Supress warning in XS::APItest’s hash.t