Merge lp:~mbp/bzr/341535-eintr into lp:bzr/2.0

Proposed by Martin Pool
Status: Merged
Approved by: Andrew Bennetts
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mbp/bzr/341535-eintr
Merge into: lp:bzr/2.0
Diff against target: 137 lines (has conflicts)
Text conflict in NEWS
To merge this branch: bzr merge lp:~mbp/bzr/341535-eintr
Reviewer Review Type Date Requested Status
Andrew Bennetts Approve
Review via email: mp+11029@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

Handle EINTR in ssh more robustly - see comments in bug 341535

I should probably also mention in NEWS the problem that C-\ tends to kill ssh.

Revision history for this message
Andrew Bennetts (spiv) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-08-31 00:25:33 +0000
+++ NEWS 2009-09-02 02:35:10 +0000
@@ -6,12 +6,13 @@
6.. contents:: List of Releases6.. contents:: List of Releases
7 :depth: 17 :depth: 1
88
9bzr 2.0rc29bzr 2.0rc2 (not released yet)
10##########10#############################
1111
12Bug Fixes12Bug Fixes
13*********13*********
1414
15<<<<<<< TREE
15* ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no16* ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no
16 longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``17 longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
17 (Robert Collins, #416732)18 (Robert Collins, #416732)
@@ -29,6 +30,15 @@
2930
30* The main table of contents now provides links to the new Migration Docs31* The main table of contents now provides links to the new Migration Docs
31 and Plugins Guide. (Ian Clatworthy)32 and Plugins Guide. (Ian Clatworthy)
33=======
34* Fix a potential segmentation fault when doing 'log' of a branch that had
35 ghosts in its mainline. (Evaluating None as a tuple is bad.)
36 (John Arbash Meinel, #419241)
37>>>>>>> MERGE-SOURCE
38
39* SmartMedium now correctly handles EINTR, which most noticeably occurs
40 if a smart server operation is interrupted by the debugger.
41 (Martin Pool, #341535)
3242
3343
34bzr 2.0rc144bzr 2.0rc1
3545
=== modified file 'bzrlib/smart/medium.py'
--- bzrlib/smart/medium.py 2009-08-07 05:56:29 +0000
+++ bzrlib/smart/medium.py 2009-09-02 02:35:10 +0000
@@ -291,7 +291,7 @@
291 def terminate_due_to_error(self):291 def terminate_due_to_error(self):
292 # TODO: This should log to a server log file, but no such thing292 # TODO: This should log to a server log file, but no such thing
293 # exists yet. Andrew Bennetts 2006-09-29.293 # exists yet. Andrew Bennetts 2006-09-29.
294 self.socket.close()294 osutils.until_no_eintr(self.socket.close)
295 self.finished = True295 self.finished = True
296296
297 def _write_out(self, bytes):297 def _write_out(self, bytes):
@@ -326,27 +326,27 @@
326 bytes_to_read = protocol.next_read_size()326 bytes_to_read = protocol.next_read_size()
327 if bytes_to_read == 0:327 if bytes_to_read == 0:
328 # Finished serving this request.328 # Finished serving this request.
329 self._out.flush()329 osutils.until_no_eintr(self._out.flush)
330 return330 return
331 bytes = self.read_bytes(bytes_to_read)331 bytes = self.read_bytes(bytes_to_read)
332 if bytes == '':332 if bytes == '':
333 # Connection has been closed.333 # Connection has been closed.
334 self.finished = True334 self.finished = True
335 self._out.flush()335 osutils.until_no_eintr(self._out.flush)
336 return336 return
337 protocol.accept_bytes(bytes)337 protocol.accept_bytes(bytes)
338338
339 def _read_bytes(self, desired_count):339 def _read_bytes(self, desired_count):
340 return self._in.read(desired_count)340 return osutils.until_no_eintr(self._in.read, desired_count)
341341
342 def terminate_due_to_error(self):342 def terminate_due_to_error(self):
343 # TODO: This should log to a server log file, but no such thing343 # TODO: This should log to a server log file, but no such thing
344 # exists yet. Andrew Bennetts 2006-09-29.344 # exists yet. Andrew Bennetts 2006-09-29.
345 self._out.close()345 osutils.until_no_eintr(self._out.close)
346 self.finished = True346 self.finished = True
347347
348 def _write_out(self, bytes):348 def _write_out(self, bytes):
349 self._out.write(bytes)349 osutils.until_no_eintr(self._out.write, bytes)
350350
351351
352class SmartClientMediumRequest(object):352class SmartClientMediumRequest(object):
@@ -712,16 +712,16 @@
712712
713 def _accept_bytes(self, bytes):713 def _accept_bytes(self, bytes):
714 """See SmartClientStreamMedium.accept_bytes."""714 """See SmartClientStreamMedium.accept_bytes."""
715 self._writeable_pipe.write(bytes)715 osutils.until_no_eintr(self._writeable_pipe.write, bytes)
716 self._report_activity(len(bytes), 'write')716 self._report_activity(len(bytes), 'write')
717717
718 def _flush(self):718 def _flush(self):
719 """See SmartClientStreamMedium._flush()."""719 """See SmartClientStreamMedium._flush()."""
720 self._writeable_pipe.flush()720 osutils.until_no_eintr(self._writeable_pipe.flush)
721721
722 def _read_bytes(self, count):722 def _read_bytes(self, count):
723 """See SmartClientStreamMedium._read_bytes."""723 """See SmartClientStreamMedium._read_bytes."""
724 bytes = self._readable_pipe.read(count)724 bytes = osutils.until_no_eintr(self._readable_pipe.read, count)
725 self._report_activity(len(bytes), 'read')725 self._report_activity(len(bytes), 'read')
726 return bytes726 return bytes
727727
@@ -765,15 +765,15 @@
765 def _accept_bytes(self, bytes):765 def _accept_bytes(self, bytes):
766 """See SmartClientStreamMedium.accept_bytes."""766 """See SmartClientStreamMedium.accept_bytes."""
767 self._ensure_connection()767 self._ensure_connection()
768 self._write_to.write(bytes)768 osutils.until_no_eintr(self._write_to.write, bytes)
769 self._report_activity(len(bytes), 'write')769 self._report_activity(len(bytes), 'write')
770770
771 def disconnect(self):771 def disconnect(self):
772 """See SmartClientMedium.disconnect()."""772 """See SmartClientMedium.disconnect()."""
773 if not self._connected:773 if not self._connected:
774 return774 return
775 self._read_from.close()775 osutils.until_no_eintr(self._read_from.close)
776 self._write_to.close()776 osutils.until_no_eintr(self._write_to.close)
777 self._ssh_connection.close()777 self._ssh_connection.close()
778 self._connected = False778 self._connected = False
779779
@@ -802,7 +802,7 @@
802 if not self._connected:802 if not self._connected:
803 raise errors.MediumNotConnected(self)803 raise errors.MediumNotConnected(self)
804 bytes_to_read = min(count, _MAX_READ_SIZE)804 bytes_to_read = min(count, _MAX_READ_SIZE)
805 bytes = self._read_from.read(bytes_to_read)805 bytes = osutils.until_no_eintr(self._read_from.read, bytes_to_read)
806 self._report_activity(len(bytes), 'read')806 self._report_activity(len(bytes), 'read')
807 return bytes807 return bytes
808808
@@ -832,7 +832,7 @@
832 """See SmartClientMedium.disconnect()."""832 """See SmartClientMedium.disconnect()."""
833 if not self._connected:833 if not self._connected:
834 return834 return
835 self._socket.close()835 osutils.until_no_eintr(self._socket.close)
836 self._socket = None836 self._socket = None
837 self._connected = False837 self._connected = False
838838

Subscribers

People subscribed via source and target branches