[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Backport bugfixes to maintenance branch



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv10694/lib/mixminion

Modified Files:
      Tag: mixminion-v0-0-6-patches
	ClientMain.py ClientUtils.py Common.py NetUtils.py 
Log Message:
Backport bugfixes to maintenance branch

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.138.2.2
retrieving revision 1.138.2.3
diff -u -d -r1.138.2.2 -r1.138.2.3
--- ClientMain.py	15 Dec 2003 22:46:15 -0000	1.138.2.2
+++ ClientMain.py	18 Dec 2003 23:13:55 -0000	1.138.2.3
@@ -832,10 +832,9 @@
                 self.forceNoQueue = 1
 
         if self.nHops and not self.path:
-            LOG.warn("-H/--hops is deprecated; use -P '*%d' instead",
-                     self.nHops)
+            self.path = '*%d'% self.nHops
         elif self.nHops:
-            LOG.warn("-H/--hops is deprecated")
+            raise UIError("You cannot specify both a path (-P/--path) and a number of hops (-H/--hops)")
 
     def init(self):
         """Configure objects and initialize subsystems as specified by the
@@ -955,7 +954,7 @@
 
         self.pathSpec = mixminion.ClientDirectory.parsePath(
             self.config, self.path, self.nHops, isReply=isReply, isSURB=isSURB,
-            defaultNHops = defHops)
+            defaultNHops=defHops)
         self.directory.validatePath(self.pathSpec, self.exitAddress,
                                     self.startAt, self.endAt)
 

Index: ClientUtils.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientUtils.py,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- ClientUtils.py	3 Dec 2003 23:12:00 -0000	1.13
+++ ClientUtils.py	18 Dec 2003 23:13:55 -0000	1.13.2.1
@@ -666,7 +666,7 @@
                 os.rename(fname_old, fname_new)
 
         self.store = mixminion.Filestore.ObjectMetadataStore(
-            directory, create=1, scrub=1)
+            directory, create=1)
 
         self.metadataLoaded = 0
 
@@ -765,6 +765,7 @@
             for h in remove:
                 self.store.removeMessage(h)
         self.store.cleanQueue()
+        self.store.cleanMetadata()
 
     def loadMetadata(self):
         """Ensure that we've loaded metadata for this queue from disk."""

Index: Common.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Common.py,v
retrieving revision 1.124
retrieving revision 1.124.2.1
diff -u -d -r1.124 -r1.124.2.1
--- Common.py	8 Dec 2003 06:37:15 -0000	1.124
+++ Common.py	18 Dec 2003 23:13:55 -0000	1.124.2.1
@@ -682,14 +682,20 @@
         sz = _BLKSIZEMAP[parent]
     except KeyError:
         if hasattr(os, 'statvfs'):
-            sz = os.statvfs(f)[statvfs.F_BSIZE]
+            try:
+                sz = os.statvfs(parent)[statvfs.F_BSIZE]
+            except OSError:
+                sz = 8192 # Should be a safe guess? (????)
         else:
             sz = 8192 # Should be a safe guess? (????)
         _BLKSIZEMAP[parent] = sz
         if sz > len(_NILSTR):
             _NILSTR = '\x00' * sz
     nil = _NILSTR[:sz]
-    fd = os.open(f, os.O_WRONLY|O_BINARY)
+    try:
+        fd = os.open(f, os.O_WRONLY|O_BINARY)
+    except OSError:
+        return
     try:
         size = os.fstat(fd)[stat.ST_SIZE]
         blocks = ceilDiv(size, sz)

Index: NetUtils.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/NetUtils.py,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -d -r1.6 -r1.6.2.1
--- NetUtils.py	4 Dec 2003 05:02:50 -0000	1.6
+++ NetUtils.py	18 Dec 2003 23:13:55 -0000	1.6.2.1
@@ -69,7 +69,7 @@
         inet4 = [ addr for addr in r if addr[0] == AF_INET ]
         inet6 = [ addr for addr in r if addr[0] == AF_INET6 ]
         if not (inet4 or inet6):
-            LOG.error("getIP returned no inet addresses!")
+            LOG.warn("getIP returned no inet addresses for %r",name)
             return ("NOENT", "No inet addresses returned", time.time())
         best4=best6=None
         if inet4: best4=inet4[0]
@@ -79,6 +79,8 @@
         else:
             res = best6 or best4
         assert res
+        assert res[0] in (AF_INET, AF_INET6)
+        assert nameIsStaticIP(res[1])
         protoname = (res[0] == AF_INET) and "inet" or "inet6"
         LOG.trace("Result for getIP(%r): %s:%s (%d others dropped)",
                   name,protoname,res[1],len(r)-1)
@@ -89,6 +91,7 @@
             return ("NOENT", str(e[1]), time.time())
         else:
             return ("NOENT", str(e), time.time())
+
 #----------------------------------------------------------------------
 
 _SOCKETS_SUPPORT_TIMEOUT = hasattr(socket.SocketType, "settimeout")