From 93dcfc659300f9ad5277ec531612013e4b8a13d3 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Wed, 13 Mar 2019 17:53:51 +0200 Subject: [PATCH 1/3] Use empty torrc file when launching tor in test_rebind.py --- src/test/test_rebind.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py index 00e5a08be7..4c41e1f437 100644 --- a/src/test/test_rebind.py +++ b/src/test/test_rebind.py @@ -82,13 +82,17 @@ if not os.path.exists(sys.argv[2]): tor_path = sys.argv[1] data_dir = sys.argv[2] +empty_torrc_path = os.path.join(data_dir, 'empty_torrc') +open(empty_torrc_path, 'w').close() + tor_process = subprocess.Popen([tor_path, '-DataDirectory', data_dir, '-ControlPort', '127.0.0.1:{}'.format(control_port), '-SOCKSPort', '127.0.0.1:{}'.format(socks_port), '-Log', 'debug stdout', '-LogTimeGranularity', '1', - '-FetchServerDescriptors', '0'], + '-FetchServerDescriptors', '0', + '-f', empty_torrc_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) From acec0192c3d6400316037cdc3e4c9093c1919252 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Wed, 13 Mar 2019 18:51:41 +0200 Subject: [PATCH 2/3] Add changes file --- changes/ticket29702 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes/ticket29702 diff --git a/changes/ticket29702 b/changes/ticket29702 new file mode 100644 index 0000000000..d2cacd55d7 --- /dev/null +++ b/changes/ticket29702 @@ -0,0 +1,4 @@ + o Testing: + - Specify torrc path (with empty file) when launching tor from + test_rebind.py; refrain from relying on default torrc path. Resolves + issue 29702. From 12b9bfc05f3a163b44f0f8b6638f027de16e622b Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 10 Apr 2019 19:03:43 +1000 Subject: [PATCH 3/3] test: Also avoid reading the system default torrc in integration tests Part of 29702. --- changes/ticket29702 | 6 +++--- src/test/test_key_expiration.sh | 3 ++- src/test/test_keygen.sh | 3 ++- src/test/test_rebind.py | 6 +++++- src/test/zero_length_keys.sh | 3 ++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/changes/ticket29702 b/changes/ticket29702 index d2cacd55d7..e1cc1f867b 100644 --- a/changes/ticket29702 +++ b/changes/ticket29702 @@ -1,4 +1,4 @@ o Testing: - - Specify torrc path (with empty file) when launching tor from - test_rebind.py; refrain from relying on default torrc path. Resolves - issue 29702. + - Specify torrc paths (with empty files) when launching tor in + integration tests; refrain from reading user and system torrcs. + Resolves issue 29702. diff --git a/src/test/test_key_expiration.sh b/src/test/test_key_expiration.sh index cf6608634d..3474210607 100755 --- a/src/test/test_key_expiration.sh +++ b/src/test/test_key_expiration.sh @@ -66,10 +66,11 @@ trap "rm -rf '$DATA_DIR'" 0 DATA_DIR=`cd "${DATA_DIR}" && pwd` touch "${DATA_DIR}/empty_torrc" +touch "${DATA_DIR}/empty_defaults_torrc" QUIETLY="--hush" SILENTLY="--quiet" -TOR="${TOR_BINARY} --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0 -f ${DATA_DIR}/empty_torrc --DataDirectory ${DATA_DIR}" +TOR="${TOR_BINARY} --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0 --DataDirectory ${DATA_DIR} -f ${DATA_DIR}/empty_torrc --defaults-torrc ${DATA_DIR}/empty_defaults_torrc" ##### SETUP # diff --git a/src/test/test_keygen.sh b/src/test/test_keygen.sh index 455f9e7d42..7afff271cb 100755 --- a/src/test/test_keygen.sh +++ b/src/test/test_keygen.sh @@ -83,10 +83,11 @@ trap "rm -rf '$DATA_DIR'" 0 DATA_DIR=`cd "${DATA_DIR}" && pwd` touch "${DATA_DIR}/empty_torrc" +touch "${DATA_DIR}/empty_defaults_torrc" QUIETLY="--hush" SILENTLY="--quiet" -TOR="${TOR_BINARY} ${QUIETLY} --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0 -f ${DATA_DIR}/empty_torrc" +TOR="${TOR_BINARY} ${QUIETLY} --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0 -f ${DATA_DIR}/empty_torrc --defaults-torrc ${DATA_DIR}/empty_defaults_torrc" ##### SETUP # diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py index 4c41e1f437..a376e62cb4 100644 --- a/src/test/test_rebind.py +++ b/src/test/test_rebind.py @@ -84,6 +84,8 @@ data_dir = sys.argv[2] empty_torrc_path = os.path.join(data_dir, 'empty_torrc') open(empty_torrc_path, 'w').close() +empty_defaults_torrc_path = os.path.join(data_dir, 'empty_defaults_torrc') +open(empty_defaults_torrc_path, 'w').close() tor_process = subprocess.Popen([tor_path, '-DataDirectory', data_dir, @@ -92,7 +94,9 @@ tor_process = subprocess.Popen([tor_path, '-Log', 'debug stdout', '-LogTimeGranularity', '1', '-FetchServerDescriptors', '0', - '-f', empty_torrc_path], + '-f', empty_torrc_path, + '--defaults-torrc', empty_defaults_torrc_path, + ], stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/src/test/zero_length_keys.sh b/src/test/zero_length_keys.sh index 3c61f8d465..5635bdfd89 100755 --- a/src/test/zero_length_keys.sh +++ b/src/test/zero_length_keys.sh @@ -43,10 +43,11 @@ fi trap "rm -rf '$DATA_DIR'" 0 touch "$DATA_DIR"/empty_torrc +touch "$DATA_DIR"/empty_defaults_torrc # DisableNetwork means that the ORPort won't actually be opened. # 'ExitRelay 0' suppresses a warning. -TOR="${TOR_BINARY} --hush --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0 -f $DATA_DIR/empty_torrc" +TOR="${TOR_BINARY} --hush --DisableNetwork 1 --ShutdownWaitLength 0 --ORPort 12345 --ExitRelay 0 -f $DATA_DIR/empty_torrc --defaults-torrc $DATA_DIR/empty_defaults_torrc" if [ -s "$DATA_DIR"/keys/secret_id_key ] && [ -s "$DATA_DIR"/keys/secret_onion_key ] && [ -s "$DATA_DIR"/keys/secret_onion_key_ntor ]; then