From 3baf3d01cbf4cca91a8d18f4c86ae5aa05818f8e Mon Sep 17 00:00:00 2001
From: Nick Mathewson <nickm@torproject.org>
Date: Mon, 2 Jul 2018 14:04:46 -0400
Subject: [PATCH] hs_ntor_ref.py: pass only strings to subprocess.Popen

Recent Python3 versions seem to require this on Windows.

Fixes bug 26535; bug copied from ntor_ref.py on 0.3.1.1-alpha.
---
 changes/bug26535.032    | 5 +++++
 src/test/hs_ntor_ref.py | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 changes/bug26535.032

diff --git a/changes/bug26535.032 b/changes/bug26535.032
new file mode 100644
index 0000000000..395d08d816
--- /dev/null
+++ b/changes/bug26535.032
@@ -0,0 +1,5 @@
+  o Minor bugfixes (testing, compatibility):
+    - When running the hs_ntor_ref.py test, make sure only to pass strings
+      (rather than "bytes" objects) to the Python subprocess module.
+      Python 3 on Windows seems to require this.  Fixes bug 26535; bugfix on
+      0.3.1.1-alpha.
diff --git a/src/test/hs_ntor_ref.py b/src/test/hs_ntor_ref.py
index 2ed9324e1f..542b02d2e0 100644
--- a/src/test/hs_ntor_ref.py
+++ b/src/test/hs_ntor_ref.py
@@ -234,8 +234,11 @@ Utilities for communicating with the little-t-tor ntor wrapper to conduct the
 integration tests
 """
 
-PROG = b"./src/test/test-hs-ntor-cl"
-enhex=lambda s: binascii.b2a_hex(s)
+PROG = "./src/test/test-hs-ntor-cl"
+if sys.version_info[0] >= 3:
+    enhex=lambda s: binascii.b2a_hex(s).decode("ascii")
+else:
+    enhex=lambda s: binascii.b2a_hex(s)
 dehex=lambda s: binascii.a2b_hex(s.strip())
 
 def tor_client1(intro_auth_pubkey_str, intro_enc_pubkey,
-- 
GitLab