| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Perl 5.10.0 introduced stacked filetest operators,
-x -r $foo
being equivalent to
-r $foo && -x _
That does not work with -l. It was these suspicious lines in
Perl_my_lstat_flags that drew my attention to it:
> else if (PL_laststype != OP_LSTAT
> && (PL_op->op_private & OPpFT_STACKED) && ckWARN(WARN_IO))
> Perl_croak(aTHX_ no_prev_lstat);
That croak only happens when warnings are on. Warnings are just
supposed to be warnings, unless the ‘user’ explicitly requests
fatal warnings.
$ perl -le 'print "foo", -l -e "miniperl"'
foo
$ perl -lwe 'print "foo", -l -e "miniperl"'
The stat preceding -l _ wasn't an lstat at -e line 1.
That it doesn’t die in the first example is a bug.
In fact, it’s using the return value of -e as a file name:
$ ln -s miniperl 1
$ ./miniperl -le 'print -l -e "miniperl"'
1
And, with warnings on, if the preceding stat *was* an lstat, it
falls back to the pre-stacked behaviour, just as it does when warn-
ings are off.
It’s meant to be equivalent to -e "miniperl" && -l _ (which is why the
error message above says ‘The stat preceding -l _’).
|
|
|
|
|
|
|
|
|
| |
097ee67dff1c60f2 didn't need to include <locale.h> in locale.c (then
util.c) because it had been included by perl.h since 5.002 beta 1
3f270f98f9305540 missed removing the include of <unistd.h> from perl.c
or perlio.c
de8ca8af19546d49 changed perl.h to also include <sys/wait.h>, but didn't
notice that it code therefore be removed from perl.c, pp_sys.c and util.c
|
|
|
|
| |
to let porting/diag.t know how it’s listed in perldiag.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
They were ignoring get-magic for those.
A side effect of this fix is that lstat filehandle warnings and errors
are now consistent:
lstat _ used to die if the previous stat was not an lstat, but
lstat *_ and lstat \*_ would happily return what was in the buffer.
Now they die.
lstat FH and \*FH used to warn, but not lstat *FH. Now it does.
See bug #98864.
|
|
|
|
| |
It was ignoring get-magic for those.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a regression in 5.14.0.
Commit 6f1401dc made ops call get-magic before overloading, but it
ended up making filetest ops call get-magic on the topmost item of the
stack even if the filetest op was not going to use the stack (which
happens for ‘-r bareword’ and plain ‘-r’).
This would affect cases like:
push @foo, $tied, -r;
|
|
|
|
|
|
| |
This patch uses the recently-added MAYBE_DEREF_GV macro which puts the
glob deref logic in one spot. It also adds _nomg and _flags varia-
tions of it. _flags understands the SV_GMAGIC flag.
|
|
|
|
|
|
|
|
| |
Following on from commit 935647290357b277, which corrected the beha-
viour for tied globs, this commit corrects the behaviour for refer-
ences to tied globs.
(With tests by Nicholas Clark.)
|
|
|
|
|
|
| |
It was added to the if() condition as part of 935647290357b277.
Unfortunately the syntax used to implemented SvGETMAGIC(sv) is considered by
gcc to be valid in an expression, but is not valid in other compilers.
|
|
|
|
|
|
|
|
| |
When the chdir(*handle) feature was added in 5.8.8, the fact that
globs and refs could be magical was not taken into account.
They can easily be magical if a typeglob or reference is returned from
or assigned to a tied variable.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::umask to be called through references and
via ampersand syntax. pp_umask is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell umask how many arguments it’s
actually getting. See commit 0163043a for details.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::tell to be called through references and
via ampersand syntax. pp_tell is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell pp_tell how many arguments it’s
actually getting. See commit 0163043a for details.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::setpgrp to be called through references and
via ampersand syntax. pp_setpgrp is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell setpgrp how many arguments it’s
actually getting. See commit 0163043a for details.
|
|
|
|
|
| |
Prior to this commit, setpgrp(27) was equivalent to (27, setpgrp),
because it ignored the argument on the stack when there was only one.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::sysopen to be called through references and
via ampersand syntax. pp_sysopen is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell sysopen how many arguments it’s
actually getting. See commit 0163043a for details.
|
|
|
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::sleep to be called through references and
via ampersand syntax. pp_sleep is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell sleep how many arguments it’s
actually getting. See commit 0163043a for details.
Unfortunately, sleep with no args is nearly impossible to test porta-
bly. But I have checked that it works.
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::mkdir to be called through references and
via ampersand syntax. pp_mkdir is modified to take into account the
nulls pushed on to the stack in pp_coreargs, which happens because
pp_coreargs has no other way to tell mkdir how many arguments it’s
actually getting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit allows &CORE::gmtime and &CORE::localtime to be called
through references and via ampersand syntax. pp_gmtime is modified
to take into account the nulls pushed on to the stack in pp_coreargs,
which happens because pp_coreargs has no other way to tell pp_gmtime
how many arguments it’s actually getting.
I was going to say ‘see commit f6a1686942 for more details’, but found
out, to my horror, that most of the commit message was cut off. I
don’t know which commit-munging part of git is responsible, but I’ve
had similar problems with git am and git commit --amend. But, then,
this could have been sloppy copy and paste. Anyway, here is the
missing part:
Usually, an op that has optional arguments has the number of arguments
indicated with flags on the op itself:
$ ./perl -Ilib -MO=Concise -e 'binmode 1'
6 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
5 <@> binmode vK/1 ->6
- <0> ex-pushmark s ->3
4 <1> rv2gv sK*/1 ->5
3 <$> gv(*1) s ->4
-e syntax OK
$ ./perl -Ilib -MO=Concise -e 'binmode 1,2'
7 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
6 <@> binmode vK/2 ->7
- <0> ex-pushmark s ->3
4 <1> rv2gv sK*/1 ->5
3 <$> gv(*1) s ->4
5 <$> const(IV 2) s ->6
-e syntax OK
Notice the /1 vs /2 on the binmode op.
With a CORE sub, we have a single op for both cases. So, what this
commit does is set the number of arguments to the maximum, push nulls
on to the stack in pp_coreargs (actually, it was already set up to
do it, so there is no change there), and have the pp_ functions for
each op that has optional arguments do a null check after popping
the stack.
pp_binmode already does a null check, but other pp_ functions will
need to be modified. Since each one is different, those will come in
separate commits.
This is what &CORE::binmode’s op tree looks like:
$ ./perl -Ilib -MO=Concise,CORE::binmode -e 'BEGIN{\&CORE::binmode}'
CORE::binmode:
3 <1> leavesub[1 ref] K/REFC,1 ->(end)
2 <@> binmode sK/2 ->3
- <0> ex-pushmark s ->1
1 <$> coreargs(IV 212) s ->2
-e syntax OK
|
|
|
|
|
|
|
| |
This commit allows &CORE::getpgrp to be called through references and
via ampersand syntax. pp_getpgrp is modified to take into account the
nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no
other way to tell getpgrp how many arguments it’s actually getting.
|
|
|
|
|
|
|
| |
This commit allows the subs in the CORE package for close, getc and
readline to be called through references and via ampersand syntax. The
pp functions are modified to take into account the nulls that coreargs
pushes on to the stack to indicate that there is no argument.
|
|
|
|
| |
This matches the checks done for other stat() fields.
|
| |
|
|
|
|
| |
Preparation for the codegeneration changes where the next op isn't accessible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tied handle method calls, unlike other types of tie, don't push a new
stack. This means that a goto within a method to an outer scope
"succeeds", and pops back the context stack past the method call. When
control (at the C level) eventually passes back to the return from
call_method(), we've lost all our relevant stack contents (like all the
ENTERs), and corruption ensures.
The fix is to add PUSHSTACKi/POPSTACK.
The side effect of this is that attempts to goto out of a tied handle
method call now give "Can't find label" errors, like non-handle methods
already do.
|
|
|
|
| |
This reverts commit 84b9ac853508aaff52254b6cf2b95a2a6783ff00.
|
|
|
|
| |
This reverts commit 7850f4d6b732ab5f426cd3bcd9757c70a46cfda1.
|
|
|
|
| |
This reverts commit b029825916bf29623e00b45fa4226fab0d52d217.
|
|
|
|
|
| |
This reverts commit 7c7df8124bbdd7a0091f8ed82589548c8182f624,
except for the perldiag entry, which we still need for splain’s sake.
|
|
|
|
|
|
|
|
|
|
|
| |
instead of caching it
The intent is that by not caching $$, we eliminate one opportunity for bugs:
If one embeds Perl or uses XS and calls fork(3) from C, Perls notion of $$
may go out of sync with what getpid() returns. By always fetching the
value of $$ via getpid(), this bug opportunity is eliminated. The overhead
of always fetching $$ should be small and is likely only used for tempfile
creation, which should be dwarfed by file system accesses.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
commit 20ee07fbbcfa6be9f90bb8e5474a4d69d7396617
introduced dieing in (s)printf when the format is tainted;
however it only worked when the format is part of an expression
(because TAINT_PROPER checks for PL_tainted being set).
Fix by doing TAINT_PROPER only after get magic has been done on the format
SV (which will set PL_tainted). This is done by moving the checks in
pp_sprintf and pp_prtf into do_sprintf() (which is called by the two pp
functions).
|
|
|
|
|
| |
This commit makes pp_warn stringify the warning if there is no
$SIG{__WARN__} handler. See the RT ticket for the discussion.
|
|
|
|
|
|
|
|
|
| |
Previously, if all of gethost{byaddr,byname,ent} were unimplemented on a
platform, they would all return 'Unsupported socket function "gethostent"
called', with the analogous results for getnet{byaddr,byname,ent},
getproto{byname,bynumber,ent} and getserv{byname,byport,ent}. This bug was
introduced by change af51a00e97d5c559 - prior to this, all 12 functions would
report their own name when unimplemented.
|
|
|
|
|
| |
Unlike set{host,net,proto,serv}ent, set{gr,pw}ent don't have stayopen
parameter, hence their "signature" is the same as the ent*ent functions.
|
| |
|
|
|
|
|
|
|
| |
PL_op_desc[] rather than PL_op_name(), as the OPs are internally named e*ent,
but implement the ent*ent functions, and when unimplemented report themselves
using the function name. No need for OP_DESC(), as the switch statement means
that we can't encounter OP_CUSTOM.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of having each socket op conditionally compile as either the
implementation or a DIE() depending on #HAS_SOCKET
1: remove the conditional code from the ops themselves
2: only compile the ops if HAS_SOCKET is defined
3: general conditional code for the intialisation of PL_ppaddr - as appropriate
either the ops, or Perl_unimplemented_op
4: Amend Perl_unimplemented_op to generate the appropriate DIE() for socket
ops (ie not the "panic"... message)
Whilst this complicates the support code in regen/opcode.pl, it's already a
net saving of 5 lines in the C code.
|
|
|
|
|
| |
Previously syswrite was an alias for send. However, syswrite is always
available, whereas send is not implemented if HAS_SOCKET is not defined.
|
|
|
|
|
|
|
|
|
|
|
| |
Eliminate the #define pp_foo Perl_pp_foo(pTHX) macros, and update the 13
locations that relied on them.
regen/opcode.pl now generates prototypes for the PP functions directly, into
pp_proto.h. It no longer writes pp.sym, and regen/embed.pl no longer reads
this, removing the only ordering dependency in the regen scripts. opcode.pl
is now responsible for prototypes for pp_* functions. (embed.pl remains
responsible for ck_* functions, reading from regen/opcodes)
|
|
|
|
|
|
| |
On this platform, this doesn't change the size of the object code, suggesting
that there are all transformations that the optimiser had already spotted.
However, the code is now clearer for humans.
|
| |
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81904]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 >
Signed-off-by: Abigail <abigail@abigail.be>
|
|
|
|
|
| |
Add a flag TIED_METHOD_SAY to Perl_tied_method(), to allow tied PRINT to
effect C<local $\ = "\n";> within the ENTER/LEAVE pair of Perl_tied_method().
|
|
|
|
| |
It can be used for (at least) the call to "SPLICE" from pp_splice.
|
|
|
|
|
| |
This makes it clear that it's not a direct aTHX_ wrapper for
S_tied_handle_method().
|
| |
|
|
|
|
|
| |
Previously they were combined into one numeric value, using a bitshift. This
was a false economy.
|
| |
|
| |
|
| |
|