Merge ~smoser/ubuntu/+source/sshuttle:fix/backward-compat into ubuntu/+source/sshuttle:ubuntu/focal-devel

Proposed by Scott Moser
Status: Needs review
Proposed branch: ~smoser/ubuntu/+source/sshuttle:fix/backward-compat
Merge into: ubuntu/+source/sshuttle:ubuntu/focal-devel
Diff against target: 135 lines (+47/-20)
2 files modified
debian/changelog (+7/-0)
debian/patches/0001-compatibility-with-python38.patch (+40/-20)
Reviewer Review Type Date Requested Status
Dan Streetman (community) Needs Fixing
git-ubuntu developers Pending
Review via email: mp+388062@code.launchpad.net

Commit message

Restore compatibility with python 3.5 and below.

The upstream commit 9c873579348e3308123d broke python versions
3.4 and below. We would like to support an ubuntu 20.04 client
(python 3.8) connecting to a ubuntu 14.04 server (python 3.4).

The change here makes that combination work.

To post a comment you must log in.
Revision history for this message
Dan Streetman (ddstreet) wrote :

inline comments on version checking logic, and also editing the quilt file itself isn't good; a new patch should be added instead of editing the one from upstream.

and there is still the question from @slashd of whether upstream will carry this, or if debian and/or ubuntu should carry it separately

review: Needs Fixing

Unmerged commits

50a7ab4... by Scott Moser

releasing package sshuttle version 0.78.5-1ubuntu2

ec0bce8... by Scott Moser

update changelog

24bb599... by Scott Moser

Restore compatibility with python 3.4.

The upstream commit 9c873579348e3308123d broke python versions
3.4 and below. We would like to support an ubuntu 20.04 client
(python 3.8) connecting to a ubuntu 14.04 server (python 3.4).

