xref: /openbsd/gnu/usr.bin/perl/t/lib/warnings/pp_sys (revision d415bd75)
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";
579stat "abcdef\n";
580stat "abcdef\n\0";
581no warnings 'newline' ;
582stat "abc\ndef";
583stat "abcdef\n";
584stat "abcdef\n\0";
585EXPECT
586Unsuccessful stat on filename containing newline at - line 4.
587Unsuccessful stat on filename containing newline at - line 5.
588########
589# pp_sys.c [pp_fttext]
590use warnings qw(unopened closed) ;
591close STDIN ;
592-T STDIN ;
593stat(STDIN) ;
594-T HOCUS;
595stat(POCUS);
596stat "../test.pl";
597stat *foo;
598no warnings qw(unopened closed) ;
599-T STDIN ;
600stat(STDIN);
601-T HOCUS;
602stat(POCUS);
603stat "../test.pl";
604stat *foo;
605EXPECT
606-T on closed filehandle STDIN at - line 4.
607stat() on closed filehandle STDIN at - line 5.
608-T on unopened filehandle HOCUS at - line 6.
609stat() on unopened filehandle POCUS at - line 7.
610stat() on unopened filehandle foo at - line 9.
611########
612# pp_sys.c [pp_fttext]
613use warnings 'newline' ;
614-T "abc\ndef" ;
615-T "abcdef\n" ;
616-T "abcdef\n\0" ;
617no warnings 'newline' ;
618-T "abc\ndef" ;
619-T "abcdef\n" ;
620-T "abcdef\n\0" ;
621EXPECT
622Unsuccessful open on filename containing newline at - line 4.
623Unsuccessful open on filename containing newline at - line 5.
624########
625# pp_sys.c [pp_sysread]
626use warnings 'io' ;
627my $file = "./xcv" ;
628open(F, ">$file") ;
629binmode F;
630my $a = sysread(F, $a,10) ;
631no warnings 'io' ;
632my $a = sysread(F, $a,10) ;
633close F ;
634use warnings 'io' ;
635sysread(F, $a, 10);
636read(F, $a, 10);
637sysread(NONEXISTENT, $a, 10);
638read(NONEXISTENT, $a, 10);
639unlink $file ;
640EXPECT
641Filehandle F opened only for output at - line 6.
642sysread() on closed filehandle F at - line 11.
643read() on closed filehandle F at - line 12.
644sysread() on unopened filehandle NONEXISTENT at - line 13.
645read() on unopened filehandle NONEXISTENT at - line 14.
646########
647# pp_sys.c [pp_binmode]
648use warnings 'unopened' ;
649binmode(BLARG);
650$a = "BLERG";binmode($a);
651EXPECT
652binmode() on unopened filehandle BLARG at - line 3.
653binmode() on unopened filehandle at - line 4.
654########
655# pp_sys.c [pp_lstat]
656use warnings 'io';
657open FH, "../harness" or die "# $!";
658lstat FH;
659lstat *FH;
660lstat \*FH;
661open my $fh, $0 or die "# $!";
662lstat $fh;
663lstat *FH{IO};
664no warnings 'io';
665lstat FH;
666lstat $fh;
667close FH;
668close $fh;
669EXPECT
670lstat() on filehandle FH at - line 4.
671lstat() on filehandle FH at - line 5.
672lstat() on filehandle FH at - line 6.
673lstat() on filehandle $fh at - line 8.
674lstat() on filehandle at - line 9.
675########
676
677# pp_sys.c [pp_lstat]
678use warnings 'io';
679use utf8;
680use open qw( :utf8 :std );
681open ᶠḨ, "../harness" or die "# $!";
682lstat ᶠḨ;
683open my $fᚺ, $0 or die "# $!";
684lstat $fᚺ;
685no warnings 'io';
686lstat ᶠḨ;
687lstat $fᚺ;
688close ᶠḨ;
689close $fᚺ;
690EXPECT
691lstat() on filehandle ᶠḨ at - line 7.
692lstat() on filehandle $fᚺ at - line 9.
693########
694# pp_sys.c [pp_getc]
695use warnings qw(unopened closed) ;
696getc FOO;
697close STDIN;
698getc STDIN;
699# Create an empty file
700$file = 'getcwarn.tmp';
701open FH1, ">$file" or die "# $!"; close FH1;
702open FH2, $file    or die "# $!";
703getc FH2; # Should not warn at EOF
704close FH2;
705getc FH2; # Warns, now
706unlink $file;
707no warnings qw(unopened closed) ;
708getc FOO;
709getc STDIN;
710getc FH2;
711EXPECT
712getc() on unopened filehandle FOO at - line 3.
713getc() on closed filehandle STDIN at - line 5.
714getc() on closed filehandle FH2 at - line 12.
715########
716# pp_sys.c [pp_sselect]
717use warnings 'misc';
718$x = 1;
719select $x, undef, undef, 1;
720sub TIESCALAR{bless[]} sub FETCH {"hello"} sub STORE{}
721tie $y, "";
722select $y, undef, undef, 1;
723no warnings 'misc';
724select $x, undef, undef, 1;
725EXPECT
726Non-string passed as bitmask at - line 4.
727########
728use Config;
729BEGIN {
730    if (!$Config{d_fchdir}) {
731	print <<EOM;
732SKIPPED
733# fchdir not present
734EOM
735	exit;
736    }
737}
738opendir FOO, '.'; closedir FOO;
739open BAR, '.'; close BAR;
740opendir $dh, '.'; closedir $dh;
741open $fh, '.'; close $fh;
742chdir FOO;
743chdir BAR;
744chdir $dh;
745chdir $fh;
746use warnings qw(unopened closed) ;
747chdir FOO;
748chdir BAR;
749chdir $dh;
750chdir $fh;
751EXPECT
752chdir() on unopened filehandle FOO at - line 20.
753chdir() on closed filehandle BAR at - line 21.
754chdir() on unopened filehandle $dh at - line 22.
755chdir() on closed filehandle $fh at - line 23.
756########
757# pp_sys.c [pp_*dir]
758use Config ;
759BEGIN {
760    if ( ! $Config{d_telldir}) {
761        print <<EOM ;
762SKIPPED
763# telldir not present
764EOM
765        exit
766    }
767}
768#line 2
769use warnings 'io';
770opendir FOO, ".";
771opendir $foo, ".";
772closedir FOO;
773closedir $foo;
774
775readdir(FOO);
776telldir(FOO);
777seekdir(FOO, 0);
778rewinddir(FOO);
779closedir(FOO);
780
781readdir($foo);
782telldir($foo);
783seekdir($foo, 0);
784rewinddir($foo);
785closedir($foo);
786
787EXPECT
788readdir() attempted on invalid dirhandle FOO at - line 8.
789telldir() attempted on invalid dirhandle FOO at - line 9.
790seekdir() attempted on invalid dirhandle FOO at - line 10.
791rewinddir() attempted on invalid dirhandle FOO at - line 11.
792closedir() attempted on invalid dirhandle FOO at - line 12.
793readdir() attempted on invalid dirhandle $foo at - line 14.
794telldir() attempted on invalid dirhandle $foo at - line 15.
795seekdir() attempted on invalid dirhandle $foo at - line 16.
796rewinddir() attempted on invalid dirhandle $foo at - line 17.
797closedir() attempted on invalid dirhandle $foo at - line 18.
798########
799
800# pp_sys.c [pp_*dir]
801use Config ;
802BEGIN {
803    if ( ! $Config{d_telldir}) {
804        print <<EOM ;
805SKIPPED
806# telldir not present
807EOM
808        exit
809    }
810}
811#line 3
812use utf8;
813use open qw( :utf8 :std );
814use warnings 'io';
815opendir FOO, ".";
816opendir $foo, ".";
817opendir FOO, ".";
818opendir $foo, ".";
819closedir FOO;
820closedir $foo;
821
822readdir(FOO);
823telldir(FOO);
824seekdir(FOO, 0);
825rewinddir(FOO);
826closedir(FOO);
827
828readdir($foo);
829telldir($foo);
830seekdir($foo, 0);
831rewinddir($foo);
832closedir($foo);
833
834EXPECT
835readdir() attempted on invalid dirhandle FOO at - line 13.
836telldir() attempted on invalid dirhandle FOO at - line 14.
837seekdir() attempted on invalid dirhandle FOO at - line 15.
838rewinddir() attempted on invalid dirhandle FOO at - line 16.
839closedir() attempted on invalid dirhandle FOO at - line 17.
840readdir() attempted on invalid dirhandle $foo at - line 19.
841telldir() attempted on invalid dirhandle $foo at - line 20.
842seekdir() attempted on invalid dirhandle $foo at - line 21.
843rewinddir() attempted on invalid dirhandle $foo at - line 22.
844closedir() attempted on invalid dirhandle $foo at - line 23.
845########
846
847# pp_sys.c [pp_gmtime]
848use Config;
849unless ($Config{d_double_has_nan}) {
850    print <<EOM ;
851SKIPPED
852# No nan support
853EOM
854    exit ;
855}
856gmtime("NaN");
857localtime("NaN");
858use warnings "overflow";
859gmtime("NaN");
860localtime("NaN");
861
862EXPECT
863gmtime(NaN) too large at - line 14.
864gmtime(NaN) failed at - line 14.
865localtime(NaN) too large at - line 15.
866localtime(NaN) failed at - line 15.
867
868########
869# pp_sys.c [pp_alarm]
870alarm(-1);
871no warnings "misc";
872alarm(-1);
873
874EXPECT
875alarm() with negative argument at - line 2.
876
877########
878# pp_sys.c [pp_sleep]
879sleep(-1);
880no warnings "misc";
881sleep(-1);
882
883EXPECT
884sleep() with negative argument at - line 2.
885########
886# NAME stat on name with \0
887use warnings;
888my @x = stat("./\0-");
889my @y = lstat("./\0-");
890-T ".\0-";
891-x ".\0-";
892-l ".\0-";
893EXPECT
894Invalid \0 character in pathname for stat: ./\0- at - line 2.
895Invalid \0 character in pathname for lstat: ./\0- at - line 3.
896Invalid \0 character in pathname for fttext: .\0- at - line 4.
897Invalid \0 character in pathname for fteexec: .\0- at - line 5.
898Invalid \0 character in pathname for ftlink: .\0- at - line 6.
899