]> arthur.barton.de Git - bup.git/commit
bloom-cmd.py: close open file object for tfname before attempting a rename.
authorRob Browning <rlb@defaultvalue.org>
Sun, 6 Oct 2013 19:33:35 +0000 (14:33 -0500)
committerRob Browning <rlb@defaultvalue.org>
Tue, 8 Oct 2013 21:31:29 +0000 (16:31 -0500)
commitc488f60bc18fbcf7221d7372a7eab039fea5e739
tree6e37d3c295317700f0144e6d99d98756cfc926ae
parentc3f7f6df16c889fc60d29ef71aef2319cac026b0
bloom-cmd.py: close open file object for tfname before attempting a rename.

Ben Kelly reported a an IOException (permission denied) during "bup
bloom" on Cygwin.  The exception was caused by the attempt to
os.rename(tfname, outfilename) in do_bloom().

This appears to be because Cygwin doesn't allow you to rename a file
while it's still open.  At first, we thought this might be because
bloom.py create() opens tfname, passes the resulting file to ShaBloom,
and then no one ever explicitly closes it.  So if the gc hasn't
collected the ShaBloom object before the rename, we're in trouble.

However, the problem may also have been caused by an unrelated process
scanning the file at the same time.

In any case, for the moment, explicitly close the ShaBloom object
before the rename.  That shouldn't hurt, and may help.

Thanks to Ben Kelly <btk@google.com> for the report.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/bloom-cmd.py
lib/bup/bloom.py