| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Strangely, this was apparently found already in 2014, but it now
(rightfully) showed up. Coverity database tweak?
|
|
|
|
| |
Except under cpan/ and dist/
|
|
|
|
| |
cando() has not used PL_statcache since Perl 3 (commit a687059cbaf)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 reverts commit f95ba548a286b17c260cc168715a9d0d441b14a6.
[rt.perl.org #128967]
The negative arguments to fchown depend on the platform,
so Coverity should not claim it knows what is acceptable.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When miniperl calls csh to implement glob(), we clear %ENV temporarily
to avoid csh dying on invalid values for things like LS_COLORS. That
has proven to have far too many problems, since many system-dependent
env vars are necessary for calling an external process. See the RT
ticket for details.
A better solution is temporarily to clear only those vars that are
known to be problematic and make csh possibly fail. There only hap-
pens to be one of those at present, namely LS_COLORS.
|
| |
|
|
|
|
| |
Coverity CID 135145: Argument cannot be negative (NEGATIVE_RETURNS)
|
|
|
|
|
|
|
| |
Coverity id #45354
Since maxsysfd is I32 Coverity cannot prove that being larger than
it means that the fd is non-negative.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Perl_nextargv has to have access to the Stat_t that is written to inside
S_openn_cleanup or else run/switches.t, io/argv.t, io/inplace.t, and
io/iprefix.t will fail. Removing the uses of PL_statbuf that are using
PL_statbuf due to historical reason, and not using PL_statbuf to pass data
between different funcs/different callstacks. This patch makes it easier to
remove PL_statbuf in the future since the number uses of it has been
reduced.
-in Perl_apply move SETERRNO before tot--; so the branch can be combined
with other "tot--;" branches by CC optmizer
-combine 2 Perl_croak(aTHX_ "Illegal suidscript"); statements in
S_validate_suid to make code look simpler, drop my_perl arg for space
efficiency on threads of rarely executed code
|
|
|
|
| |
PERL_EXTERNAL_GLOB being defined also results in the described behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The rationale for this change almost twenty years ago was that
the "CRTL's emulation of Unix-style signals and kill()" couldn't
send signals that got noticed by images running in supervisor
mode. This hasn't been true of the CRTL for some time, and we
haven't been using the CRTL's kill for a very long time either.
So remove this once-but-no-longer-necessary hack. Experiments
show that it is still possible to kill any process we want,
assuming the signalling process has the necessary privileges (or
owns the target process).
TODO: implement killpg() -- if Win32 can do it, surely it's
possible on VMS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Largely reimplements 839a9f02, 54fa14d7, e8432c63, 40262ff4.
The upside is that now doio.c and pp_sys.c have much less AmigaOS
specific ifdefs. As a downside, the exec code is now forked (pun
only partially accidental.)
The earlier story regarding fork+exec, that the AmigaOS creating
thread doesn't terminate but instead continues running is both true
and false. The more detailed story is that the user-observable
behaviour is as with POSIX/UNIX. The thread that created the new
"task" (to use the AmigaOS terms) does hang around -- but all it
does is to wait for the new task to terminate, and more importantly,
it holds on to the resources like filehandles. If the task were to
immediately terminate, the resources would be reclaimed by the kernel.
|
| |
|
|
|
|
| |
Use __amigaos4__ define instead of AMIGAOS.
|
| |
|
|
|
|
|
| |
Unlike UNIXish fork-exec, in amigaos forking is more like
starting a thread, the return code is more than a boolean.
|
| |
|
| |
|
|
|
|
|
| |
FD_CLOEXEC is currently usually the only defined fd flag
for F_GETFD/F_SETFD, but let's not assume that.
|
| |
|
|
|
|
| |
Coverity CID 104832
|
|
|
|
| |
Coverity CID 104852.
|
|
|
|
| |
Coverity CID 104825.
|
|
|
|
| |
Coverity CID 104833.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some questions and loose ends:
XXX gv.c:S_gv_magicalize - why are we using SSize_t for paren?
XXX mg.c:Perl_magic_set - need appopriate error handling for $)
XXX regcomp.c:S_reg - need to check if we do the right thing if parno
was not grokked
Perl_get_debug_opts should probably return something unsigned; not sure
if that's something we can change.
|
|
|
|
|
|
|
|
|
| |
Generally the guideline is to outdent C labels (e.g. 'foo:') 2 columns
from the surrounding code.
If the label starts at column zero, then it means that diffs, such as
those generated by git, display the label rather than the function
name at the head of a diff block: which makes diffs harder to peruse.
|
|
|
|
|
|
|
|
|
|
|
| |
Perl_nextargv fuse 2 tests into 1
Perl_boot_core_UNIVERSAL reorder instructions to avoid using a non-vol
registers (save cv across the Safefree), not reread CV body * after
Safefree. Compute address of CvFILE once.
for Perl_boot_core_UNIVERSAL on VC 2003 before 0x66 bytes of 32 bit x86
machine code, after 0x61.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the implicit close() fails, warn about it, mentioning $! in the
message. This is a default warning in the io category.
We do this in two spots, sv_clear and gp_free. While sv_clear would
be sufficient to get the warning emitted, the warning won’t contain
the name of the handle when called from there, because lone IO thing-
ies are nameless. Doing it also when a GV’s glob pointer is freed--as
long as the IO thingy in there has a reference count of 1--allows the
name to be included in the message, because we still have the glob,
which is where the name is stored.
The result:
$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh "x"x1000, "\n" for 1..50; undef *fh'
Warning: unable to close filehandle fh properly: No space left on device at -e line 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is what we used to get when close reported an error after a print
failure (‘Disk Image’ is a small disk image I made):
$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh "x"x1000, "\n" for 1..50; unlink "ntoeuhnteo"; warn $!; close fh or die "error closing: $!"'
No such file or directory at -e line 1.
error closing: No such file or directory at -e line 1.
Notice how the value of $! as set by unlink is still present after
close fails. So that means after close returns false, you can’t
depend on $! to have the reason for the failure, because it might come
from an unrelated system call. Remove the ‘unlink’ statement and you
get ‘No space left on device’.
As of this commit, the output is more helpful:
$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh "x"x1000, "\n" for 1..50; unlink "ntoeuhnteo"; warn $!; close fh or die "error closing: $!"'
No such file or directory at -e line 1.
error closing: No space left on device at -e line 1.
Three commits ago, I/O errors started recording the error number in
the handle itself. Now ‘close’ restores $! and $^E to the values they
were when the I/O error associated with the closed handle occurred.
This is related to ticket #57512.
|
|
|
|
|
|
|
|
|
|
| |
IoIFP will be assigned to again in say_false block. This redundant code is
from commit 6e21c824d9 perl 4.0 patch 6.
in PerlIO_allocate replace a duplicate block with a goto
in PerlIO_resolve_layers replace a func call with a macro, this couldn't
have been using magic due to the previous SvROK
|
|
|
|
|
|
|
| |
When called with a closed file handle, neither chmod nor utime set
errno when they failed,
chown() did set errno, but this wasn't tested.
|
|
|
|
|
|
|
|
|
|
|
| |
This operator works like <> or <ARGV>, as it reads the list of file
names to open from the command-line arguments. However, it disables
the magic-open feature (that forks to execute piped commands) :
$ bleadperl -e 'while(<>){print}' 'echo foo |'
foo
$ bleadperl -e 'while(<<>>){print}' 'echo foo |'
Can't open echo foo |: No such file or directory at -e line 1.
|
|
|
|
|
| |
Remaining atoi() uses include at least:
ext/DynaLoader/dl_aix.xs, os2/os2.c, vms/vms.c
|
|
|
|
|
|
|
|
| |
You need to configure with g++ *and* -Accflags=-DPERL_GLOBAL_STRUCT
or -Accflags=-DPERL_GLOBAL_STRUCT_PRIVATE to see any difference.
(g++ does not do the "post-annotation" form of "unused".)
The version code has some of these issues, reported upstream.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For S_ functions, remove the context.
For Perl_ functions, add PERL_UNUSED_CONTEXT.
Tricky because sometimes depends on DEBUGGING, and sometimes
on whether we are have PERL_IMPLICIT_SYS.
(Why all the mathoms Perl_is_uni_... and Perl_is_utf8_...
functions are not being whined about is a mystery.)
vutil.c (included via util.c) has one of these, but it's cpan/,
and a known problem: https://rt.cpan.org/Ticket/Display.html?id=96100
|
|
|
|
| |
This silences a chunk of warnings under -Wformat
|
|
|
|
|
|
|
|
|
| |
... among other things: https://rt.perl.org/Ticket/Display.html?id=122021
PerlIO::scalar (aka opening scalars for IO) has fileno of -1.
This (and probably other exotic PerlIO objects which have funny fds)
requires special care.
|
|
|
|
|
|
|
| |
(1) Enhance its description.
(2) Simplify it: define only if has warn_unused_result.
(3) Make it use STMT_START { ... } STMT_END to be less GNU-extensiony.
(4) Redo 04783dc7 ("fix 'ignoring return value' compiler warnings") with it.
|
|
|
|
|
|
|
| |
Used by linters (static checkers), and also good for human readers.
Even though "FALL THROUGH" seems to be the most common, e.g BSD lint
manual only knows "FALLTHROUGH" (or "FALLTHRU").
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Also very few spots of negative numgroups for getgroups(),
and fgetc() return, but almost all checking is for fcntl.)
(merged fix for perl #121743 and perl #121745: hopefully
picked up all the fixes-to-fixes from the ticket...)
Fix for Coverity perl5 CIDs 28990..29003,29005..29011,29013,
45354,45363,49926:
Argument cannot be negative (NEGATIVE_RETURNS) fd is
passed to a parameter that cannot be negative.
and CIDs 29004, 29012:
Argument cannot be negative (NEGATIVE_RETURNS)
num_groups is passed to a parameter that cannot be negative
and because of CIDs 29005 and 29006 also CID 28924.
In the first set of issues a fd is retrieved from PerlIO_fileno, and
that is then used in places like fstat(), fchown(), dup(), etc.,
without checking whether the fd is valid (>=0).
In the second set of issues a potentially negative
number is potentially passed to getgroups().
The CIDs 29005 and 29006 were a bit messy: fixing them needed also
resolving CID 28924 where the return value of fstat() was ignored,
and for completeness adding two croak calls (with perldiag updates):
a bit of a waste since it's suidperl code.
|
| |
|
| |
|
|
|
|
|
| |
This makes it clearer that variables don't hold values between iterations of
the loop, and permits the variable sv to be made const.
|
|
|
|
|
|
|
|
|
| |
Split the ternary that called Perl_do_open_raw() and Perl_do_open6() based
on PL_inplace into two different if blocks, and merge these with the following
code which is also conditional on PL_inplace.
Remove the warning code from an else block and re-indent it, to make it clear
that it is always called if control reaches the end of the while loop.
|
|
|
|
|
|
| |
Calls to Perl_do_openn() all have at least 2 unused arguments which clutter
the code and hinder easy understanding. Perl_do_open6() and
Perl_do_open_raw() each only do one job, so don't have the dead arguments.
|