1  doio.c
2
3  Can't open bidirectional pipe		[Perl_do_open9]
4    open(F, "| true |");
5
6  Missing command in piped open		[Perl_do_open9]
7    open(F, "| ");
8
9  Missing command in piped open		[Perl_do_open9]
10    open(F, " |");
11
12  warn(warn_nl, "open");		[Perl_do_open9]
13    open(F, "true\ncd")
14
15  close() on unopened filehandle %s	[Perl_do_close]
16    $a = "fred";close("$a")
17
18  tell() on closed filehandle		[Perl_do_tell]
19    $a = "fred";$a = tell($a)
20
21  seek() on closed filehandle		[Perl_do_seek]
22    $a = "fred";$a = seek($a,1,1)
23
24  sysseek() on closed filehandle	[Perl_do_sysseek]
25    $a = "fred";$a = seek($a,1,1)
26
27  warn(warn_uninit);			[Perl_do_print]
28    print $a ;
29
30  -x on closed filehandle %s 		[Perl_my_stat]
31    close STDIN ; -x STDIN ;
32
33  warn(warn_nl, "stat");		[Perl_my_stat]
34    stat "ab\ncd"
35
36  warn(warn_nl, "lstat");		[Perl_my_lstat]
37    lstat "ab\ncd"
38
39  Use of -l on filehandle %s		[Perl_my_lstat]
40
41  Can't exec \"%s\": %s 		[Perl_do_aexec5]
42
43  Can't exec \"%s\": %s 		[Perl_do_exec3]
44
45  Filehandle %s opened only for output	[Perl_do_eof]
46	my $a = eof STDOUT
47
48  Mandatory Warnings ALL TODO
49  ------------------
50  Can't do inplace edit: %s is not a regular file	[Perl_nextargv]
51     edit a directory
52
53  Can't do inplace edit: %s would not be unique		[Perl_nextargv]
54  Can't rename %s to %s: %s, skipping file		[Perl_nextargv]
55  Can't rename %s to %s: %s, skipping file		[Perl_nextargv]
56  Can't remove %s: %s, skipping file			[Perl_nextargv]
57  Can't do inplace edit on %s: %s			[Perl_nextargv]
58
59
60__END__
61# doio.c [Perl_do_open9]
62use warnings 'io' ;
63open(F, '|'."$^X -e 1|");
64close(F);
65no warnings 'io' ;
66open(G, '|'."$^X -e 1|");
67close(G);
68EXPECT
69Can't open bidirectional pipe at - line 3.
70########
71# doio.c [Perl_do_open9]
72use warnings 'io' ;
73open(F, "|      ");
74no warnings 'io' ;
75open(G, "|      ");
76EXPECT
77Missing command in piped open at - line 3.
78########
79# doio.c [Perl_do_open9]
80use warnings 'io' ;
81open(F, "      |");
82no warnings 'io' ;
83open(G, "      |");
84EXPECT
85Missing command in piped open at - line 3.
86########
87# doio.c [Perl_do_open9]
88use warnings 'io' ;
89open(F, "<true\ncd");
90open(G, "<truecd\n");
91open(H, "<truecd\n\0");
92no warnings 'io' ;
93open(H, "<true\ncd");
94open(I, "<truecd\n");
95open(I, "<truecd\n\0");
96EXPECT
97Unsuccessful open on filename containing newline at - line 4.
98Unsuccessful open on filename containing newline at - line 5.
99########
100# doio.c [Perl_do_close] <<TODO
101use warnings 'unopened' ;
102close "fred" ;
103no warnings 'unopened' ;
104close "joe" ;
105EXPECT
106close() on unopened filehandle fred at - line 3.
107########
108# doio.c [Perl_do_tell Perl_do_seek Perl_do_sysseek Perl_my_stat]
109use warnings 'io' ;
110close STDIN ;
111tell(STDIN);
112$a = seek(STDIN,1,1);
113$a = sysseek(STDIN,1,1);
114-x STDIN ;
115stat(STDIN) ;
116$a = "fred";
117tell($a);
118seek($a,1,1);
119sysseek($a,1,1);
120-x $a; # ok
121stat($a); # ok
122no warnings 'io' ;
123close STDIN ;
124tell(STDIN);
125$a = seek(STDIN,1,1);
126$a = sysseek(STDIN,1,1);
127-x STDIN ;
128stat(STDIN) ;
129$a = "fred";
130tell($a);
131seek($a,1,1);
132sysseek($a,1,1);
133-x $a;
134stat($a);
135EXPECT
136tell() on closed filehandle STDIN at - line 4.
137seek() on closed filehandle STDIN at - line 5.
138sysseek() on closed filehandle STDIN at - line 6.
139-x on closed filehandle STDIN at - line 7.
140stat() on closed filehandle STDIN at - line 8.
141tell() on unopened filehandle at - line 10.
142seek() on unopened filehandle at - line 11.
143sysseek() on unopened filehandle at - line 12.
144########
145# doio.c [Perl_do_print]
146use warnings 'uninitialized' ;
147print $a ;
148no warnings 'uninitialized' ;
149print $b ;
150EXPECT
151Use of uninitialized value $a in print at - line 3.
152########
153# doio.c [Perl_my_stat Perl_my_lstat]
154use warnings 'io' ;
155stat "ab\ncd";
156lstat "ab\ncd";
157stat "abcd\n";
158lstat "abcd\n";
159stat "abcd\n\0";
160lstat "abcd\n\0";
161no warnings 'io' ;
162stat "ab\ncd";
163lstat "ab\ncd";
164stat "abcd\n";
165lstat "abcd\n";
166stat "abcd\n\0";
167lstat "abcd\n\0";
168EXPECT
169Unsuccessful stat on filename containing newline at - line 5.
170Unsuccessful stat on filename containing newline at - line 6.
171Unsuccessful stat on filename containing newline at - line 7.
172Unsuccessful stat on filename containing newline at - line 8.
173########
174# doio.c [Perl_my_stat]
175use warnings 'io';
176-l STDIN;
177-l $fh;
178open $fh, $0 or die "# $!";
179-l $fh;
180no warnings 'io';
181-l STDIN;
182-l $fh;
183close $fh;
184EXPECT
185Use of -l on filehandle STDIN at - line 3.
186Use of -l on filehandle $fh at - line 6.
187########
188# doio.c [Perl_my_stat]
189use utf8;
190use open qw( :utf8 :std );
191use warnings 'io';
192-l ᶠᚻ;
193no warnings 'io';
194-l ᶠᚻ;
195EXPECT
196Use of -l on filehandle ᶠᚻ at - line 5.
197########
198# doio.c [Perl_do_aexec5]
199use warnings 'io' ;
200exec "lskdjfalksdjfdjfkls","" ;
201no warnings 'io' ;
202exec "lskdjfalksdjfdjfkls","" ;
203EXPECT
204OPTION regex
205Statement unlikely to be reached at - line .+
206	\(Maybe you meant system\(\) when you said exec\(\)\?\)
207Can't exec "lskdjfalksdjfdjfkls": .+
208########
209# doio.c [Perl_do_exec3]
210use warnings 'io' ;
211exec "lskdjfalksdjfdjfkls", "abc" ;
212no warnings 'io' ;
213exec "lskdjfalksdjfdjfkls", "abc" ;
214EXPECT
215OPTION regex
216Statement unlikely to be reached at - line .+
217	\(Maybe you meant system\(\) when you said exec\(\)\?\)
218Can't exec "lskdjfalksdjfdjfkls(:? abc)?": .+
219########
220# doio.c [win32_execvp]
221use warnings 'exec' ;
222exec $^X, "-e0" ;
223EXPECT
224########
225# doio.c [Perl_nextargv]
226$^W = 0 ;
227# These happen to warn at different points within doio.c
228# This will open read only, and then be caught by an explicit check:
229my $filename = "./temp.dir" ;
230# Whereas these two will fail to open:
231my $dir0 = "./zero.dir" ;
232# but files and directories have a different error message if they don't open:
233my $file3 = "date|" ;
234mkdir $filename, 0777
235  or die "Cannot create directory $filename: $!\n" ;
236mkdir $dir0, 0
237  or die "Cannot create directory dir0: $!\n" ;
238{
239    local (@ARGV) = ($filename, $dir0, $file3) ;
240    local ($^I) = "" ;
241    my $x = <> ;
242}
243{
244    no warnings 'inplace' ;
245    local (@ARGV) = ($filename, $dir0, $file3) ;
246    local ($^I) = "" ;
247    my $x = <> ;
248}
249{
250    use warnings 'inplace' ;
251    local (@ARGV) = ($filename, $dir0, $file3) ;
252    local ($^I) = "" ;
253    my $x = <> ;
254}
255rmdir $filename ;
256chmod 0777, $dir0 ;
257rmdir $dir0 ;
258EXPECT
259OPTION regex
260Can't do inplace edit: \./temp\.dir is not a regular file at - line 17\.
261Can't do inplace edit: \./zero\.dir is not a regular file at - line 17\.
262Can't open date\|: .*? at - line 17\.
263Can't do inplace edit: \./temp\.dir is not a regular file at - line 29\.
264Can't do inplace edit: \./zero\.dir is not a regular file at - line 29\.
265Can't open date\|: .*? at - line 29\.
266########
267# doio.c [Perl_do_eof]
268use warnings 'io' ;
269my $a = eof STDOUT ;
270no warnings 'io' ;
271$a = eof STDOUT ;
272EXPECT
273Filehandle STDOUT opened only for output at - line 3.
274########
275# doio.c [Perl_do_openn]
276use Config;
277BEGIN {
278    if ($Config{useperlio}) {
279	print <<EOM;
280SKIPPED
281# warns only without perlio
282EOM
283	exit;
284    }
285}
286use warnings 'io';
287my $x = "foo";
288open FOO, '>', \$x;
289open BAR, '>&', \*STDOUT; # should not warn
290no warnings 'io';
291open FOO, '>', \$x;
292EXPECT
293Can't open a reference at - line 14.
294########
295# doio.c [Perl_do_openn]
296use Config;
297BEGIN {
298    if (!$Config{useperlio}) {
299	print <<EOM;
300SKIPPED
301# warns only with perlio
302EOM
303	exit;
304    }
305}
306use warnings 'io' ;
307close STDOUT;
308open FH1, "../harness"; close FH1;
309no warnings 'io' ;
310open FH2, "../harness"; close FH2;
311EXPECT
312Filehandle STDOUT reopened as FH1 only for input at - line 14.
313########
314# doio.c [Perl_do_openn]
315use Config;
316use utf8;
317use open qw( :utf8 :std );
318BEGIN {
319    if (!$Config{useperlio}) {
320	print <<EOM;
321SKIPPED
322# warns only with perlio
323EOM
324	exit;
325    }
326}
327use warnings 'io' ;
328close STDOUT;
329open ᶠᚻ1, "../harness"; close ᶠᚻ1;
330no warnings 'io' ;
331open ᶠᚻ2, "../harness"; close ᶠᚻ2;
332EXPECT
333Filehandle STDOUT reopened as ᶠᚻ1 only for input at - line 16.
334########
335# doio.c [Perl_do_openn]
336use Config;
337BEGIN {
338    if (!$Config{useperlio}) {
339	print <<EOM;
340SKIPPED
341# warns only with perlio
342EOM
343	exit;
344    }
345}
346use warnings 'io' ;
347close STDIN;
348open my $fh1, ">doiowarn.tmp"; close $fh1;
349no warnings 'io' ;
350open my $fh2, ">doiowarn.tmp"; close $fh2;
351unlink "doiowarn.tmp";
352EXPECT
353Filehandle STDIN reopened as $fh1 only for output at - line 14.
354########
355# doio.c [Perl_do_openn]
356use Config;
357use utf8;
358use open qw( :utf8 :std );
359BEGIN {
360    if (!$Config{useperlio}) {
361	print <<EOM;
362SKIPPED
363# warns only with perlio
364EOM
365	exit;
366    }
367}
368use warnings 'io' ;
369close STDIN;
370open my $ᶠᚻ1, ">doiowarn.tmp"; close $ᶠᚻ1;
371no warnings 'io' ;
372open my $ᶠᚻ2, ">doiowarn.tmp"; close $ᶠᚻ2;
373unlink "doiowarn.tmp";
374EXPECT
375Filehandle STDIN reopened as $ᶠᚻ1 only for output at - line 16.
376########
377# doio.c [Perl_do_openn]
378use Config;
379use utf8;
380use open qw( :utf8 :std );
381BEGIN {
382    if (!$Config{useperlio}) {
383	print <<EOM;
384SKIPPED
385# warns only with perlio
386EOM
387	exit;
388    }
389}
390use warnings 'io' ;
391close STDIN;
392open ᶠᚻ1, ">doiowarn.tmp"; close ᶠᚻ1;
393no warnings 'io' ;
394open ᶠᚻ2, ">doiowarn.tmp"; close ᶠᚻ2;
395unlink "doiowarn.tmp";
396EXPECT
397Filehandle STDIN reopened as ᶠᚻ1 only for output at - line 16.
398########
399open(my $i, "foo\0bar");
400use warnings 'io';
401open(my $i, "foo\0bar");
402EXPECT
403Invalid \0 character in pathname for open: foo\0bar at - line 3.
404########
405chmod(0, "foo\0bar");
406use warnings 'io';
407chmod(0, "foo\0bar");
408EXPECT
409Invalid \0 character in pathname for chmod: foo\0bar at - line 3.
410########
411unlink("foo\0bar", "foo\0bar2");
412use warnings 'io';
413unlink("foo\0bar", "foo\0bar2");
414EXPECT
415Invalid \0 character in pathname for unlink: foo\0bar at - line 3.
416Invalid \0 character in pathname for unlink: foo\0bar2 at - line 3.
417########
418utime(-1, -1, "foo\0bar", "foo\0bar2");
419use warnings 'io';
420utime(-1, -1, "foo\0bar", "foo\0bar2");
421EXPECT
422Invalid \0 character in pathname for utime: foo\0bar at - line 3.
423Invalid \0 character in pathname for utime: foo\0bar2 at - line 3.
424########
425my @foo = glob "foo\0bar";
426use warnings 'io';
427my @bar = glob "foo\0bar";
428EXPECT
429Invalid \0 character in pattern for glob: foo\0bar at - line 3.
430