[tor-commits] [arm/master] fix: disabling localization for system commands

atagar at torproject.org atagar at torproject.org
Sun Dec 18 22:40:31 UTC 2011


commit 31800f4018275d83c2f7db8f725b1fca1ee97360
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Dec 18 14:35:49 2011 -0800

    fix: disabling localization for system commands
    
    Setting LANG to C to disable localization for subcommands like netstat. This is
    important since we use words in it (like ESTABLISHED) to filter the results.
    Caught by Stephan Seitz.
---
 src/starter.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/starter.py b/src/starter.py
index 3d74315..40c23f7 100644
--- a/src/starter.py
+++ b/src/starter.py
@@ -103,6 +103,11 @@ PRIVATE_TORRC_ENTRIES = ["HashedControlPassword", "Bridge", "HiddenServiceDir"]
 TOR_ROOT_NOTICE = "Tor is currently running with root permissions. This is not a good idea and shouldn't be necessary. See the 'User UID' option from Tor's man page for an easy method of reducing its permissions after startup."
 ARM_ROOT_NOTICE = "Arm is currently running with root permissions. This is not a good idea, and will still work perfectly well if it's run with the same user as Tor (ie, starting with \"sudo -u %s arm\")."
 
+# Makes subcommands provide us with English results (this is important so we
+# can properly parse it).
+
+os.putenv("LANG", "C")
+
 def allowConnectionTypes():
   """
   This provides a tuple with booleans indicating if we should or shouldn't





More information about the tor-commits mailing list