| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| | |
Conflicts:
pp_ctl.c
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Makes the G_KEEPERR logic more consistent, and in particular make it
sensibly handle non-string exceptions. An exception in a destructor
is now always emitted as a warning, and never copied or merged into
$@ of the surrounding context. No more clobbering exceptions being
handled elsewhere, and no more double reporting. This fixes the rest of
[perl #74538].
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
New functions croak_sv(), die_sv(), mess_sv(), and warn_sv(), each act
much like their _sv-less counterparts, but take a single SV argument
instead of sprintf-like format and args. They will accept RVs, passing
them through as such. This means there's no more need to clobber ERRSV
in order to throw a structured exception.
pp_warn() and pp_die() are rewritten to use the _sv interfaces.
This fixes part of [perl #74538]. It also means that a structured
warning object will be passed through to $SIG{__WARN__} instead of
being stringified, thus bringing warn in line with die with respect to
structured exception objects.
The new functions and their existing counterparts are all fully
documented.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Put the exception into $@ last thing before longjmping to the op following
the eval block, where previously it went into $@ before unwinding the
stack. This change means that the exception is not liable to be lost
by $@ being clobbered by destructors, cleanup code, or restoration after
"local $@". The code running immediately after eval can now rely on $@
accurately indicating the exception status of the eval.
|
| |
| |
| |
| |
| |
| |
| |
| | |
It's fine to still refer to cx members between POPEVAL and LEAVE, but there
are a few places where the namesv is read after LEAVE happens. This is bad
because LEAVE can call arbitrary code ; in particular, it can call a destructor
that does call_sv(cv, G_EVAL), in which case the old eval context cx gets
overwritten by the new one and cx->blk_eval.old_namesv points to garbage.
|
|/
|
|
|
|
|
|
| |
When unwinding due to die, the new global PL_restartjmpenv points
to the JMP_ENV at which longjmping should stop and control should
be transferred to PL_restartop. This replaces the previous
use of cxstack[cxstack_ix+1].blk_eval.cur_top_env, located in a
nominally-discarded context frame.
|
|
|
|
|
|
| |
Fix location identified by Father Chrysostomos, who also offered a patch, but
this patch is more efficient, as it avoids any allocation. Test code based on
his test example.
|
|
|
|
|
|
|
|
|
| |
For the typical code this gives a 5% speedup, and removes the cost of "safe
signals". Tight looping code will show less gains, but should never be slower.
Subtle bugs might remain - there might be constructions that enter the runloop
(where signals used to be dispatched) but don't contain any PERL_ASYNC_CHECK()
calls themselves.
|
|
|
|
|
|
|
|
|
|
|
| |
Something like the following ended up corrupted:
sub FETCH { eval 'BEGIN{syntax err}' }
The croak on error popped back the context stack etc to the EVAL pushed by
entereval, but the corresponding JUMPENV_PUSH(3) unwound all the way to the
outer perl_run, losing all the mg_get() related parts of the C stack.
It turns out that the run-time parts of pp_entereval were protected with
a new JUMPENV level, but the compile-time parts weren't. Add this.
|
|
|
|
|
| |
In particular, distinguish between scope and context stack push/pops,
show depth of JUMPENV stack, and show STACKINFO push/pops
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the issue in the following:
use re 'taint';
$tainted =~ /(...)/;
# $1 now correctly tainted
$untainted =~ s/(...)/$1/;
# $untainted now incorrectly tainted
The problem stems from when $1 is updated.
pp_substcont, which is called after the replacement expression has been
evaluated, checks the returned expression for taintedness, and if so,
taints the variable being substituted. For a substitution like
s/(...)/x$1/ this works fine: the expression "x".$1 causes $1's get magic
to be called, which sets $1 based on the recent match, and is marked as
not tainted. Thus the returned expression is untainted. In the variant
s/(...)/$1/, the returned value on the stack is $1 itself, and its get
magic hasn't been called yet. So it still has the tainted flag from the
previous pattern.
The solution is to mg_get the returned expression *before* testing for
taintedness.
|
|
|
|
| |
Add a comment explaining the problems with this function.
|
|
|
|
| |
docatch - perl run-time exception handling
|
|
|
|
|
| |
[N.B. I converted package name separators from q{'} to q{::} in
the test files as suggested by demerphq. -- dagolden]
|
|
|
|
| |
Avoid using a sprintf format for a constant value (0).
|
|
|
|
|
|
|
|
|
|
| |
It's conflicting with an established pattern in XS code, working around the
inability of the XS SCOPE: keyword to actually provide anything useful.
The minor amount of extra debugging it gives here is not worth the external
trouble it causes.
Revisit this once we can provide a meaningful option to disable the
ENTER/LEAVE around XSUBs.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
matches
The match vars are associated with the regexp that last matched
successfully. In the case of $str =~ $qr or /$qr/, since the $qr could
be used in multiple scopes that need their own sets of match vars, the
$qr is cloned by Perl_reg_temp_copy as of change 30677/28d8d7f. This
happens in pp_regcomp before pp_match has stringified the LHS, hence the
bug. In short, /$gror/ is not equivalent to
($which = !$which) ? /$gror/ : /$gror/, which is weird.
Attached is a patch, which admittedly is a hack, but fixes this
particular side effect of what is probably a bad design, by stringifying
the LHS in pp_regcomp, and having pp_match skip get-magic in such cases.
A real fix far exceeds my capabalities, and would also be very intrusive
according to
<http://www.nntp.perl.org/group/perl.perl5.porters/2007/03/msg122415.html>.
|
|
|
|
|
| |
This will solve an obscure bug in smart-match involving nested data
structures containing the same elements.
|
|
|
|
| |
@_ can contain NULLs for undefined elements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I wrote:
>In my tests with -Dmad, I'm still getting a test failure ("panic: input
>overflow") from t/op/incfilter.t. The underlying problem is the filter
>layer mishandling things when a filter function gives it a multiline
>string, so it generates an invalid SV state (strlen(SvPVX(PL_linestr))
>> SvCUR(PL_linestr)). This faulty state also occurs without -Dmad,
>and so doesn't appear to be Mad-related, it just doesn't in practice
>cause the test panic without -Dmad. I'm investigating this bug now.
It's fixed by the attached patch. Since the bug is an inconsistency
in the SV data structure, it can't be sensibly tested from Perl code,
so I'm at a loss for writing a test script. Hopefully that panic with
-Dmad is sufficient.
-zefram
Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
|
| |
|
|
|
|
| |
become void context. Fixes problem with require not always being in scalar context.
|
|
|
|
|
|
|
| |
pp_ctl.c: In function `Perl_pp_return':
pp_ctl.c:2092: warning: 'retop' might be used uninitialized in this function
pp_ctl.c: In function `Perl_pp_last':
pp_ctl.c:2214: warning: 'nextop' might be used uninitialized in this function
|
|
|
|
| |
ENTER/LEAVE when debugging is enabled
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
If this is defined, it will be called instead of stringification
whenever an object is used as a regexp or interpolated into a regexp.
This will fall back to stringification even without C<fallback => 1>,
for compatibility.
An overloaded 'qr' must return either a REGEXP or a ref to a REGEXP
(such as created by qr//). Any further overloading on the return value
will be ignored.
|
| |
|
|
|
|
| |
This saves allocating an extra SV head and body.
|
|
|
|
|
|
|
|
| |
It uses reg_temp_copy to copy the REGEXP onto the destination SV without
needing to copy the underlying pattern structure. This means changing
the prototype of reg_temp_copy, so it can copy onto a passed-in SV, but
it isn't API (and probably shouldn't be exported) so I don't think this
is a problem.
|
|
|
|
|
| |
This solves bug "[perl #69927] wrong runaway error for write",
which is a link to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=77707
|
|
|
|
|
|
|
| |
Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code
size (about 0.2%), for 1 more function call if warnings are not enabled.
However, if we're now in the L1 or L2 cache when we weren't previously, that's
still going to be a speed win.
|
| |
|
|
|
|
|
|
|
| |
The code in pp_ctl.c after calling an @INC hook blindly assumes that the
SV setted by the user in %INC is an SVPV (SvPOK true) for setting the
filename. So when the user uses other scalar types, the output of
__FILE__, warn, die, caller, etc. shows random garbage.
|
|
|
|
| |
This fixes [perl #68590] : %^H not lexical enough.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
$_ is guaranteed to be lexical here, because the parser did an allocmy
when parsing the given() statement.
|
|
|
|
|
| |
We don't load strict.pm, we just manipulate the hint bits.
Plus more tests.
|
| |
|
|
|
|
|
|
| |
This makes ~~ commutative with regard to undef, and fixes an
inconsistency, since C<undef ~~ [0]> was not matching, and ~~
should be distributive in this case.
|
|
|
|
|
|
| |
This fixes bug #66942 : as a / was left in the directory name,
$INC{"Foo.pm"} for a file loaded from the current directory
was given the incorrect value "/Foo.pm".
|
| |
|
| |
|
|
|
|
| |
This way, we can handle tied hashes such as ones that have references as keys.
|
|
|
|
|
|
| |
Doesn't really make a difference as WIN32 is defined as '1' when
it is defined, but there is something to be said for consistent
usage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Both 'do' and 'require' treat paths *explicitly* relative to the
current directory (starting with './' or '../') as a special form of
absolute path. That means they can be loaded directly and don't need
to be resolved via @INC, so they don't rely on '.' being in @INC
(unless running in taint mode). This behavior is "documented" in the P5P
thread "Coderefs in @INC" from 2002.
The code is missing special treatment of backslashes on Windows
so that '.\\' and '..\\' are handled in the same manner.
This change fixes
http://rt.perl.org/rt3/Public/Bug/Display.html?id=63492
(Note that the references to taint mode in the bug report are only
relevant as far as taint mode removes '.' from @INC).
This change also fixes the following Scalar-List-Utils bug report:
http://rt.cpan.org/Public/Bug/Display.html?id=25430
The Scalar::Util test failure in t/p_tainted.t only manifests itself
under Test::Harness 3, and only outside the Perl core:
* Test::Harness 2 (erroneously) puts '-I.' on the commandline in taint
mode and runs something like this:
`perl -I. t/p_tainted.t`
so '.\t\tainted.t' can be found via '.' in @INC.
* Core Perl runs something like this from the t/ directory:
`..\perl.exe -I../lib ../ext/List-Util/t/p_tainted.t`
so '.\..\ext\List-Util\t\tained.t' can be found via '../lib' in @INC.
Signed-off-by: Jan Dubois <jand@activestate.com>
|
| |
|
| |
|