[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r23670: {arm} Bug fix bundle fix: the arm starter was only executable from (in arm/trunk: . src src/interface)
Author: atagar
Date: 2010-10-25 02:17:02 +0000 (Mon, 25 Oct 2010)
New Revision: 23670
Modified:
arm/trunk/TODO
arm/trunk/arm
arm/trunk/src/interface/confPanel.py
arm/trunk/src/interface/controller.py
arm/trunk/src/starter.py
Log:
Bug fix bundle
fix: the arm starter was only executable from the arm directory
fix: wasn't loading the settings.cfg if starting starter from the src directory (caught by NightMonkey)
fix: displaying empty conf contents caused crashes when calling math.log10(0) (caught by NightMonkey)
fix: issuing a sighup casused a crash due to new config changes
fix: utilities weren't getting internal parsing settings if armrc was unset
fix: conf page wasn't fetching special options (hidden service) via their special command
Modified: arm/trunk/TODO
===================================================================
--- arm/trunk/TODO 2010-10-24 13:59:46 UTC (rev 23669)
+++ arm/trunk/TODO 2010-10-25 02:17:02 UTC (rev 23670)
@@ -16,6 +16,8 @@
- [validation] check if there's missing entries
might be able to use "GETINFO config-text" to determine entries that
differ from the defaults, then see if they're all in the torrc
+ - [validation] tor provides the types for config options, so I might be
+ able to use these instead of hardcoding the multiline values.
[ ] conn panel
- expand client connections and note location in circuit (entry-exit)
- for clients give an option to list all connections, to tell which are
@@ -71,6 +73,10 @@
timestamps to see if it belongs to this tor instance. This requires
tor's uptime - blocked on implementation of the following proposal:
https://gitweb.torproject.org/tor.git/blob/HEAD:/doc/spec/proposals/173-getinfo-option-expansion.txt
+ * the STATUS_SERVER event may not be supported
+ 18:52 < mikeperry> atagar: I believe there is no event parsing for STATUS_SERVER
+ 18:53 < mikeperry> atagar: see TorCtl.EventSink and classes that inherit from it
+ 18:54 < mikeperry> specifically, TorCtl.EventHandler._decode1, _handle1, and _map1
* conn panel:
* *never* do reverse dns lookups for first hops (could be resolving via
Modified: arm/trunk/arm
===================================================================
--- arm/trunk/arm 2010-10-24 13:59:46 UTC (rev 23669)
+++ arm/trunk/arm 2010-10-25 02:17:02 UTC (rev 23670)
@@ -2,7 +2,7 @@
if [ $0 = /usr/bin/arm ]; then
arm_base=/usr/lib/arm/
else
- arm_base=src/
+ arm_base=$( dirname $0 )/src/
fi
python ${arm_base}prereq.py
Modified: arm/trunk/src/interface/confPanel.py
===================================================================
--- arm/trunk/src/interface/confPanel.py 2010-10-24 13:59:46 UTC (rev 23669)
+++ arm/trunk/src/interface/confPanel.py 2010-10-25 02:17:02 UTC (rev 23670)
@@ -14,7 +14,8 @@
"features.config.maxLinesPerEntry": 8,
"log.confPanel.torrcReadFailed": log.WARN,
"log.torrcValidation.duplicateEntries": log.NOTICE,
- "log.torrcValidation.torStateDiffers": log.NOTICE}
+ "log.torrcValidation.torStateDiffers": log.NOTICE,
+ "torrc.map": {}}
# configurations that can be displayed
TOR_STATE, TORRC, ARM_STATE, ARMRC = range(4)
@@ -141,8 +142,15 @@
# UseEntryGuards Boolean
line = configOptionQuery[lineNum]
confOption, confType = line.strip().split(" ", 1)
- confValue = ", ".join(conn.getOption(confOption, [], True))
+ confValue = None
+ if confOption in self._config["torrc.map"]:
+ confMappings = conn.getOptionMap(self._config["torrc.map"][confOption], {})
+ if confOption in confMappings: confValue = confMappings[confOption]
+ fetchConfOption = self._config["torrc.map"][confOption]
+ else:
+ confValue = ", ".join(conn.getOption(confOption, [], True))
+
# provides nicer values for recognized types
if not confValue: confValue = "<none>"
elif confType == "Boolean" and confValue in ("0", "1"):
@@ -234,7 +242,10 @@
renderedContents = torrc.stripComments(renderedContents)
# offset to make room for the line numbers
- lineNumOffset = int(math.log10(len(renderedContents))) + 2 if self.showLineNum else 0
+ lineNumOffset = 0
+ if self.showLineNum:
+ if len(renderedContents) == 0: lineNumOffset = 2
+ else: lineNumOffset = int(math.log10(len(renderedContents))) + 2
# draws left-hand scroll bar if content's longer than the height
scrollOffset = 0
Modified: arm/trunk/src/interface/controller.py
===================================================================
--- arm/trunk/src/interface/controller.py 2010-10-24 13:59:46 UTC (rev 23669)
+++ arm/trunk/src/interface/controller.py 2010-10-25 02:17:02 UTC (rev 23670)
@@ -484,7 +484,7 @@
if panels["graph"].currentDisplay == "bandwidth":
panels["graph"].setHeight(panels["graph"].stats["bandwidth"].getContentHeight())
- panels["torrc"].reset()
+ panels["torrc"].loadConfig()
sighupTracker.isReset = False
# gives panels a chance to take advantage of the maximum bounds
Modified: arm/trunk/src/starter.py
===================================================================
--- arm/trunk/src/starter.py 2010-10-24 13:59:46 UTC (rev 23669)
+++ arm/trunk/src/starter.py 2010-10-25 02:17:02 UTC (rev 23670)
@@ -120,22 +120,24 @@
config = util.conf.getConfig("arm")
# attempts to fetch attributes for parsing tor's logs, configuration, etc
- try: config.load("%s/settings.cfg" % os.path.dirname(sys.argv[0]))
+ try:
+ pathPrefix = os.path.dirname(sys.argv[0])
+ if pathPrefix and not pathPrefix.endswith("/"):
+ pathPrefix = pathPrefix + "/"
+
+ config.load("%ssettings.cfg" % pathPrefix)
except IOError, exc:
- msg = "Failed to load the parsing configuration. This will be problematic for a few things like torrc validation and log duplication detection (%s)" % str(exc)
+ # Strips off the error number prefix from the message. Example error msg:
+ # [Errno 2] No such file or directory
+ excMsg = str(exc)
+ if excMsg.startswith("[Errno "): excMsg = excMsg[10:]
+ msg = "Failed to load the parsing configuration. This will be problematic for a few things like torrc validation and log duplication detection (%s)" % excMsg
util.log.log(util.log.WARN, msg)
# loads user's personal armrc if available
if os.path.exists(configPath):
try:
config.load(configPath)
-
- # revises defaults to match user's configuration
- config.update(DEFAULTS)
-
- # loads user preferences for utilities
- for utilModule in (util.conf, util.connections, util.hostnames, util.log, util.panel, util.sysTools, util.torrc, util.torTools, util.uiTools):
- utilModule.loadConfig(config)
except IOError, exc:
msg = "Failed to load configuration (using defaults): \"%s\"" % str(exc)
util.log.log(util.log.WARN, msg)
@@ -144,6 +146,13 @@
msg = "No configuration found at '%s', using defaults" % configPath
util.log.log(util.log.NOTICE, msg)
+ # revises defaults to match user's configuration
+ config.update(DEFAULTS)
+
+ # loads user preferences for utilities
+ for utilModule in (util.conf, util.connections, util.hostnames, util.log, util.panel, util.sysTools, util.torrc, util.torTools, util.uiTools):
+ utilModule.loadConfig(config)
+
# overwrites undefined parameters with defaults
for key in param.keys():
if param[key] == None: param[key] = DEFAULTS[key]