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
1=== modified file 'NEWS'
2--- NEWS 2009-08-31 00:25:33 +0000
3+++ NEWS 2009-09-02 02:35:10 +0000
4@@ -6,12 +6,13 @@
5 .. contents:: List of Releases
6 :depth: 1
7
8-bzr 2.0rc2
9-##########
10+bzr 2.0rc2 (not released yet)
11+#############################
12
13 Bug Fixes
14 *********
15
16+<<<<<<< TREE
17 * ``bzr check`` in pack-0.92, 1.6 and 1.9 format repositories will no
18 longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
19 (Robert Collins, #416732)
20@@ -29,6 +30,15 @@
21
22 * The main table of contents now provides links to the new Migration Docs
23 and Plugins Guide. (Ian Clatworthy)
24+=======
25+* Fix a potential segmentation fault when doing 'log' of a branch that had
26+ ghosts in its mainline. (Evaluating None as a tuple is bad.)
27+ (John Arbash Meinel, #419241)
28+>>>>>>> MERGE-SOURCE
29+
30+* SmartMedium now correctly handles EINTR, which most noticeably occurs
31+ if a smart server operation is interrupted by the debugger.
32+ (Martin Pool, #341535)
33
34
35 bzr 2.0rc1
36
37=== modified file 'bzrlib/smart/medium.py'
38--- bzrlib/smart/medium.py 2009-08-07 05:56:29 +0000
39+++ bzrlib/smart/medium.py 2009-09-02 02:35:10 +0000
40@@ -291,7 +291,7 @@
41 def terminate_due_to_error(self):
42 # TODO: This should log to a server log file, but no such thing
43 # exists yet. Andrew Bennetts 2006-09-29.
44- self.socket.close()
45+ osutils.until_no_eintr(self.socket.close)
46 self.finished = True
47
48 def _write_out(self, bytes):
49@@ -326,27 +326,27 @@
50 bytes_to_read = protocol.next_read_size()
51 if bytes_to_read == 0:
52 # Finished serving this request.
53- self._out.flush()
54+ osutils.until_no_eintr(self._out.flush)
55 return
56 bytes = self.read_bytes(bytes_to_read)
57 if bytes == '':
58 # Connection has been closed.
59 self.finished = True
60- self._out.flush()
61+ osutils.until_no_eintr(self._out.flush)
62 return
63 protocol.accept_bytes(bytes)
64
65 def _read_bytes(self, desired_count):
66- return self._in.read(desired_count)
67+ return osutils.until_no_eintr(self._in.read, desired_count)
68
69 def terminate_due_to_error(self):
70 # TODO: This should log to a server log file, but no such thing
71 # exists yet. Andrew Bennetts 2006-09-29.
72- self._out.close()
73+ osutils.until_no_eintr(self._out.close)
74 self.finished = True
75
76 def _write_out(self, bytes):
77- self._out.write(bytes)
78+ osutils.until_no_eintr(self._out.write, bytes)
79
80
81 class SmartClientMediumRequest(object):
82@@ -712,16 +712,16 @@
83
84 def _accept_bytes(self, bytes):
85 """See SmartClientStreamMedium.accept_bytes."""
86- self._writeable_pipe.write(bytes)
87+ osutils.until_no_eintr(self._writeable_pipe.write, bytes)
88 self._report_activity(len(bytes), 'write')
89
90 def _flush(self):
91 """See SmartClientStreamMedium._flush()."""
92- self._writeable_pipe.flush()
93+ osutils.until_no_eintr(self._writeable_pipe.flush)
94
95 def _read_bytes(self, count):
96 """See SmartClientStreamMedium._read_bytes."""
97- bytes = self._readable_pipe.read(count)
98+ bytes = osutils.until_no_eintr(self._readable_pipe.read, count)
99 self._report_activity(len(bytes), 'read')
100 return bytes
101
102@@ -765,15 +765,15 @@
103 def _accept_bytes(self, bytes):
104 """See SmartClientStreamMedium.accept_bytes."""
105 self._ensure_connection()
106- self._write_to.write(bytes)
107+ osutils.until_no_eintr(self._write_to.write, bytes)
108 self._report_activity(len(bytes), 'write')
109
110 def disconnect(self):
111 """See SmartClientMedium.disconnect()."""
112 if not self._connected:
113 return
114- self._read_from.close()
115- self._write_to.close()
116+ osutils.until_no_eintr(self._read_from.close)
117+ osutils.until_no_eintr(self._write_to.close)
118 self._ssh_connection.close()
119 self._connected = False
120
121@@ -802,7 +802,7 @@
122 if not self._connected:
123 raise errors.MediumNotConnected(self)
124 bytes_to_read = min(count, _MAX_READ_SIZE)
125- bytes = self._read_from.read(bytes_to_read)
126+ bytes = osutils.until_no_eintr(self._read_from.read, bytes_to_read)
127 self._report_activity(len(bytes), 'read')
128 return bytes
129
130@@ -832,7 +832,7 @@
131 """See SmartClientMedium.disconnect()."""
132 if not self._connected:
133 return
134- self._socket.close()
135+ osutils.until_no_eintr(self._socket.close)
136 self._socket = None
137 self._connected = False
138

Subscribers

People subscribed via source and target branches