1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
|
pp_sys.c AOK
untie attempted while %d inner references still exist [pp_untie]
sub TIESCALAR { bless [] } ; tie $a, 'main'; untie $a ;
fileno() on unopened filehandle abc [pp_fileno]
$a = "abc"; fileno($a)
binmode() on unopened filehandle abc [pp_binmode]
$a = "abc"; fileno($a)
printf() on unopened filehandle abc [pp_prtf]
$a = "abc"; printf $a "fred"
Filehandle %s opened only for input [pp_leavewrite]
format STDIN =
.
write STDIN;
write() on closed filehandle %s [pp_leavewrite]
format STDIN =
.
close STDIN;
write STDIN ;
page overflow [pp_leavewrite]
printf() on unopened filehandle abc [pp_prtf]
$a = "abc"; printf $a "fred"
Filehandle %s opened only for input [pp_prtf]
$a = "abc";
printf $a "fred"
printf() on closed filehandle %s [pp_prtf]
close STDIN ;
printf STDIN "fred"
syswrite() on closed filehandle %s [pp_send]
close STDIN;
syswrite STDIN, "fred", 1;
send() on closed socket %s [pp_send]
close STDIN;
send STDIN, "fred", 1
bind() on closed socket %s [pp_bind]
close STDIN;
bind STDIN, "fred" ;
connect() on closed socket %s [pp_connect]
close STDIN;
connect STDIN, "fred" ;
listen() on closed socket %s [pp_listen]
close STDIN;
listen STDIN, 2;
accept() on closed socket %s [pp_accept]
close STDIN;
accept "fred", STDIN ;
shutdown() on closed socket %s [pp_shutdown]
close STDIN;
shutdown STDIN, 0;
setsockopt() on closed socket %s [pp_ssockopt]
getsockopt() on closed socket %s [pp_ssockopt]
close STDIN;
setsockopt STDIN, 1,2,3;
getsockopt STDIN, 1,2;
getsockname() on closed socket %s [pp_getpeername]
getpeername() on closed socket %s [pp_getpeername]
close STDIN;
getsockname STDIN;
getpeername STDIN;
flock() on closed socket %s [pp_flock]
flock() on closed socket [pp_flock]
close STDIN;
flock STDIN, 8;
flock $a, 8;
warn(warn_nl, "stat"); [pp_stat]
-T on closed filehandle %s
stat() on closed filehandle %s
close STDIN ; -T STDIN ; stat(STDIN) ;
warn(warn_nl, "open"); [pp_fttext]
-T "abc\ndef" ;
Filehandle %s opened only for output [pp_sysread]
my $file = "./xcv" ;
open(F, ">$file") ;
my $a = sysread(F, $a,10) ;
lstat on filehandle %s [pp_lstat]
getc() on unopened filehandle [pp_getc]
getc() on closed filehandle [pp_getc]
Non-string passed as bitmask [pp_sselect]
%s too large [pp_gmtime]
%s failed [pp_gmtime]
__END__
# pp_sys.c [pp_untie]
use warnings 'untie' ;
sub TIESCALAR { bless [] } ;
$b = tie $a, 'main';
untie $a ;
no warnings 'untie' ;
$c = tie $d, 'main';
untie $d ;
EXPECT
untie attempted while 1 inner references still exist at - line 5.
########
# pp_sys.c [pp_leavewrite]
use warnings 'io' ;
format STDIN =
.
write STDIN;
no warnings 'io' ;
write STDIN;
EXPECT
Filehandle STDIN opened only for input at - line 5.
########
# pp_sys.c [pp_leavewrite]
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 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
.
format STDOUT =
def
ghi
.
$= = 1 ;
$- =1 ;
open STDOUT, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ;
write ;
no warnings 'io' ;
write ;
EXPECT
page overflow at - line 13.
########
# pp_sys.c [pp_prtf]
use warnings 'unopened' ;
$a = "abc";
printf $a "fred";
no warnings 'unopened' ;
printf $a "fred";
EXPECT
printf() on unopened filehandle abc at - line 4.
########
# pp_sys.c [pp_prtf]
use warnings 'closed' ;
close STDIN ;
printf STDIN "fred";
opendir STDIN, ".";
printf STDIN "fred";
closedir STDIN;
no warnings 'closed' ;
printf STDIN "fred";
opendir STDIN, ".";
printf STDIN "fred";
EXPECT
printf() on closed filehandle STDIN at - line 4.
printf() on closed filehandle STDIN at - line 6.
(Are you trying to call printf() on dirhandle STDIN?)
########
# pp_sys.c [pp_prtf]
use warnings 'io' ;
printf STDIN "fred";
no warnings 'io' ;
printf STDIN "fred";
EXPECT
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;
opendir STDIN, ".";
syswrite STDIN, "fred", 1;
closedir STDIN;
no warnings 'closed' ;
syswrite STDIN, "fred", 1;
opendir STDIN, ".";
syswrite STDIN, "fred", 1;
EXPECT
syswrite() on closed filehandle STDIN at - line 4.
syswrite() on closed filehandle STDIN at - line 6.
(Are you trying to call syswrite() on dirhandle STDIN?)
########
# pp_sys.c [pp_flock]
use Config;
BEGIN {
if ( !$Config{d_flock} &&
!$Config{d_fcntl_can_lock} &&
!$Config{d_lockf} ) {
print <<EOM ;
SKIPPED
# flock not present
EOM
exit ;
}
}
use warnings qw(unopened closed);
close STDIN;
flock STDIN, 8;
opendir STDIN, ".";
flock STDIN, 8;
flock FOO, 8;
flock $a, 8;
no warnings qw(unopened closed);
flock STDIN, 8;
opendir STDIN, ".";
flock STDIN, 8;
flock FOO, 8;
flock $a, 8;
EXPECT
flock() on closed filehandle STDIN at - line 16.
flock() on closed filehandle STDIN at - line 18.
(Are you trying to call flock() on dirhandle STDIN?)
flock() on unopened filehandle FOO at - line 19.
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 'closed';
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 'closed';
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 closed socket STDIN at - line 22.
bind() on closed socket STDIN at - line 23.
connect() on closed socket STDIN at - line 24.
listen() on closed socket STDIN at - line 25.
accept() on closed socket STDIN at - line 26.
shutdown() on closed socket STDIN at - line 27.
setsockopt() on closed socket STDIN at - line 28.
getsockopt() on closed socket STDIN at - line 29.
getsockname() on closed socket STDIN at - line 30.
getpeername() on closed socket STDIN at - line 31.
send() on closed socket STDIN at - line 33.
(Are you trying to call send() on dirhandle STDIN?)
bind() on closed socket STDIN at - line 34.
(Are you trying to call bind() on dirhandle STDIN?)
connect() on closed socket STDIN at - line 35.
(Are you trying to call connect() on dirhandle STDIN?)
listen() on closed socket STDIN at - line 36.
(Are you trying to call listen() on dirhandle STDIN?)
accept() on closed socket STDIN at - line 37.
(Are you trying to call accept() on dirhandle STDIN?)
shutdown() on closed socket STDIN at - line 38.
(Are you trying to call shutdown() on dirhandle STDIN?)
setsockopt() on closed socket STDIN at - line 39.
(Are you trying to call setsockopt() on dirhandle STDIN?)
getsockopt() on closed socket STDIN at - line 40.
(Are you trying to call getsockopt() on dirhandle STDIN?)
getsockname() on closed socket STDIN at - line 41.
(Are you trying to call getsockname() on dirhandle STDIN?)
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 4.
Unsuccessful stat on filename containing newline at - line 5.
########
# pp_sys.c [pp_fttext]
use warnings qw(unopened closed) ;
close STDIN ;
-T STDIN ;
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 4.
Unsuccessful open on filename containing newline at - line 5.
########
# pp_sys.c [pp_sysread]
use warnings 'io' ;
if ($^O eq 'dos') {
print <<EOM ;
SKIPPED
# skipped on dos
EOM
exit ;
}
my $file = "./xcv" ;
open(F, ">$file") ;
binmode F;
my $a = sysread(F, $a,10) ;
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 13.
sysread() on closed filehandle F at - line 18.
read() on closed filehandle F at - line 19.
sysread() on unopened filehandle NONEXISTENT at - line 20.
read() on unopened filehandle NONEXISTENT at - line 21.
########
# pp_sys.c [pp_binmode]
use warnings 'unopened' ;
binmode(BLARG);
$a = "BLERG";binmode($a);
EXPECT
binmode() on unopened filehandle BLARG at - line 3.
binmode() on unopened filehandle at - line 4.
########
# pp_sys.c [pp_lstat]
use warnings 'io';
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 FH;
lstat $fh;
close FH;
close $fh;
EXPECT
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 FOO;
close STDIN;
getc STDIN;
# Create an empty file
$file = 'getcwarn.tmp';
open FH1, ">$file" or die "# $!"; close FH1;
open FH2, $file or die "# $!";
getc FH2; # Should not warn at EOF
close FH2;
getc FH2; # Warns, now
unlink $file;
no warnings qw(unopened closed) ;
getc FOO;
getc STDIN;
getc FH2;
EXPECT
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.
########
# pp_sys.c [pp_gmtime]
use Config;
unless ($Config{d_double_has_nan}) {
print <<EOM ;
SKIPPED
# No nan support
EOM
exit ;
}
gmtime("NaN");
localtime("NaN");
use warnings "overflow";
gmtime("NaN");
localtime("NaN");
EXPECT
gmtime(NaN) too large at - line 14.
gmtime(NaN) failed at - line 14.
localtime(NaN) too large at - line 15.
localtime(NaN) failed at - line 15.
########
# pp_sys.c [pp_alarm]
alarm(-1);
no warnings "misc";
alarm(-1);
EXPECT
alarm() with negative argument at - line 2.
########
# pp_sys.c [pp_sleep]
sleep(-1);
no warnings "misc";
sleep(-1);
EXPECT
sleep() with negative argument at - line 2.
########
# NAME sysread() deprecated on :utf8
use warnings 'deprecated';
open my $fh, "<:raw", "../harness" or die "# $!";
my $buf;
sysread $fh, $buf, 10;
binmode $fh, ':utf8';
sysread $fh, $buf, 10;
EXPECT
sysread() is deprecated on :utf8 handles at - line 6.
########
# NAME syswrite() deprecated on :utf8
my $file = "syswwarn.tmp";
use warnings 'deprecated';
open my $fh, ">:raw", $file or die "# $!";
syswrite $fh, 'ABC';
binmode $fh, ':utf8';
syswrite $fh, 'ABC';
close $fh;
unlink $file;
EXPECT
syswrite() is deprecated on :utf8 handles at - line 6.
|