Merge lp:~lifeless/bzr/zero-length-writes-1 into lp:~bzr/bzr/trunk-old

Proposed by Robert Collins
Status: Merged
Merged at revision: not available
Proposed branch: lp:~lifeless/bzr/zero-length-writes-1
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: None lines
To merge this branch: bzr merge lp:~lifeless/bzr/zero-length-writes-1
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+7836@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Tweaked version of Jam's fix for bug 162930, writing 0 length files to
local transports.

No tests, we can't really test portably.

-Rob

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> Robert Collins has proposed merging lp:~lifeless/bzr/zero-length-writes-1 into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
> Tweaked version of Jam's fix for bug 162930, writing 0 length files to
> local transports.
>
> No tests, we can't really test portably.
>
> -Rob
>
>

 vote approve
 review: approve

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpCU/YACgkQJdeBCYSNAAO+cwCgqy85IUUI6fKRX/SLUo84fwve
Jq8AnjNxoGKm5ESse+dYpQ5PZs76CMqg
=cd/4
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/transport/local.py'
2--- bzrlib/transport/local.py 2009-03-23 14:59:43 +0000
3+++ bzrlib/transport/local.py 2009-06-23 01:59:20 +0000
4@@ -204,7 +204,8 @@
5 except (IOError, OSError),e:
6 self._translate_error(e, path)
7 try:
8- fp.write(bytes)
9+ if bytes:
10+ fp.write(bytes)
11 fp.commit()
12 finally:
13 fp.close()
14@@ -285,7 +286,8 @@
15 def put_bytes_non_atomic(self, relpath, bytes, mode=None,
16 create_parent_dir=False, dir_mode=None):
17 def writer(fd):
18- os.write(fd, bytes)
19+ if bytes:
20+ os.write(fd, bytes)
21 self._put_non_atomic_helper(relpath, writer, mode=mode,
22 create_parent_dir=create_parent_dir,
23 dir_mode=dir_mode)
24@@ -370,7 +372,8 @@
25 file_abspath, fd = self._get_append_file(relpath, mode=mode)
26 try:
27 result = self._check_mode_and_size(file_abspath, fd, mode=mode)
28- os.write(fd, bytes)
29+ if bytes:
30+ os.write(fd, bytes)
31 finally:
32 os.close(fd)
33 return result
34