| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Previously in-place editing opened the file then immediately
*replaced* the file, so if an error occurs while writing the output,
such as running out of space, the content of the original file is lost.
This changes in-place editing to write to a work file which is renamed
over the original only once the output file is successfully closed.
It also fixes an issue with setting setuid/setgid file modes for
recursive in-place editing.
|
|
|
|
|
|
|
|
|
|
|
|
| |
rv2gv will return &PL_sv_undef when it can't get a GV, previously
this could cause an assertion failure in mg.c
My original fix for this changed each op that deals with GVs for I/O
to set PL_last_in_gv to NULL if there was no io object in the GV, but
this changes other behaviour as noted by FatherC.
Also partly reverts 84ee769f, which unnecessarily did the same for
readline(), so now we're consistent.
|
|
|
|
|
|
| |
This is a new API function, partly substituting for the my_strerror()
that was recently removed from the public API, but also incorporating
the decoding work that's done for $!.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, the stringification of "$!" was considered to be UTF-8 if it
had any characters with the high bit set, and everything was
syntactically legal UTF-8. This may to correctly guess on short strings
where there are only a few non-ASCII bytes. This could happen in
languages based on the Latin script where many words don't use
non-ASCII.
This commit adds a check that the locale is a UTF-8 one. That check is
a call to an already-existing subroutine which goes to some lengths to
get an accurate answer, and should be essentially completely reliable on
modern systems that have nl_langinfo() and/or mbtowc().
See the thread starting at
http://nntp.perl.org/group/perl.perl5.porters/245902
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are still a few core occurrences of
sv_setsv(sv, NULL);
which is equivalent to
sv_setsv(sv, &PL_sv_undef);
but which can now be done more efficiently with
sv_set_undef(sv);
|
|
|
|
|
|
|
|
|
| |
mg.c:641:21: warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]
UV uv = (UV)mg->mg_obj;
It's storing a char-ranged integer value as an SV*. By using SSize_t
rather than UV to store the char, it avoids mismatched size warnings.
|
|
|
|
|
|
|
| |
This has been deprecated since 5.22 and a no-op since 5.26.
Remove the now-obsolete t/uni/heavy.t test, which only tested that
utf8_heavy.pl didn't fail to load when ${^ENCODING} was set.
|
|
|
|
|
|
|
|
| |
This used to work like setting it to 'undef', but has been deprecated
since Perl 5.20.
In passing, avoid duplicate duplicate uninitialized warning by reusing
the SvIV() result already stored in 'val'.
|
|
|
|
|
|
|
|
| |
A handful of assignments are lacking a space on the left-hand side,
which is not consistent with the rest of the project style
(perlstyle mandates «Space around most operators»).
Also, a comment was mis-aligned.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RT #131083
Recent commits v5.25.10-81-gd69c430 and v5.25.10-82-g67dd6f3 added
out-of-range/overflow checks for the offset arg of vec(). However in
lvalue context, these croaks now happen before the SVt_PVLV was created,
rather than when its set magic was called. This means that something like
sub f { $x = $_[0] }
f(vec($s, -1, 8))
now croaks even though the out-of-range value never ended up getting used
in lvalue context.
This commit fixes things by, in pp_vec(), rather than croaking, just set
flag bits in LvFLAGS() to indicate that the offset is -Ve / out-of-range.
Then in Perl_magic_getvec(), return 0 if these flags are set, and in
Perl_magic_setvec() croak with a suitable error.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previous commits have tightened up the checking of UTF-8 for
well-formedness in the input program or string eval. This is done in
lex_next_chunk and lex_start. But it doesn't handle the case of
use utf8; foo
because 'foo' is checked while UTF-8 is still off. This solves that
problem by noticing when utf8 is turned on, and then rechecking at the
next opportunity.
See thread beginning at
http://nntp.perl.org/group/perl.perl5.porters/242916
This fixes [perl #130675]. A test will be added in a future commit
This catches some errors earlier than they used to be and aborts. so
some tests in the suite had to be split into multiple parts.
|
|
|
|
| |
Therefore it's dangerous to presume things fit into an IV.
|
|
|
|
| |
Except under cpan/ and dist/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RT #130584
When pos() or similar is used on a utf8 string, perl attaches magic
to it that caches a couple of byte<->char offset conversions. This can
avoid quadratic behaviour when continually scanning a big chunk of a long
string to convert a byte offset to a char offset when pos() is called.
v5.17.3-203-g7d1328b added code to invalidate this cache when get magic is
called on an SV, since the get magic may change the value of the SV.
However, under -T, taint magic gets added to a tainted string, which
includes a get method which doesn't actually change the SV's value.
So make a special exception to get-magic-cache-invalidation if the only
get magic on the string is taint.
This stops code like the following going quadratic under -T:
$_ = "... long tainted utf8 string ...";
while ( /..../g) {
my $p = pos(); # calculating pos() goes quadratic
}
|
|
|
|
| |
pod/perlhack.pod says to try hard not to exceed 79 columns.
|
|
|
|
|
|
|
|
|
| |
Setting $/ to a reference of a non-positive integer has been deprecated
since 5.20, in which it was special cased to act like you had set to
$/ to undef.
In Perl 5.28, setting $/ to a reference to a non-positive integer will
be a fatal error.
|
|
|
|
|
| |
Hence, we adapted the warning, to mention the version in which it
will become a fatal error.
|
|
|
|
|
|
| |
RT #130068
(applied untested, as I don't have access to a dragonfly box - DAPM)
|
|
|
|
|
|
|
| |
This function is equivalent to sv_setsv(sv, &PL_sv_undef), but more
efficient.
Also change the obvious places in the core to use the new idiom.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 flag is set on an SV to indicate that it has PERL_MAGIC_bm
(fast Boyer-Moore) magic attached. Instead just directly check whether
it has such magic.
This frees up the 0x40000000 bit for anything except AVs and HVs
|
|
|
|
|
|
|
|
|
|
|
|
| |
(but keep SvTAIL())
This flag is only set on SVs that have Boyer-Moore magic attached.
Such SVs already re-purpose the unused IVX slot of that SV to store
BmUSEFUL. This commit repurposes the unused NVX slot to store this
boolean value instead.
Now that flag bit (0x80000000) is only used with AVs, HVs, RVs and
scalar SVs with IOK.
|
|
|
|
|
|
|
|
|
| |
@{^CAPTURE} exposes the capture buffers of the last match
as an array. So $1 is ${^CAPTURE}[0].
%{^CAPTURE} is the equivalent to %+ (ie named captures)
%{^CAPTURE_ALL} is the equivalent to %- (ie all named captures).
|
| |
|
|
|
|
|
|
|
|
| |
While fixing delimcpy(), I found that it wasn't always clear what its
callers did, so I've added some extra code comments.
also add a balancing '}' in a comment block to help editors that
jump between matching brackets.
|
|
|
|
|
|
|
| |
Since 483efd0abe3 the path delimiter is a ':' instead of '|' on
VMS when running under a Unix shell. So use that as a guide
to whether we should use a colon or a slash to detect relative
directories that should be tainted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
$ cat > foo
#!/usr/bin/perl
print "What?!\n"
^D
$ chmod +x foo
$ ./perl -Ilib -Te '$ENV{PATH}="."; exec "foo"'
Insecure directory in $ENV{PATH} while running with -T switch at -e line 1.
That is what I expect to see. But:
$ ./perl -Ilib -Te '$ENV{PATH}="/\\:."; exec "foo"'
What?!
Perl is allowing the \ to escape the :, but the \ is not treated as an
escape by the system, allowing a relative path in PATH to be consid-
ered safe.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Nothing uses it now, and it does nothing.
|
| |
|
|
|
|
| |
${^ENCODING} is disabled and tests are modified to account.
|
|
|
|
|
| |
This should avoid the "unused variable 'i'" warning that pops up in some
configurations.
|
|
|
|
|
|
|
|
| |
These are all specified by POSIX/SUSv3, but not all platforms have them,
as mentioned in POSIX.pm.
We can only test the pid, uid and code fields, since they are the only
ones that are defined for a user-sent signal.
|
|
|
|
|
|
|
|
| |
This var is (mostly) unused, but is set in a couple of places, hence:
mg.c:2657:17: warning: variable ‘s’ set but not used
In the one place it is used, declare it in a narrower scope.
|
|
|
|
|
|
| |
No warnings were emitted since the use of the PL_dollarzero_mutex
was correctly bracketed by mutex lock and unlock, but by splitting
off the code and annotating it is more likely to stay correct.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The original implementation in commit cba61fe146 was sloppy. It is named
like a special var, it is listed as a special var, but it was a regular GV.
Since nobody knows this var exists, and full stat is the default (which I
disagree with see below). There will be alot more PP and C/XS perl stat()
calls (atleast a couple to dozens or low 100s for short lived perl
processes) than reads/writes to this global scalar (rounded to 0 R/Ws)
in a Win32 perl process. So avoid the 1 usually failing GV package (hash)
lookup for each PP/XS/PL C stat by using magic vars and a C bool. This is
a perf increase. Use sv_true instead of SvTRUE_NN because this code is
extremely rare to execute and the macro has large machine code.
I disagree with the default being full stat with since this increases the
number of kernel IO calls and ASCII->UTF16 conversions, and there was
perf criticism in the original thread that implemented this
this http://www.nntp.perl.org/group/perl.perl5.porters/2006/02/msg109917.html
but why full stat is default is for another ticket. This patch lessens the
overhead of full stat until something else is decided.
Change the initial value of the sloppystat setting for miniperl to be true
instead of doing it in buildcustomize.pl in PP. Revert part of
commit 8ce7a7e8b0 "speed up miniperl require on Win32" to acomplish this.
Unlike Unix perl, no object files are shared between mini and full perl,
so changing the default is fine on Win32 Perl. If minitest/miniperl really
need hard link testing/support, they can explictly turn off sloppy stat
and enable full stat with the special var. Changing the stat default from
C for miniperl avoids creating the special GV on each miniperl process
start as it previously was with the buildcustomize.pl way.
Changing stat setting in C and not PP also saves a couple IO calls in
win32_stat when opening the first .pl if it isn't -e, and
opening buildcustomize.pl in all permutations. The PP code in S_parse_body
contains a -f. See ticket for this patch for details.
Only CPAN use of this special var is
File-Stat-Moose-0.06/lib/File/Stat/Moose.pm#L208 according to cpangrep.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous commit made it clear that the N argument to EXTEND()
is supposed to be signed, in particular SSize_t, and now typically
triggers compiler warnings where this isn't the case.
This commit fixes the various places in core that passed the wrong sort of
N to EXTEND(). The fixes are in three broad categories.
First, where sensible, I've changed the relevant var to be SSize_t.
Second, where its expected that N could never be large enough to wrap,
I've just added an assert and a cast.
Finally, I've added extra code to detect whether the cast could
wrap/truncate, and if so set N to -1, which will trigger a panic in
stack_grow().
This also fixes
[perl #125937] 'x' operator on list causes segfault with possible
stack corruption
|
|
|
|
| |
The code was protected with AMIGAOS which was AmigaOS 3.
|
|
|
|
| |
To make more standard
|
|
|
|
|
| |
so that these constructs appear on a single output line for reader
convenience.
|
|
|
|
| |
Removes 'the' in front of parameter names in some instances.
|
| |
|
|
|
|
|
| |
The majority of perlapi uses C<> to specify these things, but a few
things used I<> instead. Standardize to C<>.
|
| |
|
| |
|
|
|
|
|
|
| |
This reverts commit d28a9254e445aee7212523d9a7ff62ae0a743fec.
Turns out we need save_re_context() after all
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An empty cpan/.dir-locals.el stops Emacs using the core defaults for
code imported from CPAN.
Committer's work:
To keep t/porting/cmp_version.t and t/porting/utils.t happy, $VERSION needed
to be incremented in many files, including throughout dist/PathTools.
perldelta entry for module updates.
Add two Emacs control files to MANIFEST; re-sort MANIFEST.
For: RT #124119.
|
|
|
|
|
|
|
|
| |
For [perl #123814] we added checking for grok_* parse failures in
magic_set for $), but used 0 as the placeholder result in those
cases (since we don't have an effective way to report an error for
this). (Gid_t)(-1) is a safer placeholder, since on many systems
that'll map to an explicit bad group id.
|