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
Father Chrysostomos [Sun, 25 Dec 2011 20:39:47 +0000 (12:39 -0800)]
sv.c:dirp_dup: Avoid compiler warning
Some compilers complain, because -1 is being assigned to an unsigned
variable. This variable is not actually used before being assigned
to, but we have to initialise it as some other compilers cannot
detect that.
Father Chrysostomos [Sun, 25 Dec 2011 08:52:17 +0000 (00:52 -0800)]
diag.t: Remove documented entry
It was only listed here because originally the perldiag entry had
nonexistent spelt correctly, while the perl source had it hyphenated.
That was corrected a while ago.
Father Chrysostomos [Sun, 25 Dec 2011 08:49:58 +0000 (00:49 -0800)]
[perl #99426] op.c: Remove dead code from ck_sort
The op that the else block (see the diff) is trying to null is already
a null. So this else block can be deleted.
The null I’m referring to is
$ perl -MO=Concise -e 'sort $fo @fo'
8 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
7 <@> sort vKS ->8
3 <0> pushmark s ->4
- <1> null K/1 ->5 <-- over here.
- <1> ex-rv2sv sK/1 ->-
4 <#> gvsv[*fo] s ->5
6 <1> rv2av[t3] lK/1 ->7
5 <#> gv[*fo] s ->6
-e syntax OK
Father Chrysostomos [Sun, 25 Dec 2011 08:44:49 +0000 (00:44 -0800)]
Document ‘Attempt to clear deleted array’ in perldiag
Father Chrysostomos [Sun, 25 Dec 2011 08:38:34 +0000 (00:38 -0800)]
Add diag_listed_as for non-numeric warnings
Father Chrysostomos [Sun, 25 Dec 2011 08:16:21 +0000 (00:16 -0800)]
PerlIO::get_layers: Treat numbers as strings
PerlIO::get_layers should not be ignoring an argument like 12, but
treating "12" (the string) as a filehandle, as those are both the
same value.
It’s an instance of the string/num bug, which is a bit like the
Unicode Bug.
This commit takes the conservative approach of expanding it to flat
scalars in general, but not references (in case we decide to do
something interesting later on, even though I think that would be a
bad idea).
Father Chrysostomos [Sun, 25 Dec 2011 08:04:18 +0000 (00:04 -0800)]
[perl #97956] PerlIO::get_layers: call get-magic
Father Chrysostomos [Sun, 25 Dec 2011 07:47:12 +0000 (23:47 -0800)]
Run more substr tests under a new thread
Yours truly added tests to substr.t outside of sub run_tests.
Father Chrysostomos [Sun, 25 Dec 2011 07:35:52 +0000 (23:35 -0800)]
select() can return undef when defoutgv is set
If PL_defoutgv has been deleted from its stash, select() returns it
as a ref, but if the stash has been freed (even though the gv still
exists), it returns undef.
That makes no sense.
This is one of those nice cases where simplifying the code
fixes a bug.
Father Chrysostomos [Sun, 25 Dec 2011 07:27:30 +0000 (23:27 -0800)]
select() sometimes returns invalid string
The return value from select() is sometimes a string, and sometimes a
globref. It was originally always a string, but typeglobs not to be
found under their names in their stashes started being returned as
references in 5.002 beta 1 (
4633a7c4b). The logic is a little faulty,
though, as sometimes the name that is returned cannot be used to find
the glob:
$ perl -le '
open "foo::bar", ">/dev/ttys009";
select foo::bar;
my $handle = \*foo::bar;
my $stash = \%foo::bar;
*foo:: = *bar::;
print "hello";
select select;
print "hello" or warn $!
'
Bad file descriptor at -e line 9.
In this example, /dev/ttys009 is another terminal window. "hello"
only appears once, not twice.
Father Chrysostomos [Sun, 25 Dec 2011 03:35:26 +0000 (19:35 -0800)]
Add basic tests for select()
Father Chrysostomos [Sun, 25 Dec 2011 03:21:17 +0000 (19:21 -0800)]
[perl #86060] $( $| $) need braces in regexps
Father Chrysostomos [Sun, 25 Dec 2011 03:13:19 +0000 (19:13 -0800)]
feature.pl: Get HINT_UNI_8_BIT from perl.h
Since feature.pm is now a generated file, there is no reason to hard-
code constants from perl.h into it. We can get them from perl.h auto-
matically.
Father Chrysostomos [Sun, 25 Dec 2011 03:01:48 +0000 (19:01 -0800)]
coresubs.t: Call done_testing with an arg
Father Chrysostomos [Sun, 25 Dec 2011 03:01:04 +0000 (19:01 -0800)]
coreamp.t: Call done_testing with an arg
Father Chrysostomos [Sun, 25 Dec 2011 02:59:47 +0000 (18:59 -0800)]
deparse.t: Automatically count __DATA__ tests
I didn’t know that done_testing could take an argument. This elimi-
nates the manual fiddling of the test count every time a test is added
to __DATA__. For other tests, which are the exception, we still have
the safety of a test count to make sure the tests actually run.
Father Chrysostomos [Sun, 25 Dec 2011 02:07:33 +0000 (18:07 -0800)]
Deparse the /d flag with implicit features
Before the recent feature revamp (
2fc860ee1e0), loading the
unicode_strings feature would always set the feature_unicode %^H ele-
ment, even though the core did not actually use it. Now it is some-
times not set. So we have to check the hint bits as well. Since
feature.pm has it hardcoded, load feature.pm to get the right bit.
The stuff with $feature_bundle_mask is redundant, but it avoids load-
ing feature.pm unnecessarily.
Father Chrysostomos [Sun, 25 Dec 2011 01:54:16 +0000 (17:54 -0800)]
Deparse /$#a/ correctly
This is related to
4b58603b60.
This time it’s this op tree that pure_string can’t handle:
8 </> match() vK/RTIME ->9
7 <|> regcomp(other->8) sK/1 ->8
3 <1> regcreset sK/1 ->4
6 <1> av2arylen sK/1 ->7
5 <1> rv2av[t2] sKR/1 ->6
4 <#> gv[*a] s ->5
In writing a test for this, I triggered a case that
415d4c68d missed
(only $a and $b are exempt from strict vars, not @a and @b), so that
is fixed in the same commit.
Father Chrysostomos [Sun, 25 Dec 2011 00:58:54 +0000 (16:58 -0800)]
Don’t warn for open(foo::bar)
Father Chrysostomos [Sun, 25 Dec 2011 00:22:48 +0000 (16:22 -0800)]
Deparse.pm: Document that strict vars and subs work
Father Chrysostomos [Sun, 25 Dec 2011 00:27:47 +0000 (16:27 -0800)]
Port regen/regen_lib.pl to 5.6.2
Since the regen scripts use the system perl, I thought I might as
well test regen/feature.pl with 5.6.2, the earliest I have installed.
It failed.
Father Chrysostomos [Sat, 24 Dec 2011 22:44:30 +0000 (14:44 -0800)]
[perl #24027] Deparse strict vars and subs
B::Deparse only supported strict refs till now, and not the other two.
The hints were always present, but were being ignored. It was more
complicated than simply printing out the pragma settings. Variables
have to be qualified, too, under strict vars.
Father Chrysostomos [Sat, 24 Dec 2011 21:07:38 +0000 (13:07 -0800)]
Fix Deparse ambient_pragmas/strict regression
This commit fixes a regression introduced by
b50b2058.
ambient_pragmas makes changes to %^H, which affect the currently com-
piling scope.
BEGIN {
new B'Deparse -> ambient_pragmas strict => 'all';
}
use 5.012;
# no strict here
B::Deparse really does know too much about perl’s internals. It is
calling strict.pm’s internal routines, which now set %^H, so Deparse
has to localise it.
Since it is very easy to write tests in evals that simply do not run
(I actually did that when trying to test this, and was puzzled as to
why everything was passing anyway), I have restored the test count.
Sorry, Nicholas.
Father Chrysostomos [Sat, 24 Dec 2011 15:05:42 +0000 (07:05 -0800)]
Don’t crash when writing to null hash elem
It’s possible for XS code to create hash entries with null values.
pp_helem and pp_slice were not taking that into account. In fact,
the core produces such hash entries, but they are rarely visible from
Perl. It’s good to check for them anyway.
Father Chrysostomos [Sat, 24 Dec 2011 07:38:23 +0000 (23:38 -0800)]
hv.c: Make newHVhv work on tied hashes
Father Chrysostomos [Sat, 24 Dec 2011 07:29:32 +0000 (23:29 -0800)]
*Now* increase $XS::APItest::VERSION to 0.35
without touching anything else.
Father Chrysostomos [Sat, 24 Dec 2011 20:51:09 +0000 (12:51 -0800)]
Deparse.pm: Document that use feature is supported
Father Chrysostomos [Sat, 24 Dec 2011 20:46:49 +0000 (12:46 -0800)]
Deparse all features with ‘use/no feature’
Father Chrysostomos [Sat, 24 Dec 2011 17:35:21 +0000 (09:35 -0800)]
[Merge] Feature-loading revamp
Features can now be loaded by version declarations without feature.pm
having to be loaded.
feature.pm is now a generated file. feature.h is a new file with mac-
ros to make this work. regen/feature.pl is a new script to generate
those two files.
A few hint bits are used to represent the current feature bundle. If
the ‘custom’ bundle is active, this means that the hint hash is used,
as before.
There is no longer any need for ‘negative’ features--those whose
entries in %^H turn them off. The only feature in that category was a
default feature. Now we use the default bundle in PL_hints, which is
indicated by 0 (see feature.h), so we don’t even have to set it.
feature.pm, when it sees bundle hints active, updates %^H to match
and then sets the current bundle to ‘custom’, before enabling or disa-
bling features.
Father Chrysostomos [Sat, 24 Dec 2011 17:23:41 +0000 (09:23 -0800)]
rmg: feature.pl needs to be run
Father Chrysostomos [Sat, 24 Dec 2011 14:47:41 +0000 (06:47 -0800)]
Deparse implicit with ‘use feature’
When a version declaration has been seen, it’s not possible to deparse
the code perfectly correctly, but using ‘no feature; use feature
"5.14"’ is a reasonable tradeoff. See also commit
1c74777c25.
This necessitated sorting %^H keys that are output to keep tests pass-
ing. Previously they were relying on phases of the moon.
Father Chrysostomos [Sat, 24 Dec 2011 08:06:20 +0000 (00:06 -0800)]
Deparse CORE::say, etc., when bundle hints are in use
Father Chrysostomos [Sat, 24 Dec 2011 04:46:00 +0000 (20:46 -0800)]
use VERSION needs to enable uni8bit hint
Father Chrysostomos [Sat, 24 Dec 2011 03:14:25 +0000 (19:14 -0800)]
Update rmg concerning feature bundles
The data are now to be modified in regen/feature.pl, rather than
lib/feature.pm.