From: Paul Brannan Date: 2003-05-08T22:40:51+09:00 Subject: Re: PStore and tempfiles - bug? On Thu, May 08, 2003 at 10:52:46AM +0900, Yukihiro Matsumoto wrote: > q1: Why is it creating a tempfile? > a1: It's not a tempfile, it's a backup file. I don't need a backup. It should be possible to turn this off. But it looks to me like it's not a backup. It looks like the file is created in case there is an exception thrown during file.truncate(); if this happens, the backup is renamed (not copied) over the original. > q2: Why isn't it removed when the program is complete? > a2: You can't remove a backup file. If you do, it's no longer a backup. ;-) There is code in pstore.rb to remove the backup file: if @abort and !orig File.unlink(@filename) end But orig is never false, so the backup never gets removed. I don't know what the author's intention was, but I'm sure unreachable code was not it. > q3: are there any potential problems associated with the tempfile or > can I safely ignore this issue? > a3: You can ignore it, until you need backup. I agree, but note that the backup file disappears if writing to the file fails. You cannot depend on its existence. Paul