On 2016-05-03 05:15:38, SHLOMIF wrote:
Show quoted text> On Mon May 02 17:33:16 2016, fschlich wrote:
> > Hi,
> >
> > I'm forwarding Debian bug
https://bugs.debian.org/cgi-
> > bin/bugreport.cgi?bug=787079:
> >
> > "In our work environment we noticed that the WriteConfig method
> > doesn't check at all whether it is able to write the config data to
> > the file and renames the temporary file afterwards unconditionally.
> > This results in empty files in case the harddisk doesn't has free
> > space and thus means data loss.
> >
> > It would be good to have that fixed me thinks. :)"
>
> This is hopefully fixed in version 2.89 which checks if a print to the
> file fails.
>
> Please let me know if this is the case.
Checking the print() return value is not enough --- the writes could be buffered, and the failure may happen on the final flush. So you have also to check the return value of close().
A simple experiment using Linux' /dev/full device:
$ perl -e 'open my $ofh, ">", "/dev/full" or die $!; print $ofh "something\n" or die "print failed: $!"; close $ofh or die "close failed: $!"'
close failed: No space left on device at -e line 1.