In perl.git, the branch smoke-me/destroio has been created
<http://perl5.git.perl.org/perl.git/commitdiff/9fd882daacf51a8fd081f88e8b32c65ed58498c1?hp=0000000000000000000000000000000000000000>
at 9fd882daacf51a8fd081f88e8b32c65ed58498c1 (commit)
- Log -----------------------------------------------------------------
commit 9fd882daacf51a8fd081f88e8b32c65ed58498c1
Author: Father Chrysostomos <[email protected]>
Date: Wed Sep 17 21:16:58 2014 -0800
[perl #57512] Warnings for implicitly closed handles
If the implicit close() fails, warn about it, mentioning $! in the
message. This is a default warning in the io category.
We do this in two spots, sv_clear and gp_free. While sv_clear would
be sufficient to get the warning emitted, the warning wonât contain
the name of the handle when called from there, because lone IO thing-
ies are nameless. Doing it also when a GVâs glob pointer is freed--as
long as the IO thingy in there has a reference count of 1--allows the
name to be included in the message, because we still have the glob,
which is where the name is stored.
The result:
$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh
"x"x1000, "\n" for 1..50; undef *fh'
Warning: unable to close filehandle fh properly: No space left on device at
-e line 1.
M doio.c
M embed.fnc
M embed.h
M gv.c
M pod/perldiag.pod
M proto.h
M sv.c
M t/io/eintr.t
M t/op/lexsub.t
commit 01688c430723ea284b0dcd4dfcd454eeaf712ec3
Author: Father Chrysostomos <[email protected]>
Date: Wed Sep 17 21:42:52 2014 -0700
Have close() set $! and $^E
This is what we used to get when close reported an error after a print
failure (âDisk Imageâ is a small disk image I made):
$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh
"x"x1000, "\n" for 1..50; unlink "ntoeuhnteo"; warn $!; close fh or die "error
closing: $!"'
No such file or directory at -e line 1.
error closing: No such file or directory at -e line 1.
Notice how the value of $! as set by unlink is still present after
close fails. So that means after close returns false, you canât
depend on $! to have the reason for the failure, because it might come
from an unrelated system call. Remove the âunlinkâ statement and you
get âNo space left on deviceâ.
As of this commit, the output is more helpful:
$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh
"x"x1000, "\n" for 1..50; unlink "ntoeuhnteo"; warn $!; close fh or die "error
closing: $!"'
No such file or directory at -e line 1.
error closing: No space left on device at -e line 1.
Three commits ago, I/O errors started recording the error number in
the handle itself. Now âcloseâ restores $! and $^E to the values they
were when the I/O error associated with the closed handle occurred.
This is related to ticket #57512.
M doio.c
commit 4ffe2594cd2e9ef60470c73229442e0588a94d2f
Author: Father Chrysostomos <[email protected]>
Date: Wed Sep 17 17:55:23 2014 -0700
Increase $PerlIO::encoding::VERSION to 0.20
M ext/PerlIO-encoding/encoding.pm
commit 48a22192caad5eb3afbedfd46fbc1001fed5f17e
Author: Father Chrysostomos <[email protected]>
Date: Wed Sep 17 17:55:10 2014 -0700
Increase $PerlIO::scalar::VERSION to 0.20
M ext/PerlIO-scalar/scalar.pm
commit c8ba6b8ae542e8e32f015d4ce77973a71ca0ad79
Author: Father Chrysostomos <[email protected]>
Date: Tue Sep 16 18:14:34 2014 -0700
Record errno value in IO handles
M embed.fnc
M embed.h
M ext/PerlIO-encoding/encoding.xs
M ext/PerlIO-scalar/scalar.xs
M makedef.pl
M perlio.c
M perliol.h
M proto.h
M win32/win32ceio.c
M win32/win32io.c
commit fcf44085fa8b004c48c1a618c1fc7955762db884
Author: Father Chrysostomos <[email protected]>
Date: Tue Sep 16 17:58:50 2014 -0700
perliol.pod: Correct flags type in _PerlIO struct
This is not the only change that was not reflected in the docs. There
is also a PerlIOl *head member, but I donât know whether this should
be considered public and documented.
M pod/perliol.pod
-----------------------------------------------------------------------
--
Perl5 Master Repository