Repository navigation
Fix infinite loop when proxy command dies - #1180
vincentbernat wants to merge 1 commit into
Conversation
|
see also #963 |
|
nevermind, I see you've seen that PR :) this does look better |
|
@vincentbernat This does look better than my old PR #963, I just closed it. It looks like you may need to write a test to get it merged, the code coverage checks are complaining. |
|
@vincentbernat Would you mind resolving the merge conflicts and coverage test failures? It would be really great to get this merged in. |
bed78d1 to
5b12f94
Compare
|
I have rebased on master. |
| if not b: | ||
| if buffer: | ||
| return buffer | ||
| raise ProxyCommandFailure(' '.join(self.cmd), |
There was a problem hiding this comment.
When trying out this code, it looks like this exception is always getting raised (paramiko==2.4.1) after a command successfully exits. I think this should be:
if r and r[0] == self.process.stdout:
b = os.read(self.process.stdout.fileno(), size - len(buffer))
if not b:
return buffer
buffer += b
return buffer
5b12f94 to
474de34
Compare
|
I have updated the PR with your suggestion. |
|
Looks like the python 3.6 gate wants a line length change: - self.process.stdout.fileno(), size - len(buffer))
+ self.process.stdout.fileno(), size - len(buffer)
+ ) |
When proxy command dies, reading from the file descriptor returns an empty string. From documentation, this is the expected way to signal an end-of-file for this file descriptor (no exception is raised). If we have something in the buffer, let's give it back, otherwise, trigger an exception.
474de34 to
d59ac55
Compare
|
OK, this should be fixed. |
|
@ploxiln I don't suppose you know who we should ping to try and get this merged? |
|
It'd be sweet if we could whip up some tests for this, but I'll probably only be a stickler about that if there are existing tests for this functionality that can be easily extended. I've put it in the next bugfix milestone. No ETA. |
When proxy command dies, reading from the file descriptor returns an
empty string. From documentation, this is the expected way to signal
an end-of-file for this file descriptor (no exception is raised). If
we have something in the buffer, let's give it back, otherwise,
trigger an exception.