Bug 464080 Lock .jar files before opening them r=Pike
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Mon, 24 Nov 2008 16:48:24 +0000
changeset 21874 2f0fe196aa893ff1ab6285d24e18f158412e4965
parent 21873 51249e968f249def386436609c6f2950197e2061
child 21875 aabb881ffaafb06fca8a65b6833e31e720df96ad
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersPike
bugs464080
milestone1.9.1b2pre
Bug 464080 Lock .jar files before opening them r=Pike CLOSED TREE
config/MozZipFile.py
--- a/config/MozZipFile.py
+++ b/config/MozZipFile.py
@@ -45,25 +45,25 @@ from utils import lockFile
 class ZipFile(zipfile.ZipFile):
   """ Class with methods to open, read, write, close, list zip files.
 
   Subclassing zipfile.ZipFile to allow for overwriting of existing
   entries, though only for writestr, not for write.
   """
   def __init__(self, file, mode="r", compression=zipfile.ZIP_STORED,
                lock = False):
-    zipfile.ZipFile.__init__(self, file, mode, compression)
-    self._remove = []
-    self.end = self.fp.tell()
-    self.debug = 0
     if lock:
       assert isinstance(file, basestring)
       self.lockfile = lockFile(file + '.lck')
     else:
       self.lockfile = None
+    zipfile.ZipFile.__init__(self, file, mode, compression)
+    self._remove = []
+    self.end = self.fp.tell()
+    self.debug = 0
 
   def writestr(self, zinfo_or_arcname, bytes):
     """Write contents into the archive.
 
     The contents is the argument 'bytes',  'zinfo_or_arcname' is either
     a ZipInfo instance or the name of the file in the archive.
     This method is overloaded to allow overwriting existing entries.
     """