Merge lp:~gz/bzr/ignore_sigquit_in_ssh_child_162502 into lp:bzr

Proposed by Martin Packman
Status: Merged
Approved by: Andrew Bennetts
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~gz/bzr/ignore_sigquit_in_ssh_child_162502
Merge into: lp:bzr
Diff against target: 43 lines (+9/-2)
2 files modified
NEWS (+4/-0)
bzrlib/transport/ssh.py (+5/-2)
To merge this branch: bzr merge lp:~gz/bzr/ignore_sigquit_in_ssh_child_162502
Reviewer Review Type Date Requested Status
Andrew Bennetts Approve
John A Meinel Needs Fixing
Martin Pool Approve
Review via email: mp+19711@code.launchpad.net

Commit message

(mbp, for gz) mask out sigquit in ssh child process so that breakin doesn't kill it

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Trivial fix for bug 162502 that seemed worth jumping on while I was in the neighbourhood.

There might be some consequences that haven't been thought of here, shout if any come to mind.

Revision history for this message
Martin Pool (mbp) wrote :

Looks good, needs news.

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

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

Martin [gz] wrote:
> Martin [gz] has proposed merging lp:~gz/bzr/ignore_sigquit_in_ssh_child_162502 into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> #162502 SIGQUIT kills the child SSH process
> https://bugs.launchpad.net/bugs/162502
>
>
> Trivial fix for bug 162502 that seemed worth jumping on while I was in the neighbourhood.
>
> There might be some consequences that haven't been thought of here, shout if any come to mind.
>

signal.SIGQUIT doesn't exist on Windows so you need a getattr()

John
=:->
 review: needsfixing

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

iEYEARECAAYFAkuC220ACgkQJdeBCYSNAAMDQACeKLt0tOsiz7v8xhg/dyuYCQQH
Eh4An1clVbAo8qy5XC4lfCOcY4jJWwVq
=VYAE
-----END PGP SIGNATURE-----

review: Needs Fixing
Revision history for this message
Martin Packman (gz) wrote :

> Looks good, needs news.

Done.

> signal.SIGQUIT doesn't exist on Windows so you need a getattr()

It can't be seen from the diff in this merge proposal, but the change is already on a nix-only path, after all no fork, no preexec_fn on Windows.

Revision history for this message
Andrew Bennetts (spiv) wrote :

Hmm, this is a bit unfortunate (ideally we wouldn't need to set non-default signal handlers in child processes), but probably the best we can do. I hadn't realised that Ctrl-\ causes SIGQUIT to be sent to the entire process group, but it does so there's no other choice if we want to keep using SIGQUIT like this.

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2010-02-21 07:09:22 +0000
3+++ NEWS 2010-02-22 23:55:24 +0000
4@@ -86,6 +86,10 @@
5 ``add``.
6 (Parth Malwankar, #335033, #300001)
7
8+* SSH child processes will now ignore SIGQUIT on nix systems so breaking into
9+ the debugger won't kill the session.
10+ (Martin <gzlist@googlemail.com>, #162502)
11+
12 API Changes
13 ***********
14
15
16=== modified file 'bzrlib/transport/ssh.py'
17--- bzrlib/transport/ssh.py 2009-11-25 07:27:43 +0000
18+++ bzrlib/transport/ssh.py 2010-02-22 23:55:24 +0000
19@@ -173,12 +173,15 @@
20 register_ssh_vendor = _ssh_vendor_manager.register_vendor
21
22
23-def _ignore_sigint():
24+def _ignore_signals():
25 # TODO: This should possibly ignore SIGHUP as well, but bzr currently
26 # doesn't handle it itself.
27 # <https://launchpad.net/products/bzr/+bug/41433/+index>
28 import signal
29 signal.signal(signal.SIGINT, signal.SIG_IGN)
30+ # GZ 2010-02-19: Perhaps make this check if breakin is installed instead
31+ if signal.getsignal(signal.SIGQUIT) != signal.SIG_DFL:
32+ signal.signal(signal.SIGQUIT, signal.SIG_IGN)
33
34
35 class SocketAsChannelAdapter(object):
36@@ -634,7 +637,7 @@
37 # Running it in a separate process group is not good because then it
38 # can't get non-echoed input of a password or passphrase.
39 # <https://launchpad.net/products/bzr/+bug/40508>
40- return {'preexec_fn': _ignore_sigint,
41+ return {'preexec_fn': _ignore_signals,
42 'close_fds': True,
43 }
44