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