| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
This reverts commit 8752206e276cffe588c0932b5a9f2331640e8447.
|
|
|
|
| |
This reverts commit 9aa8b00892d81bb5e94565d3cb9841dd57b7b9cf.
|
|
|
|
| |
This reverts commit 830748013f81bcc28d145baf4024efd1b6537704.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recv() system call, with the MSG_TRUNC flag, returns the
true size of the packet, even if it is larger than the supplied buffer.
Since perl's equivalent recv() function doesn't return the size
(apart from what's implied as the returned length of the buffer), there
doesn't seem to to be any way to return this value to the caller. So
silently ignore it.
Before, we were setting SvCUR to the size, even if it was larger than
the buffer. Which was Bad.
|
|
|
|
|
| |
This allows untie($scalar) to untie the scalar if the last assigned or
returned happened to be a typeglob.
|
|
|
|
|
| |
Make tie() distinguish between $scalar and *$scalar when $scalar holds
a glob copy, by checking the FAKE flag.
|
|
|
|
|
|
|
|
| |
Make pp_tied use the SvFAKE flag to distinguish between tied scalars
and tied handles. This is now possible as of change 2acc3314.
This fixes the problem of tied($scalar) ignoring the tie if the last
thing returned or assigned happened to be a glob.
|
|
|
|
|
|
|
|
| |
Dying and returning from a format both relied on the state of a
just-popped context frame being preserved across a LEAVE. Don't rely
on it. Test using an operator ripped off from Scope::Cleanup, which makes
it easy to run arbitrary Perl code during cleanup, without isolating it
on a separate context stack as the DESTROY mechanism does.
|
|
|
|
|
| |
It was using PUSHp() here, meaning local object code for a call to strlen(),
and for SvSETMAGIC().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This test from t/op/gv.t was added by change 22315/4ce457a6:
{
# test the assignment of a GLOB to an LVALUE
my $e = '';
local $SIG{__DIE__} = sub { $e = $_[0] };
my $v;
sub f { $_[0] = 0; $_[0] = "a"; $_[0] = *DATA }
f($v);
is ($v, '*main::DATA');
my $x = <$v>;
is ($x, "perl\n");
}
That change was the one that made glob-to-lvalue assignment work to
begin with. But this test passes in perl version *prior* to that
change.
This patch fixes the test and adds tests to make sure what is assigned
is actually a glob, and not just a string.
It also happens to fix the stringification bug. In doing so, it essen-
tially ‘enables’ globs-as-PVLVs.
It turns out that many different parts of the perl source don’t fully
take this into account, so this patch also fixes the following to work
with them (I tried to make these into separate patches, but they are
so intertwined it just got too complicated):
• GvIO(gv) to make readline and other I/O ops work.
• Autovivification of glob slots.
• tie *$pvlv
• *$pvlv = undef, *$pvlv = $number, *$pvlv = $ref
• Duplicating a filehandle accessed through a PVLV glob when the
stringified form of the glob cannot be used to access the file
handle (!)
• Using a PVLV glob as a subroutine reference
• Coderef assignment when the glob is no longer in the symbol table
• open with a PVLV glob for the filehandle
• -t and -T
• Unopened file handle warnings
|
|
|
|
| |
This reduces code duplication slightly, and reduces the object code size.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Commit c410dd6ad7 indiscriminately pops elements from the stack
even when nothing has been pushed: file tests without arguments
(testing $_) and stacked filetests don't have anything on the
stack that needs to be removed.
The general idea is that we need to have the same side effects
as if we had called my_stat_flags(), so we shall only call POPs
under the same conditions as the code in my_stat_flags().
|
|
|
|
|
|
|
|
| |
unsupported filetests.
This time with an appropriate comment on the test. And with that I'll
attempt to stop spamming P5P, at least for today, and go and do
something less risky. Running with scissors perhaps.
|
|
|
|
| |
Signed-off-by: David Golden <dagolden@cpan.org>
|
|
|
|
|
| |
some of the filetest operators could call mg_get and/or overload fallback
stringify multiple times
|
|
|
|
|
|
|
| |
my_stat() and my_lstat() call get magic on the stack arg, so create _flags()
variants that allow us to control this. (I can't just change the signature
or the mg_get() behaviour since my_[l]stat() are listed as being in the
public API, even though they're undocumented.)
|
|
|
|
|
| |
This reduces object code size, reducing CPU cache pressure on the non-exception
paths.
|
|
|
|
|
|
|
|
|
| |
Much simplification ensues - witness the diffstat.
Changes Perl_die_unwind() to use Perl_croak() rather than DIE().
Reverses an unwise part of bb4c52e023e0fcad.
Reverts 9e95c6350a60744d and 805bf316c58ab2d7.
|
|
|
|
| |
Plus a test that would fail if it did.
|
|
|
|
|
|
| |
This generates slightly smaller object code overall, which means that the "hot"
code (the non-overloaded paths through the ops) will be smaller, and hence more
likely to stay in the CPU cache.
|
|
|
|
|
| |
Convert the gimme argument to a flags argument, and add a flag bit to signal
that mortalization is not required. Only "BINMODE" needs this.
|
|
|
|
| |
This allows "GETC" to use it.
|
|
|
|
| |
This enables "BINMODE", "EOF" and "SYSSEEK" to use it.
|
| |
|
|
|
|
|
| |
Previously the code was using XPUSH* in many cases, often to push back values
recently popped off the stack.
|
|
|
|
|
|
|
| |
If we've just POP*ed something from the stack, it will already have space.
If we conditionally POP* something from the stack, avoid the EXTEND() in that
path. Also, use PUSH() rather than XPUSH() where we know that the stack is large
enough. Changes to pp_close, pp_binmode, pp_enterwrite, pp_readlink and pp_alarm.
|
|
|
|
|
| |
Commit 32e653230c7ccc7f added this second argument, but didn't verify that the
stack always had sufficient space for it.
|
|
|
|
|
|
| |
Analogous to pp_getc and pp_tell in ac3697cd90b00fae, pp_eof has a conditional
POP from the stack, but an unconditional PUSH to the stack, but no check that
the stack had space for the PUSH. This bug has been present since perl 5.000.
|
|
|
|
|
|
| |
Both conditionally POP a GV from the stack, but always PUSH a return value to
it. For the case where they did not POP the GV, they made no check that the
stack had space for the PUSH. This bug has been present since perl 5.000.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In most places, ops checked their args for overload *before* doing
mg_get(). This meant that, among other issues, tied vars that
returned overloaded objects wouldn't trigger calling the
overloaded method. (Actually, for tied and arrays and hashes, it
still often would since mg_get gets called beforehand in rvalue
context).
This patch does the following:
Makes sure get magic is called first.
Moves most of the overload code formerly included by macros at the
start of each pp function into the separate helper functions
Perl_try_amagic_bin, Perl_try_amagic_un, S_try_amagic_ftest,
with 3 new wrapper macros:
tryAMAGICbin_MG, tryAMAGICun_MG, tryAMAGICftest_MG.
This made the code 3800 bytes smaller.
Makes sure that FETCH is not called multiple times. Much of this
bit was helped by some earlier work from Father Chrysostomos.
Added new functions and macros sv_inc_nomg(), sv_dec_nomg(),
dPOPnv_nomg, dPOPXiirl_ul_nomg, dPOPTOPnnrl_nomg, dPOPTOPiirl_ul_nomg
dPOPTOPiirl_nomg, SvIV_please_nomg, SvNV_nomg (again, some of
these were based on Father Chrysostomos's work).
Fixed the list version of the repeat operator (x): it now only
calls overloaded methods for the scalar version:
(1,2,$overloaded) x 10
no longer erroneously calls
x_method($overloaded,10))
The only thing I haven't checked/fixed yet is overloading the
iterator operator, <>.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Nasty code like the following results in PL_defoutgv not pointing
to a valid GV:
my $x = *STDERR; select($x); $x = 1;
This causes all sorts of SEGVs when PL_defoutgv is subsequently accessed,
because most code assumes that it has a valid gv_gp pointer. It also
turns out that PL_defoutgv is under-tested; for example, temporarily
hacking pp_close to make an arg-less close() croak didn't cause any
minitest failures.
Add a new test file that does some basic testing of a bad PL_defoutgv,
and fix all the obvious badness in accessing it.
This also fixes #20727, which although ostensibly a tie bug, was due to
PL_defoutgv pointing to a tiedelem scalar, and fun like that described
above happening.
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise gmtime(2**66) will cause a very, very, very long loop and
DOS Perl.
Add a test that very, very large times don't send gmtime and localtime into a loop
Had to fix some revealed mistakes in op/time.t when warnings were turned on.
Fix Time::gmtime and Time::localtime tests to match the new limits of gm/localtime.
|
|
|
|
|
|
|
|
|
|
|
| |
pp_sys.c: In function `Perl_pp_tie':
pp_sys.c:788: warning: 'gv' might be used uninitialized in this function
pp_sys.c: In function `Perl_pp_dbmopen':
pp_sys.c:936: warning: 'gv' might be used uninitialized in this function
pp_sys.c: In function `Perl_pp_enterwrite':
pp_sys.c:1274: warning: 'cv' might be used uninitialized in this function
pp_sys.c: In function `Perl_pp_ghostent':
pp_sys.c:4711: warning: 'hent' might be used uninitialized in this function
|
|
|
|
|
|
|
| |
POSIX requires fcntl() to return EAGAIN or EACCES, whereas BSD
requires flock() to return EWOULDBLOCK. On most systems EAGAIN
and EWOULDBLOCK use the same number, but on some (e.g. Linux on
PA-RISC) they do not.
|
|
|
|
| |
ENTER/LEAVE when debugging is enabled
|
| |
|
|
|
|
| |
warnings (the "return NORMAL"s are never reached).
|
| |
|
|
|
|
|
|
| |
You are not really outside of the string then, but the effect will
always be a noop since the number of bytes written will be capped
to not exceed the length of the string as for other offsets.
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
(fixes a bug introduced by previous patch)
|
|
|
|
|
|
|
| |
file was read
This makes tell() return -1, and sets errno to EBADF, thus
restoring the 5.8.x behaviour
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
(MacOS support was removed from MakeMaker in 6.22, and merged to blead on
15th December 2004 with 5dca256ec738057dc331fb644a93eca44ad5fa14. After this
point MacOS wouldn't even have been able to build the perl binary, because it
would not have been able to build DynaLoader. If anyone wishes to resurrect
MacOS, start by reversing this commit and the relevant part of that commit.)
|