Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information