[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Don't resolve tor's cwd for relative paths
commit b8ce3ce084f991dac2e7de6fb5b40fb3824b5fa0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Wed Oct 11 11:40:12 2017 -0700
Don't resolve tor's cwd for relative paths
Tor's DisableDebuggerAttachment feature breaks all methods we attempt to get
tor's cwd (/proc, pwdx, and lsof). However, this is fine since we only need the
cwd to expand relative paths which doesn't come up much (iirc tor makes more
effort nowadays to give only absolute paths).
Skipping cwd resolution if a path's relative so we avoid the doomed system
calls.
---
nyx/__init__.py | 2 +-
nyx/tracker.py | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/nyx/__init__.py b/nyx/__init__.py
index 89a24c7..d9a9b52 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -343,7 +343,7 @@ def expand_path(path):
return None
try:
- tor_cwd = stem.util.system.cwd(tor_controller().get_pid(None))
+ tor_cwd = stem.util.system.cwd(tor_controller().get_pid(None)) if not os.path.isabs(path) else None
return chroot() + stem.util.system.expand_path(path, tor_cwd)
except IOError as exc:
stem.util.log.info('Unable to expand a relative path (%s): %s' % (path, exc))
diff --git a/nyx/tracker.py b/nyx/tracker.py
index c41fdad..6d6ab64 100644
--- a/nyx/tracker.py
+++ b/nyx/tracker.py
@@ -817,6 +817,7 @@ class ConsensusTracker(object):
if cache_age < 3600:
stem.util.log.info('Cache is only %s old, no need to refresh it.' % str_tools.time_label(cache_age, is_long = True))
else:
+ stem.util.log.info('Cache is %s old, refreshing relay information.' % str_tools.time_label(cache_age, is_long = True))
start_time = time.time()
ns_response = controller.get_info('ns/all', None)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits