| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 00a5df846e035280750985222a693ac58022ee36 fixed some c undefined
behavior, but it will not compile with g++, because a goto crosses
initialization.
https://stackoverflow.com/questions/14274225/statement-goto-can-not-cross-variable-definition
and its links sort of explains why
This commit works around this limitation
|
|
|
|
| |
Spotted by clang-14.
|
|
|
|
|
| |
Most of these have been deprecated for a long time; and we've never
bothered to follow through in removing them. This commit does that.
|
|
|
|
|
|
|
|
|
|
| |
forbidden under taint""
This reverts commit 9eb153ffbbde62558146e8f9b837034f42878e13.
The patch this unreverts was accidentally pushed to blead without going
through PR or smoke process which it really needs. This patch exists so
it can go through that process.
|
|
|
|
|
|
|
|
|
|
| |
under taint"
This reverts commit 5ede4453c4877110eb5214ff400c173210b101b1.
I messed up and pushed it to blead not to the PR branch I meant to push
it. Thanks to xenu for noticing. This needs a smoke before it should be
applied.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having a relative path, including ".", is forbidden under taint. On *nix
an empty PATH or an empty PATH component is equivalent to a PATH of ".",
so they should be forbidden as well.
Note that on Windows the current working directory is ALWAYS checked
first if you try to execute something that does not specify its path,
regardless of the PATH.
I do not know what happens on VMS and I do not have access to a
VMS environment to test. There are totally different codepaths for
VMS as well. This patch does not (or rather should not) change
behavior for VMS.
Note this includes a version bump for all modules in dist/PathTools
|
|
|
|
|
| |
The path_sep is not going to change per iteration of the loop, so just
move it out of the loop.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's no efficient way to create a mortal SV of any type other than
SVt_NULL (via sv_newmortal). The options are either to do:
* SV* sv = sv_newmortal; sv_upgrade(sv, SVt_SOMETYPE);
but sv_upgrade is needlessly inefficient on new SVs.
* SV* sv = sv_2mortal(newSV_type(SVt_SOMETYPE)
but this will perform runtime checks to see if (sv) and if (SvIMMORTAL(sv),
and for a new SV we know that those answers will always be yes and no.
This commit adds a new inline function which is basically a mortalizing
wrapper around the now-inlined newSV_type.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Issue #19331: Use of SvPV_const and SvPV_force in S_set_dollarzero()
wrote the PV internals directly to argv, which causes an improper UTF-8
encode if the SV is UTF8-flagged/upgraded.
This fixes that doing a downgrade prior to those SvPV* calls. If the
string contains wide characters (and thus cannot be downgraded) a
warning is thrown; this mirrors preexisting behavior with %ENV, print,
and other output channels that convert Perl SVs to bytes.
The relevant documentation is also updated.
|
|
|
|
|
|
| |
DJGPP is a port of the GNU toolchain to 32-bit x86 systems running DOS.
The last known attempt to build Perl on it was on 5.20, which only got
as far as building miniperl.
|
|
|
|
| |
Bring it in line with the other "fault"-like signals SEGV, ILL and BUS.
|
|
|
|
| |
functions
|
|
|
|
|
|
|
| |
Issue #18955: This will prevent serializers from serializing these
variables as numbers (which loses the additional groups).
This restores behaviour from 5.16.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Issue #18636: This extends the work from
613c63b465f01af4e535fdc6c1c17e7470be5aad to %ENV keys. Previously
if you assigned an upgraded string as a key in %ENV, the string’s
internal PV representation was sent to the OS. Now the string is
“soft downgraded” before being given to the OS; if the downgrade
fails--i.e., if the string contains code points above 255--then
a warning is printed, and the string’s utf8 is assigned to the
environment, as happens with %ENV values.
A new internal macro, MgSV, is created to facilitate this work.
|
|
|
|
|
|
| |
This was generating
warning: type qualifiers ignored on cast result type [-Wignored-qualifiers]
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In v5.33.3-24-g02a48966c3 I added the Perl_magic_freemglob() function,
which allowed special-case handling of the pos() magic type to be
removed from S_mg_free_struct().
However, I got it wrong, by more or less copying the same code from
another such function I had just created. So I made
Perl_magic_freemglob() free mg_ptr(), but in the case of pos magic, this
doesn't point to a buffer which needs freeing. In fact its currently
always NULL so attempting to free it is harmless - but this commit
removes the free() for logical soundness and future robustness.
|
|
|
|
|
|
|
|
|
|
|
| |
This just detabifies to get rid of the mixed tab/space indentation.
Applying consistent indentation and dealing with other tabs are another issue.
Done with `expand -i`.
* vutil.* left alone, it's part of version.
* Left regen managed files alone for now.
|
| |
|
|
|
|
|
| |
The new implementation, like the UCRT implementation, always
opens the specified file.
|
|
|
|
|
|
|
|
|
|
|
| |
This feature allows documentation destined for perlapi or perlintern to
be split into sections of related functions, no matter where the
documentation source is. Prior to this commit the line had to contain
the exact text of the title of the section. Now it can be a $variable
name that autodoc.pl expands to the title. It still has to be an exact
match for the variable in autodoc, but now, the expanded text can be
changed in autodoc alone, without other files needing to be updated at
the same time.
|
|
|
|
|
|
|
|
|
| |
This broke on some smokers where the locale collation data was
broken in some way (and rejected by the collation setup code.)
It also broke if collation magic was generated for an SV and then
the SV was modified, freeing the collation data before the SV was
destroyed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
S_mg_free_struct() has a workaround to never free mg->mg_ptr for
PERL_MAGIC_regex_global.
Move this logic into a new magic vtable free method instead, so that
S_mg_free_struct() (which gets called for every type of magic) doesn't
have the overhead of checking every time for mg->mg_type ==
PERL_MAGIC_regex_global.
[ No, I don't know why PERL_MAGIC_regex_global's vtable and methods
are suffixed mglob rather than regex_global or vice versa ]
|
|
|
|
|
|
|
|
|
|
| |
S_mg_free_struct() has a workaround to free mg->mg_ptr in
PERL_MAGIC_utf8 even if mg_len is zero.
Move this logic into a new magic vtable free method instead, so that
S_mg_free_struct() (which gets called for every type of magic) doesn't
have the overhead of checking every time for mg->mg_type ==
PERL_MAGIC_utf8.
|
|
|
|
|
|
|
|
|
|
| |
v5.29.9-139-g44955e7de8 added a workaround to S_mg_free_struct() to
free mg->mg_ptr in PERL_MAGIC_collxfrm even if mg_len is zero.
Move this logic into a new magic vtable free method instead, so that
S_mg_free_struct() (which gets called for every type of magic) doesn't
have the overhead of checking every time for mg->mg_type ==
PERL_MAGIC_collxfrm.
|
| |
|
|
|
|
| |
The former is preferred. This was the only sv_true() use in the core.
|
| |
|
|
|
|
|
| |
This uses a new organization of sections that I came up with. I asked
for comments on p5p, but there were none.
|
|
|
|
|
| |
It only does anything under PERL_GLOBAL_STRUCT, which is gone.
Keep the dNOOP defintion for CPAN back-compat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
v5.31.9-156-g94c8b9c1f0 introduced the free_and_set_cop_warnings()
macro. It's first argument expects a COP rather than a COP*. Its usage
in S_restore_cop_warnings(() is to modify PL_cucop, but in order to pass
a COP rather than a COP*, the original commit made a local copy of
PL_curcop and ended up inadvertently updating the copy instead.
This commit changes the maco so it expects a COP*, and updates the bulk
of its callers to use &PL_compiling rather than PL_compiling, and fixes
up S_restore_cop_warnings().
The symptoms were ASAN failures in a few test scripts including
uni/parser.t and ext/XS-APItest/t/handy0*.t.
(The S_restore_cop_warnings() function was only used by
Perl__force_out_malformed_utf8_message(), so didn't cause many issues
outside of test scripts which forced such "malformed "errors).
|
|
|
|
|
| |
This is avoiding the boilerplate to free
the cop_warning string when setting it.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to this change, when a signal handler was invoked, the signame passed
into the sub would be the name of the signal that was defined first via {}.
This meant that the handler had to either be aware of the duplicates and
handle things appropriately or it would be at the mercy of action at a
distance the handler might be unaware of.
This change assures a consistent signal name for now on. It should be
the first signal listed in $Config{sig_name}. Duplicates are listed
at the end.
|
|
|
|
| |
This removes $^{FEATURE_BITS}, since it's no longer needed.
|
|
|
|
|
| |
There's a forward declaration of this function in mg.c. This should be
redundant in these days of embed.fnc and embed.h, so remove it.
|
|
|
|
|
|
|
| |
Fix indentation after previous commits modified scopes; also indent
some nested #if's correctly.
Whitespace-only change
|
|
|
|
|
|
|
|
|
| |
The branch is only taken if a number of conditions are true. Combine
them into a single if statement, with the sip test first, so that an
unnecessary call to sigaction() may be skipped if its only going to
immediately fail afterwards because sip isn't true.
Shouldn't be any change in functionality.
|
|
|
|
|
|
|
| |
Currently, whether the OS-level signal handler function is declared as
1-arg or 3-arg depends on the configuration. Add explicit versions of
these functions, principally so that POSIX.xs can call which version of
the handler it wants regardless of configuration: see next commit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The preceding commit flagged up an existing bug, but kept old the buggy
behaviour. This commit fixes the bug. I haven't added a test, since it
seems that the test suite doesn't try with unsafe signals. But this
code:
$SIG{USR1} = sub { $gotit++, die };
eval { kill SIGUSR1, $$ } for 1..2;
print "gotit=$gotit\n";
when run before erroneously gave 1, but now correctly gives 2.
Basically the code that restores the signal mask after a sig handler
dies, should do it only in a direct (unsafe) signal handler: the
deferred (safe) signal handler will have already done it. The bug was
that the inbuilt perl unsafe signal handler was being incorrectly
treated as safe. The code path via POSIX (and for which a test was added
with v5.13.9-531-gc22d665b55) *was* ok.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function implements the body of what used to be Perl_sighandler(),
the latter becoming a thin wrapper round Perl_perly_sighandler().
The main reason for this change is that it allows us to add an extra
arg, 'safe' to the function without breaking backcompat. This arg
indicates whether the function is being called directly from the OS
signal handler (safe==0), or deferred via Perl_despatch_signals()
(safe==1).
This allows an infelicity in the code to be fixed - it was formerly
trying to determine the route it had been called by (and hence whether a
'safe' route) by seeing if either of the sig/uap parameters was
non-null. It turns out that this was highly dogdy, and only worked by
luck. The safe caller did indeed pass NULL args, but due to a bug
(shortly to be fixed), sometimes the kernel thinks its calling a 1-arg
sig handler when its actually calling a 3-arg one. This means that the
sig/uap args are random garbage, and happen to be non-zero only by happy
coincidence on the OS/platforms so far.
Also, it turns out that the call via Perl_csighandler() was getting it
wrong: its explicit (NULL,NULL) args made it look like a safe signal
call. This will be corrected in the next commit, but for this commit the
old wrong behaviour is preserved.
See RT #82040 for details of when/why the original dodgy 'safe' check
was
added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a bunch of places in core that do
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
to decide whether the C signal handler function should be declared with,
and called with, 1 arg or 3 args.
This commit just adds
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
# define PERL_USE_3ARG_SIGHANDLER
#endif
Then uses the new macro in all other places rather than checking
HAS_SIGACTION and SA_SIGINFO. Thus there is no functional change; it just
makes the code more readable.
However, it turns out that all is not well with core's use of 1-arg
versus 3-arg, and the few commits will fix this.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From the code comments:
This is an alias for the OS's siginfo_t, except that where the OS
doesn't support it, declare a dummy version instead. This allows us to
have signal handler functions which always have a Siginfo_t parameter
regardless of platform, (and which will just be passed a NULL value
where the OS doesn't support HAS_SIGACTION).
It doesn't actually do anything useful yet, but will shortly allow
signal handler functions to be rationalised.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
LGTM provides static code analysis and recommendations for code quality
improvements. Their recent run over the Perl 5 core distribution
identified 12 instances where a local variable hid a parameter of
the same name in an outer scope. The LGTM rule governing this situation
can be found here:
Per: https://lgtm.com/rules/2156240606/
This patch renames local variables in approximately 8 of those instances
to comply with the LGTM recommendation. Suggestions for renamed
variables were made by Tony Cook.
For: https://github.com/Perl/perl5/pull/17281
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Perform only a bit check instead of a much more expensive hash
lookup to test features.
For now I've just added a U32 to the cop structure to store the bits,
if we need more we could either add more bits directly, or make it a
pointer.
We don't have the immediate need for a pointer that warning do since
we don't dynamically add new features during compilation/runtime.
The changes to %^H are retained so that caller() can be used from perl
code to check the features enabled at a given caller's scope.
|
|
|
|
| |
Perl_grok_atoUV has been changed so endptr constraints the input. Thus we need to reset the endptr after every use.
|
|
|
|
|
| |
Remove WinCE support as agreed in the thread starting here:
https://www.nntp.perl.org/group/perl.perl5.porters/2018/07/msg251683.html
|
|
|
|
|
|
|
|
|
| |
This information is already in embed.fnc, and we know it compiles. Some
of this information is now out-of-date. Get rid of it.
There was one bit of information that was (apparently) wrong in
embed.fnc. The apidoc line asked that there be no usage example
generated for newXS. I added that flag to the embed.fnc entry.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example the following leaked:
use locale;
my $le = "" le "";
When a comparison is done within locale scope, PERL_MAGIC_collxfrm
magic is added to the SV. However, the value set for mg_len is the length
of the collated string, not the malloced size of the buffer. This means
that mg_len can be set to zero, which by convention, means that mg_ptr
shouldn't be freed.
For now, fix by putting special-cased code in S_mg_free_struct. After
5.30.0 is out, I'll probably add a PERL_MAGIC_collxfrm-specific svt_free
vtable method.
The symptoms were that valgrind / Address Sanitizer found fault with
lib/locale.t
|
|
|
|
|
|
|
|
|
|
|
|
| |
When restoring the old value, need to free the current value first.
Can be reproduced with
{
local ${^WARNING_BITS} = 'swit';
}
when run under ASan or similar.
An equivalent test already exists in t/op/leaky-magic.t.
|
|
|
|
|
|
|
|
|
|
| |
This changes the internal function grok_atoUV() to not require its input
to be NUL-terminated. That means the existing calls to it must be
changed to set the ending position before calling it, as some did
already.
This function is recommended to use in a couple of pods, but it wasn't
documented in perlintern. This commit does that as well.
|