getc() on closed filehandle [pp_getc]
+ Non-string passed as bitmask [pp_sselect]
+
__END__
# pp_sys.c [pp_untie]
use warnings 'untie' ;
use warnings 'closed' ;
format STDIN =
.
+format FOO =
+.
close STDIN;
write STDIN;
+write FOO;
opendir STDIN, ".";
write STDIN;
closedir STDIN;
+opendir FOO, ".";
+write FOO;
+closedir FOO;
no warnings 'closed' ;
write STDIN;
+write FOO;
opendir STDIN, ".";
+opendir FOO, ".";
write STDIN;
+write FOO;
EXPECT
-write() on closed filehandle STDIN at - line 6.
write() on closed filehandle STDIN at - line 8.
+write() on closed filehandle STDIN at - line 11.
(Are you trying to call write() on dirhandle STDIN?)
########
# pp_sys.c [pp_leavewrite]
+use warnings 'unopened';
+format STDIN =
+.
+format FOO =
+.
+close STDIN;
+write STDIN;
+write FOO;
+opendir STDIN, ".";
+write STDIN;
+closedir STDIN;
+opendir FOO, ".";
+write FOO;
+closedir FOO;
+no warnings 'unopened';
+write STDIN;
+write FOO;
+opendir STDIN, ".";
+opendir FOO, ".";
+write STDIN;
+write FOO;
+EXPECT
+write() on unopened filehandle FOO at - line 9.
+write() on unopened filehandle FOO at - line 14.
+ (Are you trying to call write() on dirhandle FOO?)
+########
+# pp_sys.c [pp_leavewrite]
use warnings 'io' ;
format STDOUT_TOP =
abc
Filehandle STDIN opened only for input at - line 3.
########
# pp_sys.c [pp_send]
+use warnings 'io' ;
+syswrite STDIN, "fred";
+no warnings 'io' ;
+syswrite STDIN, "fred";
+EXPECT
+Filehandle STDIN opened only for input at - line 3.
+########
+# pp_sys.c [pp_send]
use warnings 'closed' ;
close STDIN;
syswrite STDIN, "fred", 1;
flock() on unopened filehandle at - line 20.
########
# pp_sys.c [pp_prtf pp_send pp_bind pp_connect pp_listen pp_accept pp_shutdown pp_ssockopt ppp_getpeername]
-use warnings 'io' ;
+use warnings 'closed';
use Config;
BEGIN {
if ( $^O ne 'VMS' and ! $Config{d_socket}) {
getsockname STDIN;
getpeername STDIN;
closedir STDIN;
-no warnings 'io' ;
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept "fred", FOO;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
+opendir FOO, ".";
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept "fred", FOO;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
+closedir FOO;
+no warnings 'closed';
send STDIN, "fred", 1;
bind STDIN, "fred" ;
connect STDIN, "fred" ;
getsockopt STDIN, 1,2;
getsockname STDIN;
getpeername STDIN;
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept FOO, "fred" ;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
+opendir FOO, ".";
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept "fred", FOO;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
EXPECT
send() on closed socket STDIN at - line 22.
bind() on closed socket STDIN at - line 23.
getpeername() on closed socket STDIN at - line 42.
(Are you trying to call getpeername() on dirhandle STDIN?)
########
+# pp_sys.c [pp_prtf pp_send pp_bind pp_connect pp_listen pp_accept pp_shutdown pp_ssockopt ppp_getpeername]
+use warnings 'unopened';
+use Config;
+BEGIN {
+ if ( $^O ne 'VMS' and ! $Config{d_socket}) {
+ print <<EOM ;
+SKIPPED
+# send not present
+# bind not present
+# connect not present
+# accept not present
+# shutdown not present
+# setsockopt not present
+# getsockopt not present
+# getsockname not present
+# getpeername not present
+EOM
+ exit ;
+ }
+}
+close STDIN;
+send STDIN, "fred", 1;
+bind STDIN, "fred" ;
+connect STDIN, "fred" ;
+listen STDIN, 2;
+accept "fred", STDIN;
+shutdown STDIN, 0;
+setsockopt STDIN, 1,2,3;
+getsockopt STDIN, 1,2;
+getsockname STDIN;
+getpeername STDIN;
+opendir STDIN, ".";
+send STDIN, "fred", 1;
+bind STDIN, "fred" ;
+connect STDIN, "fred" ;
+listen STDIN, 2;
+accept "fred", STDIN;
+shutdown STDIN, 0;
+setsockopt STDIN, 1,2,3;
+getsockopt STDIN, 1,2;
+getsockname STDIN;
+getpeername STDIN;
+closedir STDIN;
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept "fred", FOO;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
+opendir FOO, ".";
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept "fred", FOO;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
+closedir FOO;
+no warnings 'unopened';
+send STDIN, "fred", 1;
+bind STDIN, "fred" ;
+connect STDIN, "fred" ;
+listen STDIN, 2;
+accept STDIN, "fred" ;
+shutdown STDIN, 0;
+setsockopt STDIN, 1,2,3;
+getsockopt STDIN, 1,2;
+getsockname STDIN;
+getpeername STDIN;
+opendir STDIN, ".";
+send STDIN, "fred", 1;
+bind STDIN, "fred" ;
+connect STDIN, "fred" ;
+listen STDIN, 2;
+accept "fred", STDIN;
+shutdown STDIN, 0;
+setsockopt STDIN, 1,2,3;
+getsockopt STDIN, 1,2;
+getsockname STDIN;
+getpeername STDIN;
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept FOO, "fred" ;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
+opendir FOO, ".";
+send FOO, "fred", 1;
+bind FOO, "fred" ;
+connect FOO, "fred" ;
+listen FOO, 2;
+accept "fred", FOO;
+shutdown FOO, 0;
+setsockopt FOO, 1,2,3;
+getsockopt FOO, 1,2;
+getsockname FOO;
+getpeername FOO;
+EXPECT
+send() on unopened socket FOO at - line 44.
+bind() on unopened socket FOO at - line 45.
+connect() on unopened socket FOO at - line 46.
+listen() on unopened socket FOO at - line 47.
+accept() on unopened socket FOO at - line 48.
+shutdown() on unopened socket FOO at - line 49.
+setsockopt() on unopened socket FOO at - line 50.
+getsockopt() on unopened socket FOO at - line 51.
+getsockname() on unopened socket FOO at - line 52.
+getpeername() on unopened socket FOO at - line 53.
+send() on unopened socket FOO at - line 55.
+ (Are you trying to call send() on dirhandle FOO?)
+bind() on unopened socket FOO at - line 56.
+ (Are you trying to call bind() on dirhandle FOO?)
+connect() on unopened socket FOO at - line 57.
+ (Are you trying to call connect() on dirhandle FOO?)
+listen() on unopened socket FOO at - line 58.
+ (Are you trying to call listen() on dirhandle FOO?)
+accept() on unopened socket FOO at - line 59.
+ (Are you trying to call accept() on dirhandle FOO?)
+shutdown() on unopened socket FOO at - line 60.
+ (Are you trying to call shutdown() on dirhandle FOO?)
+setsockopt() on unopened socket FOO at - line 61.
+ (Are you trying to call setsockopt() on dirhandle FOO?)
+getsockopt() on unopened socket FOO at - line 62.
+ (Are you trying to call getsockopt() on dirhandle FOO?)
+getsockname() on unopened socket FOO at - line 63.
+ (Are you trying to call getsockname() on dirhandle FOO?)
+getpeername() on unopened socket FOO at - line 64.
+ (Are you trying to call getpeername() on dirhandle FOO?)
+########
# pp_sys.c [pp_stat]
use warnings 'newline' ;
stat "abc\ndef";
+stat "abcdef\n";
+stat "abcdef\n\0";
no warnings 'newline' ;
stat "abc\ndef";
+stat "abcdef\n";
+stat "abcdef\n\0";
EXPECT
-Unsuccessful stat on filename containing newline at - line 3.
+Unsuccessful stat on filename containing newline at - line 4.
+Unsuccessful stat on filename containing newline at - line 5.
########
# pp_sys.c [pp_fttext]
use warnings qw(unopened closed) ;
stat(STDIN) ;
-T HOCUS;
stat(POCUS);
+stat "../test.pl";
+stat *foo;
no warnings qw(unopened closed) ;
-T STDIN ;
stat(STDIN);
-T HOCUS;
stat(POCUS);
+stat "../test.pl";
+stat *foo;
EXPECT
-T on closed filehandle STDIN at - line 4.
stat() on closed filehandle STDIN at - line 5.
-T on unopened filehandle HOCUS at - line 6.
stat() on unopened filehandle POCUS at - line 7.
+stat() on unopened filehandle foo at - line 9.
########
# pp_sys.c [pp_fttext]
use warnings 'newline' ;
-T "abc\ndef" ;
+-T "abcdef\n" ;
+-T "abcdef\n\0" ;
no warnings 'newline' ;
-T "abc\ndef" ;
+-T "abcdef\n" ;
+-T "abcdef\n\0" ;
EXPECT
-Unsuccessful open on filename containing newline at - line 3.
+Unsuccessful open on filename containing newline at - line 4.
+Unsuccessful open on filename containing newline at - line 5.
########
# pp_sys.c [pp_sysread]
use warnings 'io' ;
no warnings 'io' ;
my $a = sysread(F, $a,10) ;
close F ;
+use warnings 'io' ;
+sysread(F, $a, 10);
+read(F, $a, 10);
+sysread(NONEXISTENT, $a, 10);
+read(NONEXISTENT, $a, 10);
unlink $file ;
EXPECT
Filehandle F opened only for output at - line 12.
+sysread() on closed filehandle F at - line 17.
+read() on closed filehandle F at - line 18.
+sysread() on unopened filehandle NONEXISTENT at - line 19.
+read() on unopened filehandle NONEXISTENT at - line 20.
########
# pp_sys.c [pp_binmode]
use warnings 'unopened' ;
########
# pp_sys.c [pp_lstat]
use warnings 'io';
-lstat STDIN;
+open FH, "../harness" or die "# $!";
+lstat FH;
+lstat *FH;
+lstat \*FH;
open my $fh, $0 or die "# $!";
lstat $fh;
+lstat *FH{IO};
no warnings 'io';
-lstat STDIN;
+lstat FH;
lstat $fh;
+close FH;
close $fh;
EXPECT
-lstat() on filehandle STDIN at - line 3.
-lstat() on filehandle $fh at - line 5.
+lstat() on filehandle FH at - line 4.
+lstat() on filehandle FH at - line 5.
+lstat() on filehandle FH at - line 6.
+lstat() on filehandle $fh at - line 8.
+lstat() on filehandle at - line 9.
+########
+
+# pp_sys.c [pp_lstat]
+use warnings 'io';
+use utf8;
+use open qw( :utf8 :std );
+open ᶠḨ, "../harness" or die "# $!";
+lstat ᶠḨ;
+open my $fᚺ, $0 or die "# $!";
+lstat $fᚺ;
+no warnings 'io';
+lstat ᶠḨ;
+lstat $fᚺ;
+close ᶠḨ;
+close $fᚺ;
+EXPECT
+lstat() on filehandle ᶠḨ at - line 7.
+lstat() on filehandle $fᚺ at - line 9.
########
# pp_sys.c [pp_getc]
use warnings qw(unopened closed) ;
getc() on unopened filehandle FOO at - line 3.
getc() on closed filehandle STDIN at - line 5.
getc() on closed filehandle FH2 at - line 12.
+########
+# pp_sys.c [pp_sselect]
+use warnings 'misc';
+$x = 1;
+select $x, undef, undef, 1;
+sub TIESCALAR{bless[]} sub FETCH {"hello"} sub STORE{}
+tie $y, "";
+select $y, undef, undef, 1;
+no warnings 'misc';
+select $x, undef, undef, 1;
+EXPECT
+Non-string passed as bitmask at - line 4.
+########
+use Config;
+BEGIN {
+ if (!$Config{d_fchdir}) {
+ print <<EOM;
+SKIPPED
+# fchdir not present
+EOM
+ exit;
+ }
+}
+opendir FOO, '.'; closedir FOO;
+open BAR, '.'; close BAR;
+opendir $dh, '.'; closedir $dh;
+open $fh, '.'; close $fh;
+chdir FOO;
+chdir BAR;
+chdir $dh;
+chdir $fh;
+use warnings qw(unopened closed) ;
+chdir FOO;
+chdir BAR;
+chdir $dh;
+chdir $fh;
+EXPECT
+chdir() on unopened filehandle FOO at - line 20.
+chdir() on closed filehandle BAR at - line 21.
+chdir() on unopened filehandle $dh at - line 22.
+chdir() on closed filehandle $fh at - line 23.
+########
+# pp_sys.c [pp_open]
+use warnings;
+opendir FOO, ".";
+opendir my $foo, ".";
+open FOO, "../harness";
+open $foo, "../harness";
+no warnings qw(io deprecated);
+open FOO, "../harness";
+open $foo, "../harness";
+EXPECT
+Opening dirhandle FOO also as a file at - line 5.
+Opening dirhandle $foo also as a file at - line 6.
+########
+
+# pp_sys.c [pp_open]
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+opendir FOO, ".";
+opendir $foo, ".";
+open FOO, "../harness";
+open $foo, "../harness";
+no warnings qw(io deprecated);
+open FOO, "../harness";
+open $foo, "../harness";
+EXPECT
+Opening dirhandle FOO also as a file at - line 8.
+Opening dirhandle $foo also as a file at - line 9.
+########
+# pp_sys.c [pp_open_dir]
+use warnings;
+open FOO, "../harness";
+open my $foo, "../harness";
+opendir FOO, ".";
+opendir $foo, ".";
+no warnings qw(io deprecated);
+opendir FOO, ".";
+opendir $foo, ".";
+EXPECT
+Opening filehandle FOO also as a directory at - line 5.
+Opening filehandle $foo also as a directory at - line 6.
+########
+
+# pp_sys.c [pp_open_dir]
+use utf8;
+use open qw( :utf8 :std );
+use warnings;
+use warnings;
+open FOO, "../harness";
+open $foo, "../harness";
+opendir FOO, ".";
+opendir $foo, ".";
+no warnings qw(io deprecated);
+opendir FOO, ".";
+opendir $foo, ".";
+EXPECT
+Opening filehandle FOO also as a directory at - line 9.
+Opening filehandle $foo also as a directory at - line 10.
+########
+# pp_sys.c [pp_*dir]
+use Config ;
+BEGIN {
+ if ( ! $Config{d_telldir}) {
+ print <<EOM ;
+SKIPPED
+# telldir not present
+EOM
+ exit
+ }
+}
+#line 2
+use warnings 'io';
+opendir FOO, ".";
+opendir $foo, ".";
+closedir FOO;
+closedir $foo;
+
+readdir(FOO);
+telldir(FOO);
+seekdir(FOO, 0);
+rewinddir(FOO);
+closedir(FOO);
+
+readdir($foo);
+telldir($foo);
+seekdir($foo, 0);
+rewinddir($foo);
+closedir($foo);
+
+EXPECT
+readdir() attempted on invalid dirhandle FOO at - line 8.
+telldir() attempted on invalid dirhandle FOO at - line 9.
+seekdir() attempted on invalid dirhandle FOO at - line 10.
+rewinddir() attempted on invalid dirhandle FOO at - line 11.
+closedir() attempted on invalid dirhandle FOO at - line 12.
+readdir() attempted on invalid dirhandle $foo at - line 14.
+telldir() attempted on invalid dirhandle $foo at - line 15.
+seekdir() attempted on invalid dirhandle $foo at - line 16.
+rewinddir() attempted on invalid dirhandle $foo at - line 17.
+closedir() attempted on invalid dirhandle $foo at - line 18.
+########
+
+# pp_sys.c [pp_*dir]
+use Config ;
+BEGIN {
+ if ( ! $Config{d_telldir}) {
+ print <<EOM ;
+SKIPPED
+# telldir not present
+EOM
+ exit
+ }
+}
+#line 3
+use utf8;
+use open qw( :utf8 :std );
+use warnings 'io';
+opendir FOO, ".";
+opendir $foo, ".";
+opendir FOO, ".";
+opendir $foo, ".";
+closedir FOO;
+closedir $foo;
+
+readdir(FOO);
+telldir(FOO);
+seekdir(FOO, 0);
+rewinddir(FOO);
+closedir(FOO);
+
+readdir($foo);
+telldir($foo);
+seekdir($foo, 0);
+rewinddir($foo);
+closedir($foo);
+
+EXPECT
+readdir() attempted on invalid dirhandle FOO at - line 13.
+telldir() attempted on invalid dirhandle FOO at - line 14.
+seekdir() attempted on invalid dirhandle FOO at - line 15.
+rewinddir() attempted on invalid dirhandle FOO at - line 16.
+closedir() attempted on invalid dirhandle FOO at - line 17.
+readdir() attempted on invalid dirhandle $foo at - line 19.
+telldir() attempted on invalid dirhandle $foo at - line 20.
+seekdir() attempted on invalid dirhandle $foo at - line 21.
+rewinddir() attempted on invalid dirhandle $foo at - line 22.
+closedir() attempted on invalid dirhandle $foo at - line 23.