In perl.git, the branch smoke-me/destroio has been created
<http://perl5.git.perl.org/perl.git/commitdiff/e4dde78e33f8b47fef60481660d76c098623e12d?hp=0000000000000000000000000000000000000000>
at e4dde78e33f8b47fef60481660d76c098623e12d (commit)
- Log -----------------------------------------------------------------
commit e4dde78e33f8b47fef60481660d76c098623e12d
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 70e0e717198997c497b216625a390e91078e5ca7
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 ba5be1e6958b409613c3ff7c5f8a6dfddc467b33
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 3dcfc12d63b6eee26159c427328cdee86280c133
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 fef951264efe03077c420dac6680bc65d2fd7ec6
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 8a91136884e40668f9ae578311ff096d49f57a07
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