Bazaar tries to write 0-length strings to files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
High
|
Robert Collins |
Bug Description
There are a few places where we might try to create an empty file.
Often this is done using Transport.
In either case we end up doing something like:
os.write(fd, '')
It seems that on Mac OS X, when you mount a Samba share, this fails. I'm not sure why it is the only place that doesn't like writing 0 bytes to a file.
This works around it at the Local transport layer. Such that we don't try to write a zero length string:
=== modified file 'bzrlib/
--- bzrlib/
+++ bzrlib/
@@ -185,7 +185,8 @@
except (IOError, OSError),e:
try:
- fp.write(bytes)
+ if bytes:
+ fp.write(bytes)
finally:
@@ -265,8 +266,12 @@
def put_bytes_
- def writer(fd):
- os.write(fd, bytes)
+ if bytes:
+ def writer(fd):
+ os.write(fd, bytes)
+ else:
+ def writer(fd):
+ pass #Nothing to write
Related branches
- John A Meinel: Approve
- Diff: None lines
Changed in bzr: | |
status: | Triaged → In Progress |
Changed in bzr: | |
assignee: | nobody → Robert Collins (lifeless) |
status: | In Progress → Fix Committed |
The fix seems small, though the bug only shows up under odd circumstances.