| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
| |
This was broken in 64def2aeaeb63f92dadc6dfa334, and fixed for Win32
only in 8fe3452cc6ac7af8c08. But VMS also uses a numeric first
argument to system() as a flag indicating spawn without waiting for
completion.
|
|
|
|
|
|
| |
Move handling of close-on-exec flag for PerlIO handles into PerlIO itself.
Where PerlIO opens new file descriptors, have them opened in O_CLOEXEC
mode where possible.
|
|
|
|
|
|
|
| |
In many places where a file descriptor is being opened, open it with
FD_CLOEXEC already set if possible. This commit covers the easy cases,
where the file descriptor arises without the use of PerlIO, pp_open,
or my_popen.
|
|
|
|
|
|
|
|
|
|
|
| |
On Windows there's a nasty variation in the meaning of arguments
to Perl's system(), in which a numeric first argument isn't used as
part of the command to run, but instead selects between two different
operations to perform with the command (whether to wait for the command
to complete or not). Therefore the reduction of argument scalars to
their operative values in the parent process, which was added in commit
64def2aeaeb63f92dadc6dfa33486c1d7b311963, needs to preserve numericness
of arguments on Windows. Fixes [perl #132633].
|
|
|
|
|
|
| |
New macros {GCC,CLANG}_DIAG_{IGNORE,RESTORE}_{DECL,STMT}, which take a
following semicolon. It is necessary to use the _DECL or _STMT version
as appropriate to the context. Fixes [perl #130726].
|
|
|
|
|
|
|
|
|
|
| |
A lot of things can happen when stringifying an argument list: side
effects, warnings, exceptions. In the case of system(), these effects
should happen in the context of the parent process. The stringification
can also depend on which process it happens in, as in the case of
$$, and in that case it should also happen in the parent process.
Therefore reduce the argument scalars to strings first thing in pp_system.
Fixes [perl #121105].
|
|
|
|
|
|
|
|
|
|
| |
Bits of exec code were putting the constructed commands into globals
PL_Argv and PL_Cmd, which could then be clobbered by reentrancy.
These are only global in order to manage their freeing, but that's
better managed by using the scope stack. So replace them with automatic
variables, with ENTER/SAVEFREEPV/LEAVE to free the memory. Also copy
the strings acquired from SVs, to avoid magic clobbering the buffers of
SVs already read. Fixes [perl #129888].
|
|
|
|
|
|
|
| |
When a filetest op returns false, it skips past following ops that
are stacked filetests. The code to do this was assuming that op_next
would always be non-null, which is not always the case, for example in
a sort comparator. Allow for it to be null. Fixes [perl #129347].
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commits 8843856e9716655549cce789b3338e1d4c72fffb,
3676f9e77d46b61f4785aad171f02bed29df0c07, and
793c2ded15ca832d1df1fabbc3b2e7562a057697.
As noted in the large comment above the relevant code, the probed
ST_INO_SIGN is not reliable enough for its purpose, because Configure
makes guesses. The actual compiler knows whether st_ino is signed,
and is perfectly capable of optimising out the negative-handling code
in the usual case that st_ino is unsigned, without any need for us to
preprocess it away.
|
|
|
|
|
|
| |
In platforms with st.ino always positive, never even see the negative code.
Coverity #169271.
|
|
|
|
| |
(Solaris cc got angry.)
|
|
|
|
|
| |
And therefore one may not be able to subtract the pointers,
for example in HP-UX.
|
|
|
|
| |
(Like HP-UX.)
|
|
|
|
|
|
|
| |
By using is_utf8_invariant_string_loc() instead of plain
is_utf8_invariant_string(), we can start parsing at the first variant
(if any is found) instead of the previous behavior of starting again at
the beginning of the string.
|
|
|
|
|
|
|
|
|
|
| |
The file test operators for Unix permission bits were returning a blanket
false result on systems where the bit being tested for doesn't exist.
That's a sensible way to treat a nonexistent bit when statting a file,
but the false result was being returned without checking that the argument
actually refers to a file. Remove the pre-stat checks for nonexistent
bits, so that we get the correct errors for non-files. We still get a
blanket false result for nonexistent bits on files.
|
|
|
|
|
|
|
| |
When a stat fails because it's on a closed or otherwise invalid
filehandle, $! was often not being set, depending on the operation
and the nature of the invalidity. Consistently set it to EBADF.
Fixes [perl #108288].
|
|
|
|
|
| |
The gcc warning was already suppressed, but clang needs a different
formulation.
|
|
|
|
|
|
|
|
|
| |
We previously used a lossy conversion of inode numbers to floating point,
where they're too big to fit the IV/UV format. That sucks; a rounded
inode number is nearly useless. Instead, fall back to returning a
string of decimal digits. That preserves the entire value, for code
that looks at it in the right way, and collapses to the former fallback
in other situations.
|
|
|
|
|
| |
This allows things to work properly in the face of embedded NULs.
See the branch merge message for more information.
|
|
|
|
|
| |
Check if the tied object has a stash set
before calling UNTIE method.
|
|
|
|
| |
Also lstat() and the file test ops.
|
| |
|
|
|
|
|
|
|
| |
add code comments to explain why these functions can sometimes be called
with a NULL pointer on the stack.
(feature introduced by v5.15.2-112-g30901a8)
|
|
|
|
|
|
| |
Where its obvious that the args can't be null, use SvTRUE_NN() instead.
Avoid possible multiple evaluations of the arg by assigning to a local var
first if necessary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In places that do things like mPUSHi(0) or newSViv(0), replace them
with PUSHs(&PL_sv_zero) and &PL_sv_zero, etc.
This avoids the cost of creating and/or mortalising an SV, and/or setting
its value to 0.
This commit causes a subtle change to tainting in various places as a
side-effect. For example, grep in scalar context retunrs 0 if it has no
args. Formerly the zero value could in theory get tainted:
@a = ();
$x = ( ($^X . ""), grep { 1 } @a);
It used to be the case that $x would be tainted; now its not.
In practice this doesn't matter - the zero value was only getting tainted
as a side-effect of tainting's "if anything in the statement uses a
tainted value, taint everything" mechanism, which gives (documented) false
positives. This commit merely removes some such false positives, and
makes the behaviour similar to functions which return &PL_sv_undef/no/yes,
which are also immune to side-effect tainting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pp_sselect (4-arg select) process its first three bitfield arguments
first, making sure each one has a valid PV, and then it moves on to
the final, timeout argument.
SvGETMAGIC() on the timeout argument will wipe out any values the SV
holds, so if the same scalar is used as a bitfield argument *and* as
the timeout, it will no longer hold a valid PV.
Assertions later in pp_sselect make sure there is a valid PV.
This commit solves the assertion failure by making a temporary copy of
any gmagical or overloaded argument. When the temporary copy is made,
the values written to the temporary copies of the bitfield arguments
are then copied back to the original magical arguments.
|
|
|
|
|
|
|
|
|
|
|
| |
When recv() detects an error, it returns undef: but it was failing to pop
its args off the stack first. So in list context it returned both its
original args and undef. It was also then not extending the stack to push
the undef.
After this commit it resets SP to the base of its args list first,
like the other ops already do which share the Perl_pp_systread() function
body.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When pushing &PL_sv_yes/no on the stack, make room for it.
Normally this isn't an issue as previous formlines() will have caused the
stack to be extended anyway; but for the null format:
format FOO =
.
this isn't the case.
|
|
|
|
| |
This has been deprecated since Perl 5.10
|
|
|
|
|
|
|
|
|
|
| |
Give Perl_nextargv its own statbuf and pass a pointer to it into
Perl_do_open_raw and thence S_openn_cleanup when needed.
Also reduce the scope of the existing statbuf in Perl_nextargv to make
it clear it's distinct from the one populated by do_open_raw.
Fix perldelta entry for PL_statbuf removal
|
|
|
|
|
|
| |
Some vars have been tagged as const because they do not change in their
new scopes. In pp_reverse in pp.c, I32 tmp is only used to hold a char,
so is changed to char.
|
|
|
|
| |
This was my fault; oops.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Perl 5.10 deprecated using the same symbol to open both a filehandle
and a dirhandle, as this can lead to confusing code.
In Pelr 5.28, this will become a fatal error. This patch changes the
warning to reflect this.
|
|
|
|
| |
Vertically align some components of an 'if' for readability.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
C++11 requires space between the end of a string literal and a macro, so
that a feature can unambiguously be added to the language. Starting in
g++ 6.2, the compiler emits a warning when there isn't a space
(presumably so that future versions can support C++11). Unfortunately
there are many such instances in the perl core. This commit fixes
those, including those in ext/, but individual commits will be used for
the other modules, those in dist/ and cpan/.
This commit also inserts space at the end of a macro before a string
literal, even though that is not deprecated, and removes useless ""
literals following a macro (instead of inserting a blank). The result
is easier to read, making the macro stand out, and be clearer as to the
intention.
Code and modules included with the Perl core need to be compilable using
C++. This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.) So we need to accommodate
changes to the C++ language.
|
|
|
|
|
| |
This brings the error messages in line with the ones used for normal
method calls, despite not using call_method().
|
|
|
|
| |
as they should be for deprecation warnings
|
|
|
|
|
| |
chdir with no argument didn't ensure there was stack space available
for its result.
|
| |
|
|
|
|
|
|
|
|
| |
This encodes a simple pattern that may not be immediately obvious to
someone needing it. If you have a fixed-size buffer that is full of
purportedly UTF-8 bytes, is it valid or not? It's easy to do, as shown
in this commit. The file test operators -T and -B can be simpified by
using this function.
|
|
|
|
|
|
|
|
| |
This new function can be used in the implementation of the file test
operators, -B and -T, to see if the whole fixed length buffer is valid
UTF-8. Previously if all bytes were UTF-8 except the bytes at the end
that could have been a partial character, it assumed the whole thing was
UTF-8. This improves the prediction slightly
|
|
|
|
|
|
| |
This changes the places in the core to use the clearer synonym added by
the previous commit. It also changes one place that hand-rolled its own
code to use this function instead.
|
|
|
|
|
|
|
| |
Specifically in the S_space_join_names_mortal static function that
several pp functions call. On some platforms (such as Gentoo Linux
with torsocks), hent->h_aliases (where hent is a struct hostent *) may
be null after a gethostent call.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The value of gimme stored in the context stack is U8.
Make all other uses in the main core consistent with this.
My primary motivation on this was that the new function cx_pushblock(),
which I gave a 'U8 gimme' parameter, was generating warnings where callers
were passing I32 gimme vars to it. Rather than play whack-a-mole, it
seemed simpler to just uniformly use U8 everywhere.
Porting/bench.pl shows a consistent reduction of about 2 instructions on
the loop and sub benchmarks, so this change isn't harming performance.
|
|
|
|
|
|
| |
Replace CX_PUSHFORMAT() with cx_pushformat() etc.
No functional changes.
|
|
|
|
|
|
| |
Replace CX_PUSHBLOCK() with cx_pushblock() etc.
No functional changes.
|
|
|
|
|
|
|
| |
Earlier all the POPFOO macros were renamed to CX_POPFOO to reflect
the changed API (like POPBLOCK no longer decremented cxstack_ix).
Now rename the PUSH ones for consistency.
|