diff -Nru lepton-1.2.1/debian/changelog lepton-1.2.1/debian/changelog --- lepton-1.2.1/debian/changelog 2016-07-22 16:43:16.000000000 +0000 +++ lepton-1.2.1/debian/changelog 2016-07-31 14:22:40.000000000 +0000 @@ -1,3 +1,10 @@ +lepton (1.2.1-2) unstable; urgency=medium + + * Patch to fix unit test so that it will not left lepton process. + Closes: #831897 + + -- ChangZhuo Chen (陳昌倬) Sun, 31 Jul 2016 22:22:36 +0800 + lepton (1.2.1-1) unstable; urgency=medium * New upstream release. Closes: #831814 diff -Nru lepton-1.2.1/debian/control lepton-1.2.1/debian/control --- lepton-1.2.1/debian/control 2016-07-22 16:40:58.000000000 +0000 +++ lepton-1.2.1/debian/control 2016-07-31 14:00:37.000000000 +0000 @@ -8,8 +8,6 @@ dh-autoreconf, libssl-dev, pkg-config, -# FIXME: workaround for #831897, https://github.com/dropbox/lepton/issues/42 - procps, python, xmlto, zlib1g-dev, diff -Nru lepton-1.2.1/debian/.git-dpm lepton-1.2.1/debian/.git-dpm --- lepton-1.2.1/debian/.git-dpm 2016-07-21 11:19:45.000000000 +0000 +++ lepton-1.2.1/debian/.git-dpm 2016-07-31 14:00:21.000000000 +0000 @@ -1,6 +1,6 @@ # see git-dpm(1) from git-dpm package -2d1d74f1573738b44e44fb5ce36cb98eddcf7f78 -2d1d74f1573738b44e44fb5ce36cb98eddcf7f78 +563ad08b54724f4303eb5e36439721b852486901 +563ad08b54724f4303eb5e36439721b852486901 ce6e72902986ad97b189fce42061610daa37b646 ce6e72902986ad97b189fce42061610daa37b646 lepton_1.2.1.orig.tar.gz diff -Nru lepton-1.2.1/debian/patches/0003-make-sockettester-and-forktester-python3-compatible.patch lepton-1.2.1/debian/patches/0003-make-sockettester-and-forktester-python3-compatible.patch --- lepton-1.2.1/debian/patches/0003-make-sockettester-and-forktester-python3-compatible.patch 1970-01-01 00:00:00.000000000 +0000 +++ lepton-1.2.1/debian/patches/0003-make-sockettester-and-forktester-python3-compatible.patch 2016-07-31 14:00:21.000000000 +0000 @@ -0,0 +1,145 @@ +From e13387c37a29410ab6a1b07461902b970a6942be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?ChangZhuo=20Chen=20=28=E9=99=B3=E6=98=8C=E5=80=AC=29?= + +Date: Sun, 31 Jul 2016 21:59:28 +0800 +Subject: make sockettester and forktester python3 compatible + +--- + test_suite/forktester.py | 24 ++++++++++++------------ + test_suite/sockettester.py | 30 +++++++++++++++--------------- + 2 files changed, 27 insertions(+), 27 deletions(-) + +diff --git a/test_suite/forktester.py b/test_suite/forktester.py +index bcc305c..905a7c8 100755 +--- a/test_suite/forktester.py ++++ b/test_suite/forktester.py +@@ -17,28 +17,28 @@ valid_names = [] + for i in range(4): + valid_names.append((proc.stdout.readline().strip(), + proc.stdout.readline().strip())) +- valid_fds.append((open(valid_names[-1][0],'w'), +- open(valid_names[-1][1],'r'))) ++ valid_fds.append((open(valid_names[-1][0],'wb'), ++ open(valid_names[-1][1],'rb'))) + + def add4(): + for i in range(4): + valid_names.append((proc.stdout.readline().strip(), + proc.stdout.readline().strip())) +- valid_fds.append((open(valid_names[-1][0],'w'), +- open(valid_names[-1][1],'r'))) ++ valid_fds.append((open(valid_names[-1][0],'wb'), ++ open(valid_names[-1][1],'rb'))) + +-with open(jpg_name) as f: ++with open(jpg_name, 'rb') as f: + jpg = f.read() + def fn(): + valid_fds[0][0].write(jpg) +- print 'written ',valid_fds[0][0] ++ print ('written ',valid_fds[0][0]) + valid_fds[0][0].close() +- print 'closed' ++ print ('closed') + def fn1(): + valid_fds[1][0].write(dat) +- print 'written ',valid_fds[1][0] ++ print ('written ',valid_fds[1][0]) + valid_fds[1][0].close() +- print 'xclosed ',valid_fds[1][0] ++ print ('xclosed ',valid_fds[1][0]) + u=threading.Thread(target=add4) + u.start() + t=threading.Thread(target=fn) +@@ -47,14 +47,14 @@ t.start() + dat = valid_fds[0][1].read() + valid_fds[0][1].close() + t.join() +-print len(jpg),len(dat) ++print (len(jpg),len(dat)) + v=threading.Thread(target=fn1) + v.start() + ojpg = valid_fds[1][1].read() + valid_fds[1][1].close() + t.join() + +-assert ojpg == jpg ++assert (ojpg == jpg) + +-print 'yay',len(ojpg),len(dat),len(dat)/float(len(ojpg)) ++print ('yay',len(ojpg),len(dat),len(dat)/float(len(ojpg))) + u.join() +diff --git a/test_suite/sockettester.py b/test_suite/sockettester.py +index b255549..f2099af 100755 +--- a/test_suite/sockettester.py ++++ b/test_suite/sockettester.py +@@ -32,7 +32,7 @@ def read_all_sock(sock): + break + except OSError: + pass +- return ''.join(datas) ++ return b''.join(datas) + + def test_compression(binary_name, socket_name = None, too_short_time_bound=False, is_zlib=False): + global jpg_name +@@ -54,12 +54,12 @@ def test_compression(binary_name, socket_name = None, too_short_time_bound=False + dup_proc = subprocess.Popen(xargs, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE) +- duplicate_socket_name = '' ++ duplicate_socket_name = b'' + duplicate_socket_name = dup_proc.stdout.readline().strip() +- assert not duplicate_socket_name ++ assert (not duplicate_socket_name) + if is_zlib: +- socket_name = socket_name.replace('.uport', '') + '.z0' +- with open(jpg_name) as f: ++ socket_name = socket_name.replace(b'.uport', b'') + b'.z0' ++ with open(jpg_name, 'rb') as f: + jpg = f.read() + def encoder(): + try: +@@ -85,8 +85,8 @@ def test_compression(binary_name, socket_name = None, too_short_time_bound=False + lepton_socket.close() + t.join() + +- print 'encode time ',encode_end - encode_start +- print len(jpg),len(dat) ++ print ('encode time ',encode_end - encode_start) ++ print (len(jpg),len(dat)) + + while True: + v=threading.Thread(target=decoder) +@@ -103,18 +103,18 @@ def test_compression(binary_name, socket_name = None, too_short_time_bound=False + v.join() + if is_zlib: + ojpg = zlib.decompress(ojpg) +- print len(ojpg) +- print len(jpg) +- assert ojpg == jpg +- print 'decode time ',decode_end - decode_start, '(', decode_mid-decode_start,')' ++ print (len(ojpg)) ++ print (len(jpg)) ++ assert (ojpg == jpg) ++ print ('decode time ',decode_end - decode_start, '(', decode_mid-decode_start,')') + if not parsed_args.benchmark: + break + +- print 'yay',len(ojpg),len(dat),len(dat)/float(len(ojpg)), 'parent pid is ',proc.pid ++ print ('yay',len(ojpg),len(dat),len(dat)/float(len(ojpg)), 'parent pid is ',proc.pid) + + proc.terminate() + proc.wait() +- assert not os.path.exists(socket_name) ++ assert (not os.path.exists(socket_name)) + + has_avx2 = False + try: +@@ -140,5 +140,5 @@ if not parsed_args.benchmark: + except (AssertionError, EnvironmentError): + ok = True + finally: +- assert ok and "the time bound must stop the process" +- print "SUCCESS DONE" ++ assert (ok and "the time bound must stop the process") ++ print ("SUCCESS DONE") diff -Nru lepton-1.2.1/debian/patches/0004-Ensure-proc.terminate-is-called-after-unit-test.patch lepton-1.2.1/debian/patches/0004-Ensure-proc.terminate-is-called-after-unit-test.patch --- lepton-1.2.1/debian/patches/0004-Ensure-proc.terminate-is-called-after-unit-test.patch 1970-01-01 00:00:00.000000000 +0000 +++ lepton-1.2.1/debian/patches/0004-Ensure-proc.terminate-is-called-after-unit-test.patch 2016-07-31 14:00:21.000000000 +0000 @@ -0,0 +1,150 @@ +From 563ad08b54724f4303eb5e36439721b852486901 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?ChangZhuo=20Chen=20=28=E9=99=B3=E6=98=8C=E5=80=AC=29?= + +Date: Sun, 31 Jul 2016 22:00:14 +0800 +Subject: Ensure proc.terminate() is called after unit test + +--- + test_suite/sockettester.py | 123 +++++++++++++++++++++++---------------------- + 1 file changed, 63 insertions(+), 60 deletions(-) + +diff --git a/test_suite/sockettester.py b/test_suite/sockettester.py +index f2099af..56c1c5b 100755 +--- a/test_suite/sockettester.py ++++ b/test_suite/sockettester.py +@@ -48,72 +48,75 @@ def test_compression(binary_name, socket_name = None, too_short_time_bound=False + proc = subprocess.Popen(xargs, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE) +- socket_name = proc.stdout.readline().strip() +- if custom_name: +- # test that we are unable to connect to the subprocess +- dup_proc = subprocess.Popen(xargs, +- stdout=subprocess.PIPE, +- stdin=subprocess.PIPE) +- duplicate_socket_name = b'' +- duplicate_socket_name = dup_proc.stdout.readline().strip() +- assert (not duplicate_socket_name) +- if is_zlib: +- socket_name = socket_name.replace(b'.uport', b'') + b'.z0' +- with open(jpg_name, 'rb') as f: +- jpg = f.read() +- def encoder(): +- try: +- lepton_socket.sendall(jpg) +- lepton_socket.shutdown(socket.SHUT_WR) +- except EnvironmentError: +- pass +- def decoder(): +- try: +- lepton_socket.sendall(dat) +- lepton_socket.shutdown(socket.SHUT_WR) +- except EnvironmentError: +- pass +- +- t=threading.Thread(target=encoder) ++ try: ++ socket_name = proc.stdout.readline().strip() ++ if custom_name: ++ # test that we are unable to connect to the subprocess ++ dup_proc = subprocess.Popen(xargs, ++ stdout=subprocess.PIPE, ++ stdin=subprocess.PIPE) ++ duplicate_socket_name = b'' ++ duplicate_socket_name = dup_proc.stdout.readline().strip() ++ assert (not duplicate_socket_name) ++ if is_zlib: ++ socket_name = socket_name.replace(b'.uport', b'') + b'.z0' ++ with open(jpg_name, 'rb') as f: ++ jpg = f.read() ++ def encoder(): ++ try: ++ lepton_socket.sendall(jpg) ++ lepton_socket.shutdown(socket.SHUT_WR) ++ except EnvironmentError: ++ pass ++ def decoder(): ++ try: ++ lepton_socket.sendall(dat) ++ lepton_socket.shutdown(socket.SHUT_WR) ++ except EnvironmentError: ++ pass + +- encode_start = time.time() +- lepton_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) +- lepton_socket.connect(socket_name) +- t.start() +- dat = read_all_sock(lepton_socket) +- encode_end = time.time() +- lepton_socket.close() +- t.join() +- +- print ('encode time ',encode_end - encode_start) +- print (len(jpg),len(dat)) ++ t=threading.Thread(target=encoder) + +- while True: +- v=threading.Thread(target=decoder) +- +- decode_start = time.time() ++ encode_start = time.time() + lepton_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) +- os.listdir('/tmp') + lepton_socket.connect(socket_name) +- v.start() +- decode_mid = time.time() +- ojpg = read_all_sock(lepton_socket) +- decode_end = time.time() ++ t.start() ++ dat = read_all_sock(lepton_socket) ++ encode_end = time.time() + lepton_socket.close() +- v.join() +- if is_zlib: +- ojpg = zlib.decompress(ojpg) +- print (len(ojpg)) +- print (len(jpg)) +- assert (ojpg == jpg) +- print ('decode time ',decode_end - decode_start, '(', decode_mid-decode_start,')') +- if not parsed_args.benchmark: +- break +- +- print ('yay',len(ojpg),len(dat),len(dat)/float(len(ojpg)), 'parent pid is ',proc.pid) ++ t.join() ++ ++ print ('encode time ',encode_end - encode_start) ++ print (len(jpg),len(dat)) ++ ++ while True: ++ v=threading.Thread(target=decoder) ++ ++ decode_start = time.time() ++ lepton_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) ++ os.listdir('/tmp') ++ lepton_socket.connect(socket_name) ++ v.start() ++ decode_mid = time.time() ++ ojpg = read_all_sock(lepton_socket) ++ decode_end = time.time() ++ lepton_socket.close() ++ v.join() ++ if is_zlib: ++ ojpg = zlib.decompress(ojpg) ++ print (len(ojpg)) ++ print (len(jpg)) ++ assert (ojpg == jpg) ++ print ('decode time ',decode_end - decode_start, '(', decode_mid-decode_start,')') ++ if not parsed_args.benchmark: ++ break ++ ++ print ('yay',len(ojpg),len(dat),len(dat)/float(len(ojpg)), 'parent pid is ',proc.pid) ++ ++ finally: ++ proc.terminate() ++ proc.wait() + +- proc.terminate() +- proc.wait() + assert (not os.path.exists(socket_name)) + + has_avx2 = False diff -Nru lepton-1.2.1/debian/patches/series lepton-1.2.1/debian/patches/series --- lepton-1.2.1/debian/patches/series 2016-07-21 11:19:45.000000000 +0000 +++ lepton-1.2.1/debian/patches/series 2016-07-31 14:00:21.000000000 +0000 @@ -1,2 +1,4 @@ 0001-Set-GIT_REVISION-to-empty-string.patch 0002-Use-system-libraries.patch +0003-make-sockettester-and-forktester-python3-compatible.patch +0004-Ensure-proc.terminate-is-called-after-unit-test.patch diff -Nru lepton-1.2.1/debian/rules lepton-1.2.1/debian/rules --- lepton-1.2.1/debian/rules 2016-07-22 16:40:54.000000000 +0000 +++ lepton-1.2.1/debian/rules 2016-07-31 14:00:27.000000000 +0000 @@ -13,8 +13,3 @@ override_dh_install: dh_install rm -f debian/lepton/usr/bin/test_invariants - -# FIXME: workaround for #831897, https://github.com/dropbox/lepton/issues/42 -override_dh_auto_test: - dh_auto_test - pkill lepton