Rev 5595: (vila) Fix socketpair-based SSH transport leaking socket into other in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Jan 11 23:02:11 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5595 [merge]
revision-id: pqm at pqm.ubuntu.com-20110111230209-nlp91k4usdikg3om
parent: pqm at pqm.ubuntu.com-20110111201031-0i87t0t3kyhitwv4
parent: v.ladeuil+lp at free.fr-20110111202013-s40m74cdl8vcd6re
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-01-11 23:02:09 +0000
message:
(vila) Fix socketpair-based SSH transport leaking socket into other
child processes (Max Bowsher)
modified:
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/transport/ssh.py ssh.py-20060824042150-0s9787kng6zv1nwq-1
doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2010-11-06 02:32:43 +0000
+++ b/bzrlib/osutils.py 2011-01-11 20:20:13 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2010 Canonical Ltd
+# Copyright (C) 2005-2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -2376,3 +2376,16 @@
counter += 1
name = "%s.~%d~" % (base, counter)
return name
+
+
+def set_fd_cloexec(fd):
+ """Set a Unix file descriptor's FD_CLOEXEC flag. Do nothing if platform
+ support for this is not available.
+ """
+ try:
+ import fcntl
+ old = fcntl.fcntl(fd, fcntl.F_GETFD)
+ fcntl.fcntl(fd, fcntl.F_SETFD, old | fcntl.FD_CLOEXEC)
+ except (ImportError, AttributeError):
+ # Either the fcntl module or specific constants are not present
+ pass
=== modified file 'bzrlib/transport/ssh.py'
--- a/bzrlib/transport/ssh.py 2010-11-18 00:22:24 +0000
+++ b/bzrlib/transport/ssh.py 2011-01-11 20:20:13 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2010 Robey Pointer <robey at lag.net>
+# Copyright (C) 2006-2011 Robey Pointer <robey at lag.net>
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
@@ -359,6 +359,7 @@
# whatever) chunks.
try:
my_sock, subproc_sock = socket.socketpair()
+ osutils.set_fd_cloexec(my_sock)
except (AttributeError, socket.error):
# This platform doesn't support socketpair(), so just use ordinary
# pipes instead.
=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt 2011-01-11 20:10:31 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt 2011-01-11 20:20:13 +0000
@@ -62,6 +62,9 @@
.. Fixes for situations where bzr would previously crash or give incorrect
or undesirable results.
+* Avoid leaking SSH subprocess communication socket into unrelated child
+ processes, which could cause bzr to hang on exit. (Max Bowsher, #696285)
+
* ``bzr update`` in a checkout of a readonly branch works again, without
trying to set the tags in the master branch. This had been broken by the
bug fix for bug #603395. (John Arbash Meinel, #701212)
More information about the bazaar-commits
mailing list