| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As suggested in the ticket, the buffer size is now 1024 by default,
but this can be adjusted at perl build time with:
-Accflags=-DPERL_GETSOCKOPT_SIZE=2048
or similarly with hints.
I considered making this adjustable with a ${^...} variable, but that
seemed excessive.
I don't see a practical way to regression test this, TCP_INFO is
non-portable. I did examine strace output for a one-liner that
calls getsockopt() and the new buffer size was used.
Fixes #19758
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The tryAMAGICftest_MG() macro was doing two checks:
1) seeing whether the filetest operator's arg (*PL_stack_sp) looks
to have magic or be a reference,
2) and if the op has children (which will have pushed an arg, unlike
(-X _),
If both are true, then do full-on magic and/or overload processing.
The problem with this is that it checks the arg *before* checking whether
there's even an arg. Thus in the case of (-X _), it is actually examining
a random SV on the stack (or in the case of nothing on the stack,
examining the PL_sv_undef pointer always stored at PL_stack_base[0] as a
guard.)
It turns out this was harmless - the test for (1) will examine a random
(but real) SV and get garbage results, but then the 2nd test will fail
anyway, so overloading won't be called.
So the fix is to swap the (1) and (2) test order.
In addition, I changed the 'has an argument' test from OPf_KIDS to
!OPf_REF. These should be mutually exclusive, but the OPf_REF flag
formally indicates (-X _), i.e. that no arg has been pushed on the
stack. Whether the op has children or not could potentially change in
the future, independent of whether it's the (-X _) form.
So overall this commit makes no visible functional difference, but may
make the code more robust against future changes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changed:
* perl.c - Perl_moreswitches
* pp_sys.c - pp_sysread
* toke.c - Perl_scan_str
In each of the above functions, one instance of SvGROW on a new SVt_PV
can be swapped for the more efficient sv_grow_fresh. In two of the
instances, the calls used to create the the SVt_PV have also been
streamlined.
There should not be any functional change as a result of this commit.
|
|
|
|
|
|
|
|
|
| |
gcc 12 was complaining that evaluating (somehekptr)->hek_key
was always true in many places where HvNAME() or HvENAME() was
being called in boolean context.
Add new macros to check whether the names should be available and
use those instead.
|
|
|
|
|
|
| |
If there is no reentrant form of the function, these still won't be
thread safe, but doing that is better done in reentr.c. It is on my
TODO list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
messages.
These new formats are intended to be used in error messages where
we want to show the contents of a string without any possible
hidden characters not rendering in the error message, and where
it would be unreasonable to show every character of the string
if it is very long.
A good example would be when we want to say that a class name is
illegal. Consider:
"Foo\0"->thing()
should not throw an error message about "Foo" being missing, the fact
there is a null in there should be visible to the developer.
Similarly if we had
("x" x 1000_000)->thing()
we also do not want to throw a 1MB error message as it is generally
just unhelpful, a class name that long is almost certainly a mistake.
Currently this patch restricts it to showing 256 characters, the first
128 followed by an ellipses followed by the last 128 characters, but the
docs are such that we can change that if we wish, I suspect something
like 100 would be more reasonable. You can override the define
PERL_QUOTEDPREFIX_LEN to a longer value in Configure if you wish.
Example usage:
other= newSVpvs("Some\0::Thing\n");
sv_catpvf(msg_sv,"%" SVf_QUOTEDPREFIX, SVfARG(other));
Should append
"Some\0::Thing\n"
to the msg_sv. If it were very long it would have ellipses infixed. The
class name "x" x 1_000_000 would show
Can't locate object method "non_existent_method" via \
package "x[repeated 128 times]"..."x[repeated 128 times]" \
(perhaps you forgot to load \
"x[repeated 128 times]"..."x[repeated 128 times]"?) at -e line 1.
(but obviously as one line with the literal text of the class instead of
"[repeated 128 times]")
This patch changes a variety of error messages that used to output the
full string always. I haven't changed every place that this could happen
yet, just the main ones related to method calls, subroutine names and
the like.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This env var can be used to trigger a repeatable run of a script which
calls C<srand()> with no arguments, either explicitly or implicitly
via use of C<rand()> prior to calling srand(). This is implemented in
such a way that calling C<srand()> with no arguments in forks or
subthreads (again explicitly or implicitly) will receive their own seed
but the seeds they receive will be repeatable.
This is intended for debugging and perl development performance testing,
and for running the test suite consistently. It is documented that the
exact seeds used to initialize the random state are unspecified, and
that they may change between releases or even builds. The only guarantee
provided is that the same perl executable will produce the same results
twice all other things being equal. In practice and in core testing we
do expect consistency, but adding the tightest set of restrictions on
our commitments seemed sensible.
The env var is ignored when perl is run setuid or setgid similarly to
the C<PERL_INTERNAL_RAND_SEED> env var.
|
|
|
|
| |
The new Perl_newSVhek_mortal function is slightly more efficient.
|
|
|
|
| |
Issue #19882
|
|
|
|
|
|
|
| |
Boolean values used to be treated as string, but this is not desirable.
(thanks to @tonycoz)
Also added tests for this.
|
|
|
|
|
|
|
|
|
|
|
|
| |
setsockopt (pp_ssockopt) used to treat its last argument (OPTVAL) as
a packed string whenever it has string slot set (SvPOKp), but this
would be confused if the argument is an integer but had cached
stringified value. Now it will treat OPTVAL as a packed string
only when it is originally created as a string, using Perl 5.36+'s
new (internal) feature where POK flag indicates whether the SV started
as a string.
Will fix GH #18642.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
I believe the '!!' is somewhat obscure; I for one didn't know about it
for years of programming C, and it was buggy in one compiler, which is why
cBOOL was created, I believe. And it is graphically dense, and
generally harder to read than the cBOOL() construct.
This commit dates from before we moved to C99 where we can simply cast
to (bool), and cBOOL() has been rewritten to do that. But the vast
majority of code uses cBOOL(), and this commit brings the remainder of
the core .[ch] files into uniformity.
|
|
|
|
|
|
|
|
|
|
|
| |
In turn, this means that the hv argument to Perl_hv_free_ent() and
Perl_hv_delayfree_ent() is now clearly unused, so mark it as such. Both
functions are deemed to be API, so unlike the static function
S_hv_free_ent_ret we can't simply change their parameters.
However, change all the internal callers to pass NULL instead of the hv, as
this makes it obvious that the function does not read hv, and might cause
the compiler to generate better code.
|
|
|
|
|
|
|
|
| |
This turned out to be harmless, as sv_setpvn_fresh() does nothing
when h_addr is NULL, but the call is also unnecessary when h_addr
is NULL, and possibly confusing to future maintainers.
CID 343917
|
|
|
|
|
|
|
|
|
|
| |
In a few places, SVs can be created more efficiently or new SVs
can be assigned to more efficiently. Small changes included:
* Use sv_setpvn_fresh instead of sv_setpvn
* Use sv_mortalcopy_flags instead of sv_newmortal + sv_setsv_flags
* newSVsv_flags instead of newSV + sv_setsv_flags
* sv_newmortal instead of sv_2mortal(newSV(0))
* Remove a SvGROW(sv, 257) following a newSV(257)
|
|
|
|
| |
The same holds for newSVpvs* wrappers around newSVpvn* functions.
|
| |
|
| |
|
|
|
|
| |
The build has been broken since 2009.
|
|
|
|
|
|
|
|
|
| |
Previously the state was only freed at the point when the hash was iterated
again, or re-tied, or destroyed.
This shouldn't make any difference to sane code, but the change can be
detected with suitably pathological pure-Perl code, so someone might just
(unwisely) be relying on this undocumented implementation detail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On FreeBSD dev_t (and hence the st_dev member of struct stat) is an
unsigned 64-bit integer, and the previous simple PUSHi() corrupted
that.
A previous version of this reflected the st_ino code and implemented
our own number to string conversion, but a system with such a large
st_dev should be assumed to have inttypes.h, and an intmax_t which is
no smaller than st_dev.
The st_ino code could probably be changed similarly, but 64-bit inode
numbers are not a new thing, so it may be riskier.
|
|
|
|
|
|
|
|
|
| |
Previously it would mangle it, resetting EITER but not RITER, meaning that
after untie continuing iteration would be inconsistent - normally it would
carry on exactly where it left off, but if iteration had been in the middle
of a chain of HEs, it would skip the rest of the chain.
Fixes GH #19077
|
|
|
|
| |
The former doesn't make a function call.
|
|
|
|
|
|
|
|
| |
The code here checked SV flags before fetching magic, potentially
getting confused if magic fetched changed flags.
This also fixes handling for upgraded SVs, but I'm not sure that can
be tested sufficiently portably.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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 API used requires Windows Vista or later.
The API itself requires either elevated privileges or a sufficiently
recent version of Windows 10 running in "Developer Mode", so some
tests require updates.
|
|
|
|
| |
fixes #18293
|
|
|
|
|
|
|
|
|
|
|
| |
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 uses a new organization of sections that I came up with. I asked
for comments on p5p, but there were none.
|
| |
|
|
|
|
|
| |
Also eliminate USE_HEAP_INSTEAD_OF_STACK and
SETSOCKOPT_OPTION_VALUE_T, since Symbian was the only user of those.
|
|
|
|
|
| |
Mostly in comments and docs, but some in diagnostic messages and one
case of 'or die die'.
|
|
|
|
|
|
| |
When it's possible, use sizeof(struct sockaddr_storage).
fixes #17761
|
|
|
|
|
|
|
|
|
| |
It turns out that even though the headers correctly define the argument
as `int` under C++, -Wc++-compat doesn't know this.
Add a comment to stop others from falling into the same trap I did.
This reverts commit 34d254cefc451e5ab438acf22a51d7b557c05a0e.
|
| |
|
|
|
|
|
|
|
| |
Glibc has enum typedefs for some arguments that are defined as `int`
by the X/Open standard. This is fine in C, but until glibc
2.3 (released in 2002) this was also done for C++, which is not
allowed.
|
| |
|
|
|
|
| |
Else, DIE() will bever be executed.
|
|
|
|
| |
We have a macro to hide the details of this; use it
|
|
|
|
|
| |
When no file has previously been opened, "eof" should return true. This
behavior was broken by 32e653230c7ccc (see also [#60978]).
|
|
|
|
|
|
| |
Per: https://lgtm.com/projects/g/Perl/perl5/alerts/?mode=tree&ruleFocus=2154840804
For: RT 133686 (partial)
|
|
|
|
|
|
| |
Unlike every other platform's access() or equivalent (and as required
by POSIX), AIX doesn't declare the path argument to access() and
accessx() as const char*, so cast the const away.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This includes removing the :utf8 logic from pp_syswrite. pp_sysread
retains it, since it's also used for read().
Tests that are specifically testing the behaviour against :utf8
handles have been removed (eg in lib/open.t), several other tests
that incidentally used those functions on :utf8 handles have been
adapted to use :raw handles instead (eg. op/readline.t).
Test lib/sigtrap.t fails if STDERR is :utf8, in code from the
original 5.000 commit, which is intended to run in a signal handler
|
|
|
|
| |
RT #132602
|
|
|
|
|
|
| |
This reverts commit 523d71b314dc75bd212794cc8392eab8267ea744, reinstating
commit 2cdf406af42834c46ef407517daab0734f7066fc. Reversion is not the
way to address the porting problem that motivated that reversion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 2cdf406af42834c46ef407517daab0734f7066fc.
The reason for the revert is that with this commit, perl fails to
compile on darwin (or at least, one some versions of it):
./miniperl -Ilib make_ext.pl lib/auto/DB_File/DB_File.bundle MAKE="/Applications/Xcode.app/Contents/Developer/usr/bin/make" LIBPERL_A=libperl.a LINKTYPE=dynamic
Parsing config.in...
Looks Good.
dyld: lazy symbol binding failed: Symbol not found: _mkostemp
Referenced from: /private/tmp/perl/cpan/DB_File/../../miniperl
Expected in: flat namespace
dyld: Symbol not found: _mkostemp
Referenced from: /private/tmp/perl/cpan/DB_File/../../miniperl
Expected in: flat namespace
Unsuccessful Makefile.PL(cpan/DB_File): code=5 at make_ext.pl line 518.
make: *** [lib/auto/DB_File/DB_File.bundle] Error 2
|