Subject: | write_file() errors like disk full |
Date: | Mon, 22 Apr 2019 10:27:32 +1000 |
To: | bug-File-Slurp [...] rt.cpan.org |
From: | Kevin Ryde <user42_kevin [...] yahoo.com.au> |
It'd be good if write_file() reported errors writing its output data,
instead of always saying success. For example on disk full a write will
be either incomplete or fail totally and would like to know that.
When have sparse files, writing disk full comes out the right size due
to the truncate(), but is all 0 bytes.
In the code, perhaps print() and close() could have returns checked and
go to the err_mode handing.
I think, as a matter of compatibility, truncate() should not have its
return checked. When write a char special like a tty or /dev/null,
truncate() will usually give EINVAL. That's only because no notion of
length there, not an actual problem. I can imagine write_file() used to
devices and don't want to break that. Any real problems ought to show
up from print and close.