| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
In commit 5e0adc2d66, which was a bug fix, I made the mistake of
checking the truth of the return value of gv_fetchsv, which is called
when truncate’s argument is a bareword.
This meant that truncate FOO, 0; would truncate the file named FOO if
the glob happened to have been deleted.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A magical variable is never SvPOK, but only SvPOKp. The code for
checking whether a duplicatee is a numeric file descriptor was only
checking SvPOK. So a regular variable containing a fileno-as-a-string
would work, such as the $a below, as would a stringified magical vari-
able ("$1"), but not $1 itself.
$ echo foo | perl -le '$a = "0"; open a, "<&", $a; warn <a>'
foo
$ echo foo | perl -le '"0" =~ /(.)/; open a, "<&", $1; warn <a>'
Can't use an undefined value as filehandle reference at -e line 1.
$ echo foo | perl -le '"0" =~ /(.)/; open a, "<&", "$1"; warn <a>'
foo
SvPOK variables are also SvPOKp, so checking only the latter suffices.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
$ ./perl -Ilib -e '$/=*foo; <>; warn' <./perl
Assertion failed: (!isGV_with_GP(_svcur)), function Perl_mess_sv, file util.c, line 1467.
Abort trap
The assertion happens when ‘<...> line 42’ is being appended to
the message.
The line of code in question is this:
const bool line_mode = (RsSIMPLE(PL_rs) &&
SvCUR(PL_rs) == 1 && *SvPVX_const(PL_rs) == '\n');
It uses this macro in perl.h:
#define RsSIMPLE(sv) (SvOK(sv) && (! SvPOK(sv) || SvCUR(sv)))
which was last modified by commit af7d13df559:
-#define RsSIMPLE(sv) (SvOK(sv) && SvCUR(sv))
-#define RsPARA(sv) (SvOK(sv) && ! SvCUR(sv))
+#define RsSIMPLE(sv) (SvOK(sv) && (! SvPOK(sv) || SvCUR(sv)))
+#define RsPARA(sv) (SvPOK(sv) && ! SvCUR(sv))
So it looks as though it has always called SvCUR on something that is
not necessarily a PV. As of commit af7d13df559, it has also called
SvPVX on a potential non-PV.
Fixing this simply involves using SvPV instead of SvPVX.
I don’t know that t/io/open.t is the best place for the test, but all
the other ‘<...> line 42’ tests are there.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We are deprecating literal left braces in regular expressions. The 5.16
delta announced that this is coming.
This commit causes a warning to be raised when a literal "{" is
encountered. However, it does not do this if the left brace is at the
beginning of a construct. Such a brace does not cause problems for us
for our future use of it for other purposes, as, for example in things
like \b{w}, and there were a large number of core tests that failed
without this condition.
I didn't mention this exception in the diagnostic. We may choose to
forbid it everywhere, and we certainly want to discourage its use
everywhere. But this commit gets the essential components in early in
5.17, and we can tighten it up later if we decide to.
|
|
|
|
|
|
|
|
|
| |
Or potential lvalue context, like function calls.
The %n format code’s existence renders these two very much like func-
tion calls, as they can modify their arguments.
This allows sprintf("...%n", substr ...) to work.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PerlIO::get_layers should not be ignoring an argument like 12, but
treating "12" (the string) as a filehandle, as those are both the
same value.
It’s an instance of the string/num bug, which is a bit like the
Unicode Bug.
This commit takes the conservative approach of expanding it to flat
scalars in general, but not references (in case we decide to do
something interesting later on, even though I think that would be a
bad idea).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
seek had the same bug as tell. Here is the commit message from
8dc99089, which fixed tell:
----------------------------------------------------------------------
Stop tell($glob_copy) from clearing PL_last_in_gv
This bug is a side effect of rv2gv’s starting to return an incoercible
mortal copy of a coercible glob in 5.14:
$ perl5.12.4 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell'
0
$ perl5.14.0 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell'
-1
In the first case, tell without arguments is returning the position of
the filehandle.
In the second case, tell with an explicit argument that happens to
be a coercible glob (tell has an implicit rv2gv, so tell $fh is actu-
ally tell *$fh) sets PL_last_in_gv to a mortal copy thereof, which is
freed at the end of the statement, setting PL_last_in_gv to null. So
there is no ‘last used’ handle by the time we get to the tell without
arguments.
This commit adds a new rv2gv flag that tells it not to copy the glob.
By doing it unconditionally on the kidop, this allows tell(*$fh) to
work the same way.
Let’s hope nobody does tell(*{*$fh}), which will unset PL_last_in_gv
because the inner * returns a mortal copy.
This whole area is really icky. PL_last_in_gv should be refcounted,
but that would cause handles to leak out of scope, breaking programs
that rely on the auto-closing ‘feature’.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
eof had the same bug as tell. Here is the commit message from
8dc99089, which fixed tell:
----------------------------------------------------------------------
Stop tell($glob_copy) from clearing PL_last_in_gv
This bug is a side effect of rv2gv’s starting to return an incoercible
mortal copy of a coercible glob in 5.14:
$ perl5.12.4 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell'
0
$ perl5.14.0 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell'
-1
In the first case, tell without arguments is returning the position of
the filehandle.
In the second case, tell with an explicit argument that happens to
be a coercible glob (tell has an implicit rv2gv, so tell $fh is actu-
ally tell *$fh) sets PL_last_in_gv to a mortal copy thereof, which is
freed at the end of the statement, setting PL_last_in_gv to null. So
there is no ‘last used’ handle by the time we get to the tell without
arguments.
This commit adds a new rv2gv flag that tells it not to copy the glob.
By doing it unconditionally on the kidop, this allows tell(*$fh) to
work the same way.
Let’s hope nobody does tell(*{*$fh}), which will unset PL_last_in_gv
because the inner * returns a mortal copy.
This whole area is really icky. PL_last_in_gv should be refcounted,
but that would cause handles to leak out of scope, breaking programs
that rely on the auto-closing ‘feature’.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug is a side effect of rv2gv’s starting to return an incoercible
mortal copy of a coercible glob in 5.14:
$ perl5.12.4 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell'
0
$ perl5.14.0 -le 'open FH, "t/test.pl"; $fh=*FH; tell $fh; print tell'
-1
In the first case, tell without arguments is returning the position of
the filehandle.
In the second case, tell with an explicit argument that happens to
be a coercible glob (tell has an implicit rv2gv, so tell $fh is actu-
ally tell *$fh) sets PL_last_in_gv to a mortal copy thereof, which is
freed at the end of the statement, setting PL_last_in_gv to null. So
there is no ‘last used’ handle by the time we get to the tell without
arguments.
This commit adds a new rv2gv flag that tells it not to copy the glob.
By doing it unconditionally on the kidop, this allows tell(*$fh) to
work the same way.
Let’s hope nobody does tell(*{*$fh}), which will unset PL_last_in_gv
because the inner * returns a mortal copy.
This whole area is really icky. PL_last_in_gv should be refcounted,
but that would cause handles to leak out of scope, breaking programs
that rely on the auto-closing ‘feature’.
|
| |
|
|
|
|
|
| |
It's a croak(), not a warning, so doesn't really belong in lib/warnings.t
[This also implicitly fixes the wrong expected output of 69dc7e4bdb8e397c]
|
|
|
|
|
|
|
| |
plan(skip_all => 'foo') is a Test::More-ism that survived the
switch to t/test.pl in 8d646433865d105d3ca0f95dd6593fe343e37aa2
unchanged and caused the test to fail where d_shm is not defined
or IPC::SysV is not built.
|
|
|
|
|
| |
Doing the miniperl check by hand didn't exit() so the test script would die
as soon as it got down to the "use IPC::SysV" line.
|
| |
|
| |
|
|
|
|
|
| |
The skip was not inside a BEGIN block, so the END block ended up
getting compiled and running.
|
|
|
|
|
| |
shmread didn't unset SvIOK properly, causing a read into a SVIV to have
an incorrect numeric value. This patch fixes that and adds tests.
|
|
|
|
|
| |
Tests are based on IPC-SysV's tests, though I had to remove a lot for it
not to rely on IPC::SharedMem.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit ac53db4c3f7e fixed bug #31767 (open $1 not dying), but put the
SvREADONLY check in the wrong spot, causing this bug:
$ perl -lwe 'no warnings "once"; close $x; close $+'
Name "main::x" used only once: possible typo at -e line 1.
Use of uninitialized value $x in ref-to-glob cast at -e line 1.
Modification of a read-only value attempted at -e line 1.
It shouldn’t be dying if I’m not trying to modifying it.
|
|
|
|
|
| |
As we're still using a list of hanging operating systems,
include 'gnukfreebsd' by matching for 'freebsd' anywhere in $^O.
|
|
|
|
|
| |
This makes it easier to see when the skip count needs to
be updated.
|
|
|
|
| |
This makes it pass under miniperl again.
|
|
|
|
|
|
|
|
|
|
|
| |
Revert "[perl #92828] eintr.t hangs on FreeBSD"
This reverts commit 6e59d93aee950461947904b4f24a7f52c6c85f58.
Revert "eintr.t: skip based on capability rather than OS"
This reverts commit df375c6d048b938ecdeaecc7b264a7f1a190120a.
My attempt to skip based on capability hung freebsd, and my attempt to fix
that failed. Give up for now.
|
|
|
|
|
|
|
| |
My commit df375c6d048b938ecdeaecc7b264a7f1a190120a attempted to
convert t/io/eintr.t from OS-based skipping to capability-based skipping,
but it only tested whether reads from pipes are interruptible.
Some OSes (like FreeBSD) only hang on write; so probe for that too.
|
|
|
|
|
| |
This commit allows feature.pm-enabled keywords to work with CORE::*
even outside the scope of ‘use feature’.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The t/io/eintr.t tests require read/write system to calls to be
interruptible (to see if anything nasty can be done by the signal
handler).
Many platforms aren't interruptible, which means the tests would hang.
We currently work round this by skipping based on a hard-coded list of
OSes (such as win32, VMS etc).
Change this so that we instead do an initial test as to whether they are
interruptible, and if not, skip the whole test file.
|
|
|
|
|
|
|
|
|
| |
Opening a file handle to \$glob causes assertion failures
(under debugging) or hangs or other erratic behaviour without
debugging. This might even crash in some cases.
It never really worked properly, but it didn’t start hanging
apparently until 5.12.2 and 5.14.0.
|
|
|
|
|
|
|
| |
We already skip this test file on many platforms which don't
have interruptible IO system calls. Extend this to unconditionally
skip if it's an even (production) release version, so that we don't get
false positives for other platforms we didn't know about.
|
|
|
|
|
|
|
| |
When Perl reads the script in text mode, then the tell() position
on the script handle may include stripped carriage return characters.
Therefore the file position after reading the first line of the
script may be one larger than the length of the input buffer.
|
| |
|
|
|
|
| |
(see tickets perl #85842 and #84688).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We used to read Perl code in binary mode to make life easier for
ByteLoder to include binary data in a source file. To maintain the
illusion of text mode for the DATA handle the filehandle was
transformed from binary mode to text mode when the parser reached the
__END__ or __DATA__ tokens.
This however never worked correctly, as the positions returned by
tell(DATA) were still based on reading part of the stream in binary
mode. And even worse, flushing all filehandles before calling
system(), backticks, or fork() would actually reposition the DATA
filehandle incorrectly, so future reads from it returned the wrong
data.
http://rt.perl.org/rt3/Ticket/Display.html?id=28106 contains several
bug reports that are all related to this problem. The new t/io/data.t
file contains the failing code samples from those bugs.
This patch changes the default build option for Windows to text mode.
ByteLoader will have to deal with this internally, e.g. by rewinding
DATA and switching to binary mode itself.
|
|
|
|
|
|
| |
All callers were using it with dynamic extensions, and also had a
skip_all_if_miniperl() for the same extension. Merge the two tests into one
function to save repetition.
|
|
|
|
|
|
|
|
|
| |
It appears that a larger PerlIO buffer combined with writing to a
pipe triggers an alternate write mechanism in FreeBSD called a
direct write, which is not interruptible by signals. That's
somewhat speculative and has not been confirmed by someone with
knowledge of FreeBSD internals, but we do know the test hangs, so
it's best not to run it for now.
|
| |
|
|
|
|
|
|
|
|
|
| |
The tautological 3 way logic
if (...) { print "1..7\n" } elsif (...) { print "1..7\n" } else { ... }
had actually been in the test since it was first added in a43cb6b7285a7b60,
although it was initially "1..4\n" in each block.
Also use plan(), and set test.pl's idea of the current test before exiting.
|
| |
|
|
|
|
|
| |
It's a common idiom in the tests. This makes it easier to find, read, and
remove.
|
|
|
|
|
|
|
|
|
| |
If Errno is loaded after the compiler has parsed the C<exists &Errno::EBADF>
later in the script, then the intent of that test is subverted - &Errno::EBADF
does not exist, at least as far as the typeglob bound to that op is concerned,
and the test for $! is skipped. I suspect that these have been skipping since
the implementation of Errno was changed in 42607a60df6df19b in May 2010 to
reduce its memory footprint by 55%.
|
|
|
|
| |
This reduces the startup boilerplate code by more than half.
|
|
|
|
| |
Use it in t/io/layers.t to skip if Encode is not built.
|
|
|
|
|
|
| |
Skip under minitest using skip_all_if_miniperl().
skip_all() once rather than skipping every test if Encode is not built, or
PerlIO is not available.
|
|
|
|
|
| |
Skip a test under minitest using skip_if_miniperl().
Use eq(), like() and unlike() where appropriate, instead of ok().
|
|
|
|
|
|
|
| |
Remove redundant C<use Config;>
If C<find PerlIO::Layer 'perlio'> fails, use skip() rather than ok() to skip.
Make the indenting on 2 inconsistent lines consistent with the rest of the file.
Die if Errno can't be loaded, unless it's miniperl.
|
|
|
|
|
| |
Although File::Spec is pure Perl, it is part of the Cwd distribution, and
that isn't built for minitest. So we can't rely on it.
|
|
|
|
|
|
| |
All platforms Perl builds on can already support Unix-style paths (given that
make_ext.pl is using them). This makes 7 more tests pass under minitest, which
doesn't build File::Spec, because it's part of an XS module.
|
| |
|
|
|
|
| |
This is analogous to skipping all of t/op/iofile.t under miniperl.
|