Skip Menu |

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 63318
Status: resolved
Priority: 0/
Queue: File-Slurp

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

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



Subject: "atomic" temp file on write error
Date: Thu, 25 Nov 2010 11:40:56 +1100
To: bug-File-Slurp [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
Nosing around File::Slurp 9999.13 I wondered if write_file() "atomic" mode may leave behind its temp file if it encounters a syswrite() error. The pod notes it may be left behind on various crashes or interrupts but I think it could helpfully be cleaned up for an error detected within write_file(). I suppose one possibility might be letting File::Temp or a similar scope-guarded thingie delete the file if not successfully reaching the rename stage. That might catch anything that at least goes through the normal exit().
the rename call is now error checked (and tested in t/error.t). all you need to do is wrap the write_file call in eval to trap any errors.