Father Chrysostomos [Mon, 11 Nov 2013 20:54:53 +0000 (12:54 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:53:46 +0000 (12:53 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:48:29 +0000 (12:48 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:41:44 +0000 (12:41 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 20:35:01 +0000 (12:35 -0800)]
Father Chrysostomos [Mon, 11 Nov 2013 05:41:49 +0000 (21:41 -0800)]
In newATTRSUB, clear glob slot before lowering refcount.
(Actually in its subroutine, S_already_defined.)
Otherwise, when newATTRSUB redefines a sub, the previous sub’s DESTROY
can see the same sub still in the typeglob, but without a reference
count, so *typeglob = sub {} frees the sub currently in $_[0].
$ perl5.18.1 -le '
sub foo{}
bless \&foo;
DESTROY {
print "before: $_[0]"; *foo=sub{}; print "after: $_[0]"
}
eval "sub foo{}";
'
before: main=CODE(0x7fa88382d6d8)
before: main=CODE(0x7fa88382d6d8)
after: main=CODE(0x7fa88382d6d8)
after: UNKNOWN(0x7fa88382d6d8)
Father Chrysostomos [Sun, 10 Nov 2013 14:26:39 +0000 (06:26 -0800)]
In newXS, clear glob slot before lowering refcount.
Otherwise, when newXS redefines a sub, the previous sub’s DESTROY can
see the same sub still in the typeglob, but without a reference count,
so *typeglob = sub {} frees the sub currently in $_[0].
$ perl5.18.1 -le '
sub re::regmust{}
bless \&re::regmust;
DESTROY {
print "before: $_[0]"; *re::regmust=sub{}; print "after: $_[0]"
}
require re;
'
before: main=CODE(0x7ff7eb02d6d8)
before: main=CODE(0x7ff7eb02d6d8)
after: main=CODE(0x7ff7eb02d6d8)
after: UNKNOWN(0x7ff7eb02d6d8)
Father Chrysostomos [Sun, 10 Nov 2013 20:04:51 +0000 (12:04 -0800)]
Undeffing a gv in DESTROY triggered by undeffing the same gv
$ ./perl -Ilib -e 'sub foo{} bless \&foo; DESTROY { undef *foo } undef *foo'
Attempt to free unreferenced glob pointers, Perl interpreter: 0x7fd6a3803200 at -e line 1.
Lowering the reference count on the glob pointer only after freeing
the contents fixes this.
Father Chrysostomos [Sun, 10 Nov 2013 13:24:42 +0000 (05:24 -0800)]
Simplify code for deparsing socketpair
Instead of fixing a typo programmatically, just spell it correctly to
begin with. This should make things just slightly faster.
Daniel Dragan [Mon, 4 Nov 2013 08:18:58 +0000 (03:18 -0500)]
check existence of headers and libs for WinCE in Makefile.ce
Macro LIBC was used since day 1 of WinCE port (commit
e1caacb4fd ), but
never before defined. On Desktop Win32 Perl, LIBC is msvcrt.lib, so fix
corelibc/msvcrt to be LIBC and not part of CELIBS. Then use LIBC in a
sanity check. Sanity checks will give an error message, vs running the
C compiler and geting cryptic messages about unknown .hs and random
missing symbols.
David Mitchell [Thu, 7 Nov 2013 12:17:26 +0000 (12:17 +0000)]
fix chop formats with non PV vars
[perl #119847], [perl #119849], [perl #119851]
Strange vars like ties, overloads, or stringified refs (and in recent
perls, pure NOK vars) would generally do the wrong thing in formats
when the var is treated as a string and repeatedly chopped, as in
^<<<~~ and similar. This would manifest itself in infinite loops, utf8
errors etc. A recent change that stopped a stringified NOK getting
converted into a POK made the same badness happen for plain NVs too.
This commit contains two main fixes. First, the chopping was done
using sv_chop(), which only worked on POK strings. If its !POK, we now do
sv_setpvn() instead, which is less efficient, but will ensure the right
thing is always done.
Secondly, we make sure that the sv is accessed only once per cycle,
doing s = SvPV(sv, len) or similar. After that, all access is done only
via s and len. One place was using SvPVX(sv), and several places
were using the sv for utf8<->byte length conversions, such as
sv_pos_b2u().
It turns out that all the complex utf8 handling could be enormously
simplified. Since the code that needed to do utf8/byte length conversions
already scanned the string looking for suitable split points (such as
spaces or \n or \r), it was easiest to include any utf8 processing in the
same loop - i.e. incrementing s by UTF8SKIP(s) each time, but incrementing
the character count by 1.
The original diagnosis and reporting of this issue was done by Nicholas
Clark, who also supplied most of the tests.
David Mitchell [Wed, 30 Oct 2013 15:06:53 +0000 (15:06 +0000)]
pp_formline(): document switch cases
The individual ops (such as FF_END) of the format bytecode are documented
in form.h; appned those descriptive texts also to the individual 'case
FF_END:' lines in pp_formline, to make navigation easier. Also ensure
there's a blank line before each 'case'.
No functional changes.
H.Merijn Brand [Mon, 11 Nov 2013 10:07:10 +0000 (11:07 +0100)]
Synology support now more explicit
Johan Vromans tested the changes on DS413. The changes I added before
are more Synology specific (though perhaps not only appropriate for
Synology) but at least wider than just armv5tel
Tony Cook [Wed, 18 Sep 2013 05:55:12 +0000 (15:55 +1000)]
[perl #75156] fix the return value and bits for removing a closed fh
Tony Cook [Wed, 18 Sep 2013 05:20:19 +0000 (15:20 +1000)]
[perl #75156] tests for deleting a closed handle from IO::Select
Daniel Dragan [Fri, 8 Nov 2013 02:33:57 +0000 (21:33 -0500)]
fix multi-eval of Perl_custom_op_xop in XopENTRY
Commit
1830b3d9c8 introduced a flaw where XopENTRY calls
Perl_custom_op_xop twice to retrieve the same XOP *. This is inefficient
and causes extra machine code. Since I found no CPAN or upstream=blead
usage of Perl_custom_op_xop, and its previous docs say it isn't 100%
public, it is being converted to a macro.
Most usage of Perl_custom_op_xop is to conditionally fetch a member of the
XOP struct, which was previously implemented by XopENTRY. Move the XopENTRY
logic and picking defaults to an expanded version of Perl_custom_op_xop.
The union allows Perl_custom_op_get_field to return its result in 1
register, since the union is similar to a void * or IV, but with the
machine code overhead of casting, if any, being done in the callee
(Perl_custom_op_get_field), not the caller. Perl_custom_op_get_field can
also return the XOP * without looking inside it to implement
Perl_custom_op_xop.
XopENTRYCUSTOM is a wrapper around Perl_custom_op_get_field with
XopENTRY-like usage.
XopENTRY is used by the OP_* macros, which are heavily used (but rarely
called, since custom ops are rare) by Perl lang warnings system. The
vararg warning arguments are usually evaluted no matter if the warning
will be printed to STDERR or not. Since some people like to ignore warnings
or run no strict; and warnings branches are frequent in pp_*, it is
beneficial to make the OP_* macros smaller in machine code. The design
of Perl_custom_op_get_field supports these goals.
This commit does not pass judgement on Ben Morrow's unclear public or
private API designation of Perl_custom_op_xop, and whether
Perl_custom_op_xop should deprecated and removed from public API. It was
trivial to leave a form of Perl_custom_op_xop in the new design.
XOPe enums are identical to XOPf constants so no conversion has to be
done between the field selector parameter and the field flag to test
in machine code.
ASSUME and NOT_REACHED are being introduced. The closest to the 2
previously was "assert(0)". Perl has not used ASSUME or CC specific
versions of it before. Clang, GCC >= 4.5, and Visual C are supported. For
completeness, ARMCC's __promise was added, but Perl is not known to have
any support for ARMCC by this commiter.
This patch is part of perl #115032.
Chris 'BinGOs' Williams [Sun, 10 Nov 2013 11:09:07 +0000 (11:09 +0000)]
Update Unicode-Collate to CPAN version 1.02
[DELTA]
1.02 Sun Nov 10 18:39:37 2013
- POD: fix [rt.cpan.org #90170] about iso-8859-1 letters in pod.
E<> is used for the compatibility with perl 5.6.1 and possibly EBCDIC.
- 1.01 forgot to increase the version number of CJK/Korean.pm.
- modified tests: cjkrange.t, compatui.t, hangtype.t, illegal.t,
loc_ja.t, loc_ta.t, overcjk0.t, overcjk1.t, view.t in t.
Father Chrysostomos [Sun, 10 Nov 2013 05:44:26 +0000 (21:44 -0800)]
op.c: Factor out common entersub-building code
This same incantation occurs four times, though the readpipe variant
was slightly different. The only difference was the lack of a scalar
flag on a null op, which makes no difference:
- <1> ex-rv2cv sK ->-
5 <$> gv(*require) s ->6
- <1> ex-rv2cv K ->-
5 <$> gv(*readpipe) s ->6
So I did not include the scalar() call, as it was unnecessary. Also,
I changed op_append_elem to newLISTOP, since the former calls the lat-
ter anyway in these cases.
Father Chrysostomos [Sun, 10 Nov 2013 05:15:32 +0000 (21:15 -0800)]
Fix deparsing of glob(my $x) and CORE::glob
A git bisect run like this:
$ ../perl.git/Porting/bisect.pl --start=v5.12.0 --end=v5.18.0 -e 'use B::Deparse; die if new B::Deparse->coderef2text(sub{glob my $x}) =~ /</'
points to v5.13.8-86-gd1bea3d as being the commit that cause it to
output <my $x>.
But my local 5.14.4 installation still outputs glob(my $x), so I am
not sure which commit is responsible. I suspect it changed multi-
ple times.
In any case, B::Deparse was expecting the argument to pp_glob always
to be a string, which is certainly not guaranteed.
This commit also causes CORE::glob to be deparsed correctly. glob is
one of those oddities like require that gets only half-overridden by
overrides. In this particular case the built-in pp_glob is still
used, but takes a different code path depending on whether it was pre-
fixed with CORE::. So, while glob is a strong keyword, it needs to be
treated as a weak one for deparsing purposes.
Father Chrysostomos [Sat, 9 Nov 2013 21:44:27 +0000 (13:44 -0800)]
Stop open fh, ">>", \$undef from warning
$ ./perl t/TEST ../cpan/Test-Simple/t/subtest/bail_out.t
t/../cpan/Test-Simple/t/subtest/bail_out ... Use of uninitialized value in open at /Users/sprout/Perl/perl.git-copy/cpan/Test-Simple/../../lib/Test/Builder.pm line 1895.
ok
All tests successful.
u=0.01 s=0.00 cu=0.09 cs=0.01 scripts=1 tests=2
Notice the uninitialized value.
$ ./perl -Ilib -Mwarnings=uninitialized -e 'open $fh, ">>", \$x'
Use of uninitialized value $x in open at -e line 1.
$ perl5.18.1 -Mwarnings=uninitialized -e 'open $fh, ">>", \$x'
I caused that in v5.19.5-44-g5a2bc23:
$ ../perl.git/Porting/bisect.pl --start=
045071eede --end=blead -e 'use warnings FATAL=>"uninitialized"; open $fh, ">>", \$x'
...
5a2bc23bfe5dc60ff957cb44ffaa57668d56d238 is the first bad commit
commit
5a2bc23bfe5dc60ff957cb44ffaa57668d56d238
Author: Father Chrysostomos <sprout@cpan.org>
Date: Fri Oct 25 06:15:30 2013 -0700
Better fix for #119529
Father Chrysostomos [Sat, 9 Nov 2013 21:40:04 +0000 (13:40 -0800)]
op.c: Remove unused var
From
2186f87343.
Father Chrysostomos [Sat, 9 Nov 2013 21:22:43 +0000 (13:22 -0800)]
perldiag: Two minor tweaks
One typo and one copy-and-paste error.
Karl Williamson [Thu, 31 Oct 2013 16:14:55 +0000 (10:14 -0600)]
perl.c: White space only
Properly indent a few lines
Karl Williamson [Fri, 8 Nov 2013 16:11:49 +0000 (09:11 -0700)]
numeric.c: White-space only
Properly indent the branch of an 'if'.
Karl Williamson [Thu, 7 Nov 2013 19:22:48 +0000 (12:22 -0700)]
regexec.c: Fix compiler warning
We add an #ifdef DEBUGGING around a variable declaration, as that
variable actually only gets used in DEBUGGING compiles.
David Mitchell [Fri, 8 Nov 2013 16:55:28 +0000 (16:55 +0000)]
make perl core quiet under -Wfloat-equal
The gcc option -Wfloat-equal warns when two floating-point numbers
are directly compared for equality or inequality, the idea being that
this is usually a logic error, and that you should be checking that the
values are instead very near to each other.
perl on the other hand has lots of reasons to do a direct comparison.
Add two macros, NV_eq_nowarn(a,b) and NV_eq_nowarn(a,b)
that do the same as (a == b) and (a != b), but without the warnings.
They achieve this by instead doing (a < b) || ( a > b).
Under gcc at least, this is optimised into the same code as the direct
comparison.
The are three places that I've left untouched, because they are handling
NaNs, and that gets a bit tricky. In particular (nv != nv) is a test for a
NaN, and replacing it with (< || >) creates signalling NaNs (whereas ==
and != create quiet NaNs)
David Mitchell [Sat, 9 Nov 2013 12:14:37 +0000 (12:14 +0000)]
porting/diag.t: restrict what's a warn function
add a couple of judicious \b's so that while warn() etc are seen
as calls to a warn-related function, this_is_not_a_warn() etc aren't.
This is needed for the next commit which will introduce the macro
NV_ne_nowarn().
Father Chrysostomos [Sat, 9 Nov 2013 05:44:18 +0000 (21:44 -0800)]
perldiag: Remove ‘The %s feature...’
The idea when this was added was for ‘use feature’ to warn when
an experimental feature was enabled. Things didn’t turn out that
way. Only lexical subs follow that wording, and they have their
own entry in perldiag, so this one is unnecessary.
Father Chrysostomos [Sat, 9 Nov 2013 05:42:12 +0000 (21:42 -0800)]
toke.c: Remove unnecessary assignment
LOP returns, so the value of orig_keyword is not used after this.
Father Chrysostomos [Sat, 9 Nov 2013 01:58:49 +0000 (17:58 -0800)]
[Merge] Make &CORE:: subs respect vmsish hints
Most lexical hints are stored in the statement’s nextstate(ment)
op (aka cop or control op). That op is available at run time as
PL_curcop, while the current op being executed is PL_op.
&CORE:: subs intentionally lack a nextstate op so they can see the
hints in the caller’s nextstate op.
Two vmsish hints were being stored in the current op, so &CORE::exit()
would not respect those hints, as &CORE::exit() executes the *same*
exit op each time.
This branch moves those hints to the nextstate op, so that &CORE::exit
behaves the same way as exit().
Father Chrysostomos [Sun, 3 Nov 2013 00:28:48 +0000 (17:28 -0700)]
Make &CORE::exit respect vmsish exit hint
by removing the hint from the exit op itself and just having pp_exit
look in the cop hint hash, where it is already stored (as a result of
having been in %^H at compile time).
&CORE:: subs intentionally lack a nextstate op (cop) so they can see
the hints in the caller’s nextstate op.
Father Chrysostomos [Sat, 9 Nov 2013 01:46:17 +0000 (17:46 -0800)]
Update dump.c for the exit->nextstate hush hint move
Father Chrysostomos [Thu, 7 Nov 2013 14:02:46 +0000 (06:02 -0800)]
Update B::Concise for the exit->nextstate hush hint move
Father Chrysostomos [Thu, 7 Nov 2013 13:56:19 +0000 (05:56 -0800)]
Fix &CORE::exit/die under vmsish "hushed"
This commit makes them behave like exit and die without the ampersand
by moving the OPpHUSH_VMSISH hint from exit/die op to the current
statement (nextstate/cop) instead. &CORE:: subs intentionally lack a
nextstate op, so they can see the hints in the caller’s nextstate op.
Father Chrysostomos [Sun, 3 Nov 2013 00:10:37 +0000 (17:10 -0700)]
Teach B::Concise about VMS hushed flag
Father Chrysostomos [Sat, 2 Nov 2013 05:00:35 +0000 (22:00 -0700)]
Failing tests for &CORE::exit/die with vmsish
Father Chrysostomos [Sat, 9 Nov 2013 01:41:31 +0000 (17:41 -0800)]
Fix pod screwup in
a05ea1cf8be
Thanks to Daniel Dragan for pointing it out.
Father Chrysostomos [Fri, 8 Nov 2013 21:13:29 +0000 (13:13 -0800)]
Long verbatim pod line in INSTALL
Father Chrysostomos [Fri, 8 Nov 2013 21:04:19 +0000 (13:04 -0800)]
Consistent spaces after dots in sv.c apidocs
Daniel Dragan [Fri, 8 Nov 2013 10:38:51 +0000 (05:38 -0500)]
POD-only mention sv_setsv does get magic but not set magic
Father Chrysostomos [Fri, 8 Nov 2013 14:04:20 +0000 (06:04 -0800)]
Warn for all uses of %hash{...} in scalar cx
and reword the warning slightly.
See <
20131027204944.20489.qmail@lists-nntp.develooper.com>.
To avoid getting a warning about scalar context for ‘delete %a[1,2]’,
which dies anyway, I stopped scalar context from being applied to
delete’s argument. Scalar context is not meaningful here anyway, and
the context is not really scalar.
This also means that ‘delete sort’ no longer produces a warning about
scalar context before dying, so I added a test for that.
Father Chrysostomos [Thu, 7 Nov 2013 13:33:24 +0000 (05:33 -0800)]
Make _charnames comparison null-safe
This comparison in toke.c checks whether the charnames translators is
the core’s own and, if so, skips certain validation checks.
Charnames translators coming from any package beginning with
"_charnames\0" would also be exempt from the checks, because the name
comparison stopped at the first null.
Father Chrysostomos [Thu, 7 Nov 2013 00:18:48 +0000 (16:18 -0800)]
Stop lexical CORE sub from interfering with CORE::
The way CORE:: was handled in the lexer was convoluted.
CORE was treated initially as a keyword, with exceptions in the lexer
to make it behave correctly. If it turned out not to be followed
by ::, then the lexer would fall back to treating it as a bareword
or sub name.
Before even checking for a keyword, the lexer looks for :: and goes
to the bareword/sub code. But it made a special exception there
for CORE::.
In the end, treating CORE as a keyword recognized by the keyword()
function requires more special cases than simply special-casing CORE::
in toke.c.
This fixes the lexical CORE sub bug, while reducing the total num-
ber of lines.
Father Chrysostomos [Wed, 6 Nov 2013 18:55:36 +0000 (10:55 -0800)]
toke.c: Remove dead code handling <FH> //
A few lines of code added by this commit:
commit
6f33ba736d46c2f5bfdb2405fd09d82ec18a1d07
Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Sun Aug 25 18:42:46 2002 +0000
Fix parsing problems with the // operator.
Make // able to follow various unary operators used without
arguments or parens (shift, pop, getc, pos, readline,
readlink, undef, umask, and the filetest operators), as
well as the <FH> operator.
were already unreachable when they were added, specifically the code
for handling // after <FH> (which is fortunate, because XTERMORDORDOR
after <FH> would break <FH>+1).
S_scan_inputsymbol sets pl_yylval.ival to OP_NULL, since it has
already created the ops; it has done so since perl 5.000. So this
branch is never reached when parsing <FH>.
The if-block containing these lines has had ‘|| op_type ==
OP_READLINE’ since perl 5.000, which has also always been redundant
for the same reason.
David Mitchell [Fri, 8 Nov 2013 15:13:23 +0000 (15:13 +0000)]
threads::shared: fix compiler warning
make the file name stored in the lock on debugging builds
be const char* rather than char*, so that passing __FILE__ doesn't give
lots of
shared.xs:1287:323: warning: deprecated conversion from string
constant to 'char *' [-Wwrite-strings]
David Mitchell [Fri, 8 Nov 2013 14:25:28 +0000 (14:25 +0000)]
t/x2p/find2perl.t: expand output
Currently there is one ok() per test case; split that into 4 ok()s
per case, so that different sorts of failures can be differentiated
(i.e. ability to: run find2perl, run its output, run find, and compare the
outputs.)
H.Merijn Brand [Fri, 8 Nov 2013 14:36:57 +0000 (15:36 +0100)]
This version bump also got lost in the merge
Guess there will always be ways in git to explore ...
H.Merijn Brand [Fri, 8 Nov 2013 14:34:11 +0000 (15:34 +0100)]
pod fix
I did this in the merge and the tests passed!
H.Merijn Brand [Mon, 2 Sep 2013 21:09:11 +0000 (23:09 +0200)]
Note (new) platform support
Do I need to add some more extensive reading in README.arm or the like?
H.Merijn Brand [Mon, 2 Sep 2013 17:02:22 +0000 (19:02 +0200)]
Enhance INSTALL instructions for missing libraries
H.Merijn Brand [Mon, 2 Sep 2013 17:01:31 +0000 (19:01 +0200)]
With symlinks in /lib m and crypt are are no longer exceptions
Configure will only look for libfoo.so. If libfoo.so.{num} exists and
libfoo.so does not, make a symbolic link and start over. For this
Synology DS213, I needed
# cd /lib
# ln -s libm.so.6 libm.so
# ln -s libcrypt.so.1 libcrypt.so
H.Merijn Brand [Mon, 2 Sep 2013 09:40:41 +0000 (11:40 +0200)]
Search for errno.h in more (semi)default locations
H.Merijn Brand [Mon, 2 Sep 2013 09:39:56 +0000 (11:39 +0200)]
hints for CPU model Marvell Kirkwood mv6282 ARMv5te
Tested on Synology DS213
architecture arm5tel seems to differ from other ARM
On Synology, all development is installed under /opt
LANG settings other than C are not (really) supported
Chris 'BinGOs' Williams [Fri, 8 Nov 2013 13:00:43 +0000 (13:00 +0000)]
Update B-Debug to CPAN version 1.19
[DELTA]
1.19 2013-11-07 rurban
* install into site (again) since 5.12
* support lexical subs, NAME instead of GV.
* fix double SV FLAGS
* fix wrong xpv_cur, add xpv_len
David Mitchell [Fri, 8 Nov 2013 11:56:34 +0000 (11:56 +0000)]
silence spurious 'may be uninitialized' warnings
-Wmaybe-uninitialized isn't smart enough, so explicitly NULL a couple
of vars to keep it happy.
David Mitchell [Fri, 8 Nov 2013 11:18:03 +0000 (11:18 +0000)]
remove some unused vars from op.c and toke.c
Craig A. Berry [Fri, 8 Nov 2013 00:51:03 +0000 (18:51 -0600)]
More stack for pat_thr.t on VMS as well.
Follow-up to
66478a1b30 and
58b6d14529f.
=?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= [Fri, 8 Nov 2013 01:17:08 +0000 (02:17 +0100)]
Commit
1735f6f53ca19f99c6e9e39496c486af323ba6a8 started to escape all
back-slashes which breaks case when lexicon translations contain substition
and literals with eval-non-safe characters. E.g. these translations:
"[_1]foo\\n\n" => "[_1]bar\\n\n",
'[_1]foo\n' => '[_1]aÄ
\9ba\n',
got doubled back-slashes on the maketext() output.
This patch de-escapes escaped backslashes if the literal is compiled as
function argument.
Fixes RT #120457.
Karl Williamson [Thu, 7 Nov 2013 19:17:20 +0000 (12:17 -0700)]
perlfunc: Clarify verbatim table
When I read what was here before this patch, I thought there was a typo,
as there was no entry in column 1 for several rows. Instead, what was
meant was that the item in column 1 row 1 was supposed to be dittoed
into the following rows. I used the solution employed in Camel 4,
which is to repeat that item in each row it applies to.
Father Chrysostomos [Wed, 6 Nov 2013 13:59:41 +0000 (05:59 -0800)]
perlfunc.pod: long verbatim lines
Father Chrysostomos [Wed, 6 Nov 2013 13:42:34 +0000 (05:42 -0800)]
Fix qx, `` and <<`` overrides
This resolves two RT tickets:
• #115330 is that qx and `` overrides do not support interpolation.
• #119827 is that <<`` does not support readpipe overrides at all.
The obvious fix for #115330 fixes #119827 at the same time.
When quote-like operators are parsed, after the string has been
scanned S_sublex_push is called, which decides which of two paths
to follow:
1) For things not requiring interpolation, the string is passed to
tokeq (originally called q, it handles double backslashes and back-
slashed delimiters) and returned to the parser immediately.
2) For anything that interpolates, the lexer enters a special inter-
polation mode (LEX_INTERPPUSH) and goes through a more complex
sequence over the next few calls (e.g., qq"a.$b.c" is turned into
‘stringify ( "a." . $ b . ".c" )’).
When commit
e3f73d4ed (Oct 2006, perl 5.10) added support for overrid-
ing `` and qx with a readpipe sub, it did so by creating an entersub
op in toke.c and making S_sublex_push follow path no. 1, taking the
result if tokeq and inserting it into the already-constructed op tree
for the sub call.
That approach caused interpolation to be skipped when qx or `` is
overridden. Furthermore it didn’t touch <<`` at all.
The easiest solution is to let toke.c follow its normal path and
create a backtick op (instead of trying to half-intercept it), and
to deal with override lookup afterwards in ck_backtick, the same way
require overrides are handled. Since <<`` also turns into a backtick
op, it gets handled too that way.
Father Chrysostomos [Wed, 6 Nov 2013 01:51:50 +0000 (17:51 -0800)]
Split ck_open into two functions
It is used for two op types, but only a small portion of it applies
to both, so we can put that in a static function. This makes the
next commit easier.
Father Chrysostomos [Tue, 5 Nov 2013 23:52:59 +0000 (15:52 -0800)]
gv.c:gv_try_downgrade: Use hv_fetchhek
Unlike hv_fetch, this also passes the precomputed hash, saving
hv_common from having to recalculate it.
Father Chrysostomos [Tue, 5 Nov 2013 23:47:30 +0000 (15:47 -0800)]
toke.c: Remove unnecessary UTF check
In this particular branch, the value of PL_tokenbuf will always
be a built-in keyword; i.e., pure ASCII. So there is no need to
do a utf8 check.
Father Chrysostomos [Tue, 5 Nov 2013 22:35:45 +0000 (14:35 -0800)]
Put common override code into gv_override
When I moved the three occurrences of this code in op.c into a static
function, I did not realise at the time that it also occurred thre
etimes in toke.c.
So now it is in a new non-static function in gv.c.
Only two of the instances in toke.c could be changed to use this func-
tion, as the otherwise is a little different. I couldn’t see a simple
way of factoring its requirements in.
Father Chrysostomos [Tue, 5 Nov 2013 21:02:36 +0000 (13:02 -0800)]
Fix readline overriden with a constant
<> doesn’t take into account that some subs are stored in a more
lightweight form than usual. These two programs should behave the
same way, but, as you can see below the __END__ markers, the output is
different:
use constant foo=>1;
BEGIN { *{"CORE::GLOBAL::readline"} = \&{"foo"}; 1}
warn <a>
__END__
Warning: something's wrong at - line 3.
use constant foo=>1;
BEGIN { *{"CORE::GLOBAL::readline"} = \&foo; 1}
warn <a>
__END__
Too many arguments for main::foo at - line 3, at end of line
Execution of -e aborted due to compilation errors.
The latter is the correct behaviour. The only different is \&{"foo"}
vs \&foo, the first of which triggers an optimisation.
S_scan_inputsymbol in toke.c needs to take the optimisation into
account (that stash entries are not necessarily globs but can be
upgraded to such).
Father Chrysostomos [Tue, 5 Nov 2013 20:52:58 +0000 (12:52 -0800)]
Allow CORE::GLOBAL:: subs in general to be aliased to consts
$ perl5.8.8 -e 'use constant foo=>1; BEGIN { *{"CORE::GLOBAL::time"} = \&{"foo"};1} warn time'
1 at -e line 1.
$ perl5.10.1 -e 'use constant foo=>1; BEGIN { *{"CORE::GLOBAL::time"} = \&{"foo"};1} warn time'
1383661397 at -e line 1.
When the storage of constants was optimised in perl 5.10, the code that
checks for global overrides was not updated to account.
Father Chrysostomos [Tue, 5 Nov 2013 14:14:59 +0000 (06:14 -0800)]
Stop gv_try_downgrade from anonymising referenced CVs
I keep discovering ways in which gv_try_downgrade, which is supposed
to be an optimisation, changes observable behaviour even without look-
ing at the stash.
This one had me confused at first:
$ ./perl -Ilib -e 'use constant foo=>1; BEGIN { $x = \&foo } undef &$x; $x->()'
Undefined subroutine called at -e line 1.
$ ./perl -Ilib -e 'use constant foo=>1; BEGIN { $x = \&{"foo"} } undef &$x; $x->()'
Undefined subroutine &main::foo called at -e line 1.
Notice how the first example (where gv_try_downgrade kicks in)
shows no name in the error message. This only happens on non-
threaded builds.
What’s happening is that, when the BEGIN block is freed, the GV op
corresponding to &foo get freed, triggering gv_try_downgrade, which
checks to see whether it can downgrade the GV to a simple reference
to a constant (the way constants are stored by default). It then pro-
ceeds to do that, so the GV qua GV ceases to exist, and the CV gets
automatically anonymised as a result (the same thing happens with
‘$x = \&{"foo"}; Dump $x; delete $::{foo}’, but legitimately in
that case).
The solution here is to check the reference count on the CV before
downgrading the GV. If the CV’s reference count > 1, then we should
leave it alone.
David Mitchell [Tue, 5 Nov 2013 15:52:31 +0000 (15:52 +0000)]
perlfunc: update require() pseudocode
RT #120292
The entry for require() in perlfunc has a perl function that's supposed to
illustrate how require works is rather out of date. In particular, the
fact that the search stops on EACCES wasn't incorporated, and the various
ways of it failing and reporting errors was inaccurate.
I also removed the explicit code for executing the 'do' in the caller's
package, and replaced it with just the comment 'but run in caller's
namespace', since the details were a bit obscure.
Finally, I re-indented it since it had strange 3-space indents
Father Chrysostomos [Tue, 5 Nov 2013 13:48:44 +0000 (05:48 -0800)]
gv.c: Removed redundant len==1 check
When I added this in
ea238638, I put the same code in the branches
for the main stash and other stashes. In the main stash branch, this
occurs in a switch that is solely for one-character names, so checking
the length again is superfluous.
Father Chrysostomos [Tue, 5 Nov 2013 05:52:55 +0000 (21:52 -0800)]
toke.c: Remove unnecessary SvRV null check
If SvROK is true, then SvRV will never be null. (If it is, then
serious problems will occur elsewhere, as other code assumes this.)
Father Chrysostomos [Tue, 5 Nov 2013 05:49:27 +0000 (21:49 -0800)]
Fix readpipe overriden with a constant
qx and `` don’t take into account that some subs are stored in a more
lightweight form than usual. These two programs should behave the
same way, but, as you can see below the __END__ markers, the output is
different:
use constant foo=>1;
BEGIN { *{"CORE::GLOBAL::readpipe"} = \&{"foo"}; 1}
warn ``
__END__
Warning: something's wrong at - line 3.
use constant foo=>1; BEGIN { *{"CORE::GLOBAL::readpipe"} = \&{"foo"}; 1} warn ``
__END__
Too many arguments for CORE::GLOBAL::readpipe at - line 3, at end of line
Execution of -e aborted due to compilation errors.
The latter is the correct behaviour.¹ The only different is \&{"foo"}
vs \&foo, which triggers an optimisation.
S_readpipe_override in toke.c needs to take the optimisation into
account (that stash entries are not necessarily globs but can be
upgraded to such).
¹ Except that the sub name reported is unexpected. Non-threaded
builds give me that; threaded builds give me main::foo. But that is
a separate bug.
Craig A. Berry [Tue, 5 Nov 2013 13:12:34 +0000 (07:12 -0600)]
i_arpainet and i_sysun for configure.com.
VMS does have arpa/inet.h and is supposed to be getting sys/un.h
in the near future.
Craig A. Berry [Tue, 5 Nov 2013 13:09:54 +0000 (07:09 -0600)]
caretx.c, not caretx.x, typo in
7b74bef1.
Though the list of C files does not appear to actually be used in
the build.
David Mitchell [Tue, 5 Nov 2013 12:29:07 +0000 (12:29 +0000)]
RT #120446: /\Ga/ running slowly on long strings
This commit reverts my commit
cf44e600505da0c8da2d64849647ce2d39c46808
(except for the tests), which incorrectly disabled fix-string intuiting
in the presence of anchored \G. I thought that the old behaviour was
logically incorrect, but it wasn't (or at least I don't see it that way
now, and none of the tests I added at the time fail under the old regime).
Father Chrysostomos [Mon, 4 Nov 2013 14:14:00 +0000 (06:14 -0800)]
[perl #120462] Exempt $a and $b from ‘used once’ warnings
Father Chrysostomos [Mon, 4 Nov 2013 13:51:50 +0000 (05:51 -0800)]
Move tests for ‘used once’ from util to gv
The warning itself is triggered in gv.c, so this makes the tests
easier to find.
Craig A. Berry [Tue, 5 Nov 2013 03:33:47 +0000 (21:33 -0600)]
And the caretx object file for wince.
Thanks to Daniel Dragan for pointing out the omission.
Craig A. Berry [Tue, 5 Nov 2013 01:18:09 +0000 (19:18 -0600)]
Also fix wince for caretx after
e2051532106.
Craig A. Berry [Tue, 5 Nov 2013 01:14:41 +0000 (19:14 -0600)]
Restore VMS build after
e205153210.
Steve Hay [Tue, 5 Nov 2013 01:06:48 +0000 (01:06 +0000)]
Restore Windows build following commit
e205153210
Chris 'BinGOs' Williams [Mon, 4 Nov 2013 22:36:32 +0000 (22:36 +0000)]
Update Module-Build to CPAN version 0.4008
[DELTA]
0.4008 - Mon Nov 4 23:10:54 CET 2013
[BUG FIXES]
- Fix test failing on ancient perls <= 5.8.1 [Peter Rabbitson]
- Do not set default switches in Test::Harness; not even -w [Leon Timmermans]
[DOCUMENTATION]
- Fix a couple more broken links to CPAN::META::Spec that should
have been CPAN::Meta::Spec. [Reported by Mike Doherty]
Father Chrysostomos [Mon, 4 Nov 2013 22:04:46 +0000 (14:04 -0800)]
caretx.c: Add LOTR quote
I don’t have the right edition, so could someone else please supply the
page number?
Father Chrysostomos [Mon, 4 Nov 2013 21:46:40 +0000 (13:46 -0800)]
caretx.c: Add bool warning comment
It is for this reason that this file exists.
Peter Martini [Sat, 2 Nov 2013 00:12:53 +0000 (20:12 -0400)]
Move the function to set $^X to its own file
This also moves the indirect dependency on stdbool.h to its
own file, rather than being pulled in for all of perl.c, for
those cases where one may want to test using other definitions
of bool.
Chris 'BinGOs' Williams [Mon, 4 Nov 2013 20:30:08 +0000 (20:30 +0000)]
Update Test-Simple to CPAN version 1.001002
[DELTA]
1.001002 Mon Nov 4 15:13:58 EST 2013
* no changes since 0.99
1.001001_001 Wed Oct 30 20:47:23 EDT 2013
* no code changes, just a new version number with more room to grow
Chris 'BinGOs' Williams [Mon, 4 Nov 2013 19:58:23 +0000 (19:58 +0000)]
Update ExtUtils-MakeMaker to CPAN version 6.82
[DELTA]
6.82 Mon Nov 4 19:20:07 GMT 2013
No changes from 6.81_05
6.81_05 Sat Nov 2 21:29:42 GMT 2013
Misc:
* Special-case the bundling of version, so
that XS versions don't get overwritten
6.81_04 Fri Nov 1 19:54:09 GMT 2013
Doc fixes:
* Update XSPROTOARG docs for changes in xsubpp
6.81_03 Thu Oct 24 20:50:15 BST 2013
Doc Fixes:
* Clarify heir-apparent in FAQ
Misc:
* Changed GNU-Style to Unix-Style
* VMS will now report 'make' style
6.81_02 Thu Oct 17 12:20:59 BST 2013
Misc:
* Updated bundled JSON::PP
6.81_01 Wed Oct 16 08:59:03 BST 2013
Misc:
* Updated bundled Test-Simple
Chris 'BinGOs' Williams [Mon, 4 Nov 2013 15:46:12 +0000 (15:46 +0000)]
Update IPC-Cmd to CPAN release 0.86
[DELTA]
0.86 Mon Nov 4 14:09:42 GMT 2013
======================================
Bug fixes:
* run_forked: workaround absent CLOCK_MONOTONIC on OSX (Petya Kohts)
* RT#89770 Patch to fix error reporting if command killed by signal
(Ed Avis)
* Make the false test more forgiving, for Solaris and other SVR*
(bingos)
0.85_02 Thu Oct 10 13:59:34 BST 2013
======================================
Bug Fixes:
* run_forked: incomplete output more than buffer size
0.85_01 Thu Sep 5 20:30:51 BST 2013
======================================
Enhancements:
* run_forked() now uses Time::HiRes and Carp
Father Chrysostomos [Mon, 4 Nov 2013 05:51:29 +0000 (21:51 -0800)]
op.c: Avoid vivifying CORE::GLOBAL:: globs unnecessarily
If we know the upgraded glob is not going to have the IMPORTED_CV
flag, we can avoid upgrading it.
Father Chrysostomos [Mon, 4 Nov 2013 05:48:09 +0000 (21:48 -0800)]
op.c: Abstract common override code
Father Chrysostomos [Mon, 4 Nov 2013 01:32:37 +0000 (17:32 -0800)]
Stop CORE::GLOBAL::require lookup from crashing on stub
‘sub CORE::GLOBAL::require;’ doesn’t create a full glob, but cheats
for efficiency. Compilation of require ops was not taking this
into account.
Father Chrysostomos [Mon, 4 Nov 2013 01:27:07 +0000 (17:27 -0800)]
Stop CORE::GLOBAL::glob lookup from crashing on stub
‘sub CORE::GLOBAL::glob;’ doesn’t create a full glob, but cheats for
efficiency. Compilation of glob ops was not taking this into account.
Father Chrysostomos [Mon, 4 Nov 2013 01:24:50 +0000 (17:24 -0800)]
Stop CORE::GLOBAL::do lookup from crashing on stub
‘sub CORE::GLOBAL::do;’ doesn’t create a full glob, but cheats
for efficiency. Compilation of do-file ops was not taking this
into account.
Father Chrysostomos [Sun, 3 Nov 2013 14:16:40 +0000 (06:16 -0800)]
Make mro code pass precomputed hash values
where possible
This involved adding hv_fetchhek and hv_storehek macros and changing
S_mro_clean_isarev to accept a hash parameter and expect HVhek_UTF8
instead of SVf_UTF8.
Father Chrysostomos [Sun, 3 Nov 2013 13:49:48 +0000 (05:49 -0800)]
Check that stash entries are GVs when aliasing pkgs
$ perl5.18.1 -e '$Foo::{"Bar::"} = 0; $Bar::Bar::; *Bar:: = *Foo::'
Segmentation fault: 11
That $Foo::{"Bar::"} = 0; assignment is documented as having unde-
fined behaviour, but it shouldn’t crash.
Father Chrysostomos [Sun, 3 Nov 2013 13:42:55 +0000 (05:42 -0800)]
gv.c: Tweak API docs
Consistent spaces after dots
Some grammar corrections (by no means sufficient, though)
Remove a sentence about ‘name’ being writable. It has been a const
char * since these docs were added in
954c1994.
Father Chrysostomos [Sun, 3 Nov 2013 13:24:10 +0000 (05:24 -0800)]
hv.h: missing macro parentheses
Let’s defuse this time bomb before it causes problems.
Father Chrysostomos [Sun, 3 Nov 2013 12:47:17 +0000 (04:47 -0800)]
sub NEGATIVE_INDICES; + $tied[-1] = crash
This code in av.c, when trying to find $NEGATIVE_INDICES, was doing a
direct stash element lookup--instead of going through the normal GV
functions--and then expecting the returned value to be a GV.
‘sub NEGATIVE_INDICES’ creates a stash element that is a PV, not a GV,
so it’s easy to make things crash.
Father Chrysostomos [Sun, 3 Nov 2013 12:23:43 +0000 (04:23 -0800)]
mg.c: Fix misuse of AvARRAY in defelem_target
defelem magic does not usually apply to tied arrays, but an array can
be tied after a defelem has been created and points to it. The code
for handling deferred elements was never updated for tied arrays when
those were added, so it still does AvFILL and AvARRAY.
AvFILL works on tied arrays, and calls FETCHSIZE. But AvARRAY
accesses the AV’s internal structure. So AvFILL might suggest that
the index is within the array, whereas it is actually past the end
of AvARRAY.
By tying the array after a deferred element with a high index has been
created and then extending the tied array (so AvFILL returns a big
number), we can make AvARRAY[big number] crash.
This script:
use Tie::Array;
sub {
tie @a, "Tie::StdArray";
$#a = 20000;
warn pre;
"$_[0]";
warn post
}->($a[10000]);
gives this output:
pre at -e line 5.
Segmentation fault: 11
For tied arrays, we need to use av_fetch, rather than AvARRAY.
Father Chrysostomos [Sat, 2 Nov 2013 19:38:41 +0000 (12:38 -0700)]
pp_sort.c: Remove useless assignments; reduce var scope
6cda7db16df9 stopped the value of the stash variable from being used,
so there is no longer any need to assign to it. sv_2cv, however,
requires an HV ** argument, so we cannot eliminate it completely.