| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
these were used as part of the old "use re 'eval'" security
mechanism used by the now-eliminated PL_reginterp_cnt
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Perl's internal function for compiling regexes that knows about code
blocks, Perl_re_op_compile, isn't part of the engine API. However, the
way that regcomp.c is dual-lifed as ext/re/re_comp.c with debugging
compiled in, means that Perl_re_op_compile is also compiled as
my_re_op_compile. These days days the mechanism to choose whether to call
the main functions or the debugging my_* functions when 'use re debug' is
in scope, is the re engine API jump table. Ergo, to ensure that
my_re_op_compile gets called appropriately, this method needs adding to
the jump table.
So, I've added it, but documented as 'for perl internal use only, set to
null in your engine'.
I've also updated current_re_engine() to always return a pointer to a jump
table, even if we're using the internal engine (formerly it returned
null). This then allows us to use the simple condition (eng->op_comp)
to determine whether the current engine supports code blocks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this commit, qr// with a literal (compile-time) code block
will Do the Right Thing as regards closures and the scope of lexical vars;
in particular, the following now creates three regexes that match 1, 2
and 3:
for my $i (0..2) {
push @r, qr/^(??{$i})$/;
}
"1" =~ $r[1]; # matches
Previously, $i would be evaluated as undef in all 3 patterns.
This is achieved by wrapping the compilation of the pattern within a
new anonymous CV, which is then attached to the pattern. At run-time
pp_qr() clones the CV as well as copying the REGEXP; and when the code
block is executed, it does so using the pad of the cloned CV.
Which makes everything come out all right in the wash.
The CV is stored in a new field of the REGEXP, called qr_anoncv.
Note that run-time qr//s are still not fixed, e.g. qr/$foo(?{...})/;
nor is it yet fixed where the qr// is embedded within another pattern:
continuing with the code example from above,
my $i = 99;
"1" =~ $r[1]; # bare qr: matches: correct!
"X99" =~ /X$r[1]/; # embedded qr: matches: whoops, it's still
seeing the wrong $i
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make Perl_re_compile() a thin wrapper around a new function,
Perl_re_op_compile(). This function can take either a string pattern or a
list of ops. Then make pmruntime() pass a list of ops directly to it, rather
concatenating all the consts into a single string and passing the const to
Perl_re_compile(). For now, Perl_re_op_compile just does the same: if its
passed an op tree rather than an SV, then it just concats the consts.
So this is is just the next step towards eventually allowing the regex
engine to use the ops directly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I ran into a bit of a problem when building perl-5.16.0.
'make test' showed a segfault in ext/XS-APItest/t/clone-with-stack.t.
It seems to be caused by accessing already freed memory, it
segfaults because I have MALLOC_PERTUBE_ set, thus glibc fills
freed memory with some value.
Digging deeper, it seems like perl_clone() does not fix
the cx's blk_oldcop element when doing context cloning, thus
blk_oldcop still points to PL_compiling in the old interp--the
calling scope for the BEGIN block being the compilation of the
code surrounding it--and the POPBLOCK done in leavesub will copy
the data from the old interp to PL_curcop.
After fixing this, it still crashed because interp_dup->Iop was
zero after the runops_standard() call (which is probably
correct as the end of the BEGIN block was reached). So I
also added an if statement that checks the pointer.
|
| |
|
|
|
|
|
|
|
|
|
| |
This was mentioned in ticket #113060.
This commit also adds another stashoff test.
The diff looks a bit complicated, because it stops ->file and
->stashpv from being XS aliases.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was brought up in ticket #78742.
The stashlen method has never been in a stable release, and no longer
exists, as of d4d03940c, since it is dependent on a define that
d4d03940c removed.
So this commit removes stashlen from B.xs and adds stashoff in its
place, since this is what B::C needs.
It also adds a few basic tests for the stash and stashpv methods.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this commit, a pointer to the cop’s stash was stored in
cop->cop_stash under non-threaded perls, and the name and name length
were stored in cop->cop_stashpv and cop->cop_stashlen under ithreads.
Consequently, eval "__PACKAGE__" would end up returning the
wrong package name under threads if the current package had been
assigned over.
This commit changes the way cops store their stash under threads. Now
it is an offset (cop->cop_stashoff) into the new PL_stashpad array
(just a mallocked block), which holds pointers to all stashes that
have code compiled in them.
I didn’t use the lexical pads, because CopSTASH(cop) won’t work unless
PL_curpad is holding the right pad. And things start to get very
hairy in pp_caller, since the correct pad isn’t anywhere easily
accessible on the context stack (oldcomppad actually referring to the
current comppad). The approach I’ve followed uses far less code, too.
In addition to fixing the bug, this also saves memory. Instead of
allocating a separate PV for every single statement (to hold the stash
name), now all lines of code in a package can share the same stashpad
slot. So, on a 32-bit OS X, that’s 16 bytes less memory per COP for
short package names. Since stashoff is the same size as stashpv,
there is no difference there. Each package now needs just 4 bytes in
the stashpad for storing a pointer.
For speed’s sake PL_stashpadix stores the index of the last-used
stashpad offset. So only when switching packages is there a linear
search through the stashpad.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| | |
When --libpods was removed, this broke backward compatiblility with
existing uses. This change adds back the option, but warns that
--libpods is no longer supported.
|
| |
| |
| |
| | |
actually write the files out using utf-8. This is a fix for RT #111446.
|
| | |
|
| |
| |
| |
| |
| |
| | |
We are repeating standard prototypes but we haven't been making
them compatible with the standard versions when compiling under
C++. Now we do.
|
| |
| |
| |
| |
| |
| |
| | |
Whether we really need to be rolling our own prototypes for malloc
and free in this day and age is unclear, but since we do, we need
to keep them in the unmangled C namespace rather than in C++'s
std:: namespace.
|
| |
| |
| |
| | |
C++ doesn't speak K & R.
|
| |
| |
| |
| |
| | |
This updates the editor hints in our files for Emacs and vim to request
that tabs be inserted as spaces.
|
| |
| |
| |
| | |
C++ needs an explicit type on the handler.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The core is not using it any more. Every CPAN module that increments
it also does newXS, which triggers mro_method_changed_in, which is
sufficient; so nothing will break.
So, to keep those modules compiling, PL_amagic_generation is now an
alias to PL_na outside the core.
|
| |
| |
| |
| |
| | |
6379d4a9a (between 5.15.9 and 5.16.0) broke B::COP::stashflags which was added
in 5.15.4.
|
| |
| |
| |
| |
| |
| | |
The previous commit modified Pod::Functions by modifying perlfunc.pod,
but we have things set up in such a way that cmp_version.t won’t
see it.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
How ironic! Overloading is called ‘A’ magic internally all over the
place, because of the letter used as its magic type. But now it does
not even use that magic.
I left a comment in mg_vtable.pl, so that future maintainers will have
some clue as to what AMAGIC means.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that mro_method_changed_in (triggered by the
‘*{$package . "::()"} = \&nil;’ assignment) causes overloadedness to
be checked the next time a overloaded operation occurs, it is not nec-
essary to trigger %OVERLOAD’s magic explicitly.
This also means that PL_amagic_generation is not incremented any more.
Unfortunately, we cannot eliminate it, as there are XS modules that
expect to increment it themselves to mark their caches as stale.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
include debugging by Father C++.
Make lock_hash_recurse() unlock_hash_recurse() exportable; include them in
SYNOPSIS; write tests for them.
Revise 'carp test' test. In general, tests of error messages should be written
with like() rather than is(). Why? Because we rarely want to test for the
complete error message if that requires us to exactly calculate strings such
as the line number at which an error occurred.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make @EXPORT_OK, synopsis, and list of functions tested with
can_ok() consistent with one another. Rationalize the way
functions are grouped within @EXPORT_OK and the other locations.
Add tests for hash_locked(), hashref_locked(), hash_unlocked() and
hashref_unlocked(). Add descriptions for several unit tests which
lacked them.
For RT #112126.
|
| |
| |
| |
| |
| | |
Otherwise cv_set_call_checker has no effect inside an attribute han-
dler for a closure.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Magic attached to hash elements has its key stored differently depend-
ing on how it was supplied to hv_common. hv_store passes a string/
length pair to hv_common, while hv_store_ent passes an SV.
magic_clearhint wasn’t able to handle string/length pairs, and only
worked with SVs, resulting in assertion failures or crashes.
This commit fixes magic_clearhint, so that XS code can use hv_store on
hint hashes.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I think the best we can do with respect to the f?pathconf tests is to
make sure that the perl call doesn't die, and that the system call
doesn't fail. And it's arguable we should only be testing the former.
But since we've been testing more that this anyway, it's probably safe
to test both.
With respect to the sysconf call, I think we shouldn't test more than
that perl doesn't die. Any further testing would require different
tests based the argument being passed in. Before doing that, it's
probably worth considering the purpose of the tests. I don't think we
really want to test that POSIX has been implemented correctly, only that
our layer over it is correctly implemented.
This fixes RT #112866.
|
| |
| |
| |
| |
| | |
Lesson learnt: After switching from threaded to unthreaded and fixing
the test, switch back again and re-run the test. :-)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
PerlIO::scalar’s dup function (PerlIOScalar_dup) calls the base imple-
mentation (PerlIOBase_dup), which pushes the scalar layer on to the
new file handle.
When the scalar layer is pushed, if the mode is ">" then
PerlIOScalar_pushed sets the scalar to the empty string. If it is
already a string, it does this simply by setting SvCUR to 0, without
touching the string buffer.
The upshot of this is that newly-cloned in-memory handles turn into
the empty string, as in this example:
use threads;
my $str = '';
open my $fh, ">", \$str;
$str = 'a';
async {
warn $str; # something's wrong
}->join;
This has probably always been this way.
The test suite for MSCHWERN/Test-Simple-1.005000_005.tar.gz does some-
thing similar to this:
use threads;
my $str = '';
open my $fh, ">", \$str;
print $fh "a";
async {
print $fh "b";
warn $str; # "ab" expected, but 5.15.7-9 gives "\0b"
}->join;
What was happening before commit b6597275 was that two bugs were can-
celling each other out: $str would be "" when the new thread started,
but with a string buffer containing "a" beyond the end of the string
and $fh remembering 1 as its position. The bug fixed by b6597275 was
that writing past the end of a string through a filehandle was leaving
junk (whatever was in memory already) in the intervening space between
the old end of string and the beginning of what was being written to
the string. This allowed "" to turn magically into "ab" when "b" was
written one character past the end of the string. Commit b6597275
started zeroing out the intervening space in that case, causing the
cloning bug to rear its head.
This commit solves the problem by hiding the scalar temporarily
in PerlIOScalar_dup so that PerlIOScalar_pushed won’t be able to
modify it.
Should PerlIOScalar_pushed stop clobbering the string and should
PerlIOScalar_open do it instead? Perhaps. But that would be a bigger
change, and we are supposed to be in code freeze right now.
|
| | |
|
|/
|
|
|
|
| |
When --libpods was removed, this broke backward compatiblility with
existing uses. This change adds back the option, but warns that
--libpods is no longer supported.
|
|
|
|
|
|
|
|
|
|
|
| |
All code points whose UTF-8 representations start with a byte containing
either \xFE or \xFF are considered problematic because they are not
portable. There are many such code points that are too large to
represent on a 32 or even a 64 bit platform. Commit
eb83ed87110e41de6a4cd4463f75df60798a9243 failed to properly catch
overflow when the input flags to this function say to warn on, but
otherwise accept FE and FF sequences. Now overflow is checked for
unconditionally.
|
|
|
|
| |
...otherwise all our verbatim blocks will change radically!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The prior version had a number of issues, some of which have been taken
care of in previous commits.
The goal when presented with malformed input is to consume as few bytes
as possible, so as to position the input for the next try to the first
possible byte that could be the beginning of a character. We don't want
to consume too few bytes, so that the next call has us thinking that
what is the middle of a character is really the beginning; nor do we
want to consume too many, so as to skip valid input characters. (This
is forbidden by the Unicode standard because of security
considerations.) The previous code could do both of these under various
circumstances.
In some cases it took as a given that the first byte in a character is
correct, and skipped looking at the rest of the bytes in the sequence.
This is wrong when just that first byte is garbled. We have to look at
all bytes in the expected sequence to make sure it hasn't been
prematurely terminated from what we were led to expect by that first
byte.
Likewise when we get an overflow: we have to keep looking at each byte
in the sequence. It may be that the initial byte was garbled, so that
it appeared that there was going to be overflow, but in reality, the
input was supposed to be a shorter sequence that doesn't overflow. We
want to have an error on that shorter sequence, and advance the pointer
to just beyond it, which is the first position where a valid character
could start.
This fixes a long-standing TODO from an externally supplied utf8 decode
test suite.
And, the old algorithm for finding overflow failed to detect it on some
inputs. This was spotted by Hugo van der Sanden, who suggested the new
algorithm that this commit uses, and which should work in all instances.
For example, on a 32-bit machine, any string beginning with "\xFE" and
having the next byte be either "\x86" or \x87 overflows, but this was
missed by the old algorithm.
Another bug was that the code was careless about what happens when a
malformation occurs that the input flags allow. For example, a sequence
should not start with a continuation byte. If that malformation is
allowed, the code pretended it is a start byte and extracts the "length"
of the sequence from it. But pretending it is a start byte is not the
same thing as it actually being a start byte, and so there is no
extractable length in it, so the number that this code thought was
"length" was bogus.
Yet another bug fixed is that if only the warning subcategories of the
utf8 category were turned on, and not the entire utf8 category itself,
warnings were not raised that should have been.
And yet another change is that given malformed input with warnings
turned off, this function used to return whatever it had computed so
far, which is incomplete or erroneous garbage. This commit changes to
return the REPLACEMENT CHARACTER instead.
Thanks to Hugo van der Sanden for reviewing and finding problems with an
earlier version of these commits
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pod::Html::pod2html via the installhtml utility, which is invoked
by the install.html make target, had not been explicitly setting
permissions on the installed HTML files. Leaving the target
permissions to chance meant that on some systems they were set
appropriately and some not based on various site and platform
defaults.
"Appropriately" in this case means readable by world/other, so we
now set that explicitly.
|
|
|
|
|
|
| |
This qualifies as another of the "crude hack to keep Pod-Html
more usable" hacks that are in place until the path handling
is fixed more systematically.
|
|
|
|
|
|
|
|
|
|
|
| |
Okay, look, this is kind of stupid and horrible, but it should
stop smoke failures and actually address some forms of failed path
comparisons in Pod::Html. In reality, we should be doing better path
comparisons than checking substr and eq, but that's not going to get
properly overhauled at this late date.
In the meantime, this should fix Win32 smokers with forcibly lc()-ed
cwds without breaking anybodye else, right? Right!
|