Skip Menu |

This queue is for tickets about the Config-IniFiles CPAN distribution.

Report information
The Basics
Id: 114140
Status: resolved
Priority: 0/
Queue: Config-IniFiles

People
Owner: Nobody in particular
Requestors: fschlich [...] zedat.fu-berlin.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.88
Fixed in: (no value)



Subject: WriteConfig nullifies the file in case of no space left on disk
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. :)"
On Mon May 02 17:33:16 2016, fschlich wrote: Show quoted text
> 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. Note however that I feel that if your hard disk runs out of free space, then Config-IniFiles failing would be the least of your worries . Make sure it doesn't happen, mmmkay?!
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.
On Sun May 15 06:24:35 2016, SREZIC wrote: Show quoted text
> On 2016-05-03 05:15:38, SHLOMIF wrote:
> > 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.
dieing on failed close()s now as well. Thanks! (3.000003).