The change here makes that combination work.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index dbb2583..9564a31 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+sshuttle (0.78.5-1ubuntu2) focal; urgency=medium
7+
8+ * d/p/0001-compatibility-with-python38.patch: update patch
9+ to support python versions < 3.5 (trusty).
10+
11+ -- Scott Moser <smoser@ubuntu.com> Fri, 24 Jul 2020 12:02:34 -0400
12+
13 sshuttle (0.78.5-1ubuntu1) focal; urgency=medium
14
15 * d/p/0001-compatibility-with-python38.patch:
16diff --git a/debian/patches/0001-compatibility-with-python38.patch b/debian/patches/0001-compatibility-with-python38.patch
17index 6d55b74..2afaa69 100644
18--- a/debian/patches/0001-compatibility-with-python38.patch
19+++ b/debian/patches/0001-compatibility-with-python38.patch
20@@ -1,16 +1,18 @@
21 Description: Fix Python 3.8 file operations
22 Under Python 3.8 we can not wrap a File in a Sock.
23
24- Note this currently requires Python >= 3.5
25+ Note: Upstream commit referenced broke compatibility with
26+ python versions < 3.5. Changes here restore support
27+ for older python. The goal is specifically to support
28+ trusty (14.04) with python 3.4.
29+
30 Author: Brian May <brian@linuxpenguins.xyz>
31 Origin: upstream, https://github.com/sshuttle/sshuttle/commit/9c873579348e3308123d1bf2a917b0c2f82b9dae
32 Bug: https://github.com/sshuttle/sshuttle/issues/381
33 Bug-Debian: https://bugs.debian.org/953621
34 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1873368
35-Index: sshuttle-0.78.5/sshuttle/client.py
36-===================================================================
37---- sshuttle-0.78.5.orig/sshuttle/client.py
38-+++ sshuttle-0.78.5/sshuttle/client.py
39+--- a/sshuttle/client.py
40++++ b/sshuttle/client.py
41 @@ -460,7 +460,7 @@ def _main(tcp_listener, udp_listener, fw
42 raise Fatal("failed to establish ssh session (1)")
43 else:
44@@ -20,11 +22,9 @@ Index: sshuttle-0.78.5/sshuttle/client.py
45 handlers.append(mux)
46
47 expected = b'SSHUTTLE0001'
48-Index: sshuttle-0.78.5/sshuttle/server.py
49-===================================================================
50---- sshuttle-0.78.5.orig/sshuttle/server.py
51-+++ sshuttle-0.78.5/sshuttle/server.py
52-@@ -295,10 +295,7 @@ def main(latency_control, auto_hosts, to
53+--- a/sshuttle/server.py
54++++ b/sshuttle/server.py
55+@@ -295,10 +295,14 @@ def main(latency_control, auto_hosts, to
56 sys.stdout.flush()
57
58 handlers = []
59@@ -32,14 +32,19 @@ Index: sshuttle-0.78.5/sshuttle/server.py
60 - socket.AF_INET, socket.SOCK_STREAM),
61 - socket.fromfd(sys.stdout.fileno(),
62 - socket.AF_INET, socket.SOCK_STREAM))
63-+ mux = Mux(sys.stdin, sys.stdout)
64++ if sys.version_info.major <= 3 and sys.version_info.minor <= 4:
65++ debug1("Server version <= 3.4")
66++ mux = Mux(socket.fromfd(sys.stdin.fileno(),
67++ socket.AF_INET, socket.SOCK_STREAM),
68++ socket.fromfd(sys.stdout.fileno(),
69++ socket.AF_INET, socket.SOCK_STREAM))
70++ else:
71++ mux = Mux(sys.stdin, sys.stdout)
72 handlers.append(mux)
73
74 debug1('auto-nets:' + str(auto_nets) + '\n')
75-Index: sshuttle-0.78.5/sshuttle/ssnet.py
76-===================================================================
77---- sshuttle-0.78.5.orig/sshuttle/ssnet.py
78-+++ sshuttle-0.78.5/sshuttle/ssnet.py
79+--- a/sshuttle/ssnet.py
80++++ b/sshuttle/ssnet.py
81 @@ -334,10 +334,10 @@ class Proxy(Handler):
82
83 class Mux(Handler):
84@@ -55,31 +60,46 @@ Index: sshuttle-0.78.5/sshuttle/ssnet.py
85 self.new_channel = self.got_dns_req = self.got_routes = None
86 self.got_udp_open = self.got_udp_data = self.got_udp_close = None
87 self.got_host_req = self.got_host_list = None
88-@@ -434,9 +434,9 @@ class Mux(Handler):
89+@@ -350,6 +350,8 @@ class Mux(Handler):
90+ self.too_full = False
91+ self.send(0, CMD_PING, b('chicken'))
92+
93++ self.py35 = sys.version_info.major <= 3 and sys.version_info.minor <= 4
94++
95+ def next_channel(self):
96+ # channel 0 is special, so we never allocate it
97+ for _ in range(1024):
98+@@ -434,9 +436,12 @@ class Mux(Handler):
99 callback(cmd, data)
100
101 def flush(self):
102 - self.wsock.setblocking(False)
103-+ os.set_blocking(self.wfile.fileno(), False)
104++ if self.py35:
105++ self.wfile.setblocking(False)
106++ else:
107++ os.set_blocking(self.wfile.fileno(), False)
108 if self.outbuf and self.outbuf[0]:
109 - wrote = _nb_clean(os.write, self.wsock.fileno(), self.outbuf[0])
110 + wrote = _nb_clean(os.write, self.wfile.fileno(), self.outbuf[0])
111 debug2('mux wrote: %r/%d\n' % (wrote, len(self.outbuf[0])))
112 if wrote:
113 self.outbuf[0] = self.outbuf[0][wrote:]
114-@@ -444,9 +444,9 @@ class Mux(Handler):
115+@@ -444,9 +449,12 @@ class Mux(Handler):
116 self.outbuf[0:1] = []
117
118 def fill(self):
119 - self.rsock.setblocking(False)
120-+ os.set_blocking(self.rfile.fileno(), False)
121++ if self.py35:
122++ self.rfile.setblocking(False)
123++ else:
124++ os.set_blocking(self.rfile.fileno(), False)
125 try:
126 - read = _nb_clean(os.read, self.rsock.fileno(), 32768)
127 + read = _nb_clean(os.read, self.rfile.fileno(), 32768)
128 except OSError:
129 _, e = sys.exc_info()[:2]
130 raise Fatal('other end: %r' % e)
131-@@ -476,22 +476,22 @@ class Mux(Handler):
132+@@ -476,22 +484,22 @@ class Mux(Handler):
133 break
134
135 def pre_select(self, r, w, x):

Subscribers

People subscribed via source and target branches