[or-cvs] r23869: {arm} Checking tor version for cached man page results. (arm/trunk/src/util)

Damian Johnson atagar1 at gmail.com
Sun Nov 28 04:56:23 UTC 2010


Author: atagar
Date: 2010-11-28 04:56:23 +0000 (Sun, 28 Nov 2010)
New Revision: 23869

Modified:
   arm/trunk/src/util/torConfig.py
Log:
Checking tor version for cached man page results.



Modified: arm/trunk/src/util/torConfig.py
===================================================================
--- arm/trunk/src/util/torConfig.py	2010-11-28 04:42:30 UTC (rev 23868)
+++ arm/trunk/src/util/torConfig.py	2010-11-28 04:56:23 UTC (rev 23869)
@@ -114,6 +114,17 @@
       strToCat = dict([(OPTION_CATEGORY_STR[cat], cat) for cat in OPTION_CATEGORY_STR])
       
       try:
+        versionLine = inputFileContents.pop(0).rstrip()
+        
+        if versionLine.startswith("Tor Version "):
+          fileVersion = versionLine[12:]
+          torVersion = torTools.getConn().getInfo("version", "")
+          if fileVersion != torVersion:
+            msg = "wrong version, tor is %s but the file's from %s" % (torVersion, fileVersion)
+            raise IOError(msg)
+        else:
+          raise IOError("unable to parse version")
+        
         while inputFileContents:
           # gets category enum, failing if it doesn't exist
           categoryStr = inputFileContents.pop(0).rstrip()
@@ -238,6 +249,8 @@
   sortedOptions = CONFIG_DESCRIPTIONS.keys()
   sortedOptions.sort()
   
+  torVersion = torTools.getConn().getInfo("version", "")
+  outputFile.write("Tor Version %s\n" % torVersion)
   for i in range(len(sortedOptions)):
     option = sortedOptions[i]
     manEntry = getConfigDescription(option)



More information about the tor-commits mailing list