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