Rev 4471: Tweaked version of Jam's fix for bug 162930, writing 0 length files to local transports. in http://people.ubuntu.com/~robertc/baz2.0/pending/zero-length-writes
Robert Collins
robertc at robertcollins.net
Tue Jun 23 02:59:23 BST 2009
At http://people.ubuntu.com/~robertc/baz2.0/pending/zero-length-writes
------------------------------------------------------------
revno: 4471
revision-id: robertc at robertcollins.net-20090623015920-vaouua88qdeqtflw
parent: pqm at pqm.ubuntu.com-20090623003517-lrjel82rf7q6qjlc
committer: Robert Collins <robertc at robertcollins.net>
branch nick: zero-length-writes
timestamp: Tue 2009-06-23 11:59:20 +1000
message:
Tweaked version of Jam's fix for bug 162930, writing 0 length files to local transports.
=== modified file 'bzrlib/transport/local.py'
--- a/bzrlib/transport/local.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/transport/local.py 2009-06-23 01:59:20 +0000
@@ -204,7 +204,8 @@
except (IOError, OSError),e:
self._translate_error(e, path)
try:
- fp.write(bytes)
+ if bytes:
+ fp.write(bytes)
fp.commit()
finally:
fp.close()
@@ -285,7 +286,8 @@
def put_bytes_non_atomic(self, relpath, bytes, mode=None,
create_parent_dir=False, dir_mode=None):
def writer(fd):
- os.write(fd, bytes)
+ if bytes:
+ os.write(fd, bytes)
self._put_non_atomic_helper(relpath, writer, mode=mode,
create_parent_dir=create_parent_dir,
dir_mode=dir_mode)
@@ -370,7 +372,8 @@
file_abspath, fd = self._get_append_file(relpath, mode=mode)
try:
result = self._check_mode_and_size(file_abspath, fd, mode=mode)
- os.write(fd, bytes)
+ if bytes:
+ os.write(fd, bytes)
finally:
os.close(fd)
return result
More information about the bazaar-commits
mailing list