[tor-commits] r24544: {arm} Dropping the pointless "Log notice stdout" config-text entry (in arm/trunk/src: interface util)
Damian Johnson
atagar1 at gmail.com
Sun Apr 3 05:55:59 UTC 2011
Author: atagar
Date: 2011-04-03 05:55:58 +0000 (Sun, 03 Apr 2011)
New Revision: 24544
Modified:
arm/trunk/src/interface/controller.py
arm/trunk/src/util/torConfig.py
Log:
Dropping the pointless "Log notice stdout" config-text entry when writting the custom torrc.
Modified: arm/trunk/src/interface/controller.py
===================================================================
--- arm/trunk/src/interface/controller.py 2011-04-03 05:23:06 UTC (rev 24543)
+++ arm/trunk/src/interface/controller.py 2011-04-03 05:55:58 UTC (rev 24544)
@@ -1675,8 +1675,7 @@
# display a popup for saving the current configuration
panel.CURSES_LOCK.acquire()
try:
- configText = torTools.getConn().getInfo("config-text", "").strip()
- configLines = configText.split("\n")
+ configLines = torConfig.getCustomOptions()
# lists event types
popup = panels["popup"]
@@ -1774,7 +1773,7 @@
# saves the configuration to the file
configFile = open(configLocation, "w")
- configFile.write(configText)
+ configFile.write("\n".join(configLines))
configFile.close()
# reloads the cached torrc if overwriting it
Modified: arm/trunk/src/util/torConfig.py
===================================================================
--- arm/trunk/src/util/torConfig.py 2011-04-03 05:23:06 UTC (rev 24543)
+++ arm/trunk/src/util/torConfig.py 2011-04-03 05:55:58 UTC (rev 24544)
@@ -353,17 +353,24 @@
def getCustomOptions():
"""
- Provides the set of torrc parameters that differ from their defaults.
+ Provides the torrc parameters that differ from their defaults.
"""
- customOptions, conn = set(), torTools.getConn()
- configTextQuery = conn.getInfo("config-text", "").strip().split("\n")
+ configText = torTools.getConn().getInfo("config-text", "").strip()
+ configLines = configText.split("\n")
- for entry in configTextQuery:
- # tor provides a Log entry even if it matches the default
- if entry != "Log notice stdout":
- customOptions.add(entry[:entry.find(" ")])
- return customOptions
+ # removes any duplicates
+ configLines = list(set(configLines))
+
+ # The "GETINFO config-text" query only provides options that differ
+ # from Tor's defaults with the exception of its Log entry which, even
+ # if undefined, returns "Log notice stdout" as per:
+ # https://trac.torproject.org/projects/tor/ticket/2362
+
+ try: configLines.remove("Log notice stdout")
+ except ValueError: pass
+
+ return configLines
def validate(contents = None):
"""
More information about the tor-commits
mailing list