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

Subscribers

People subscribed via source and target branches