Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: tools/bisect-builds.py

Issue 10917277: Don't crash on corrupted archive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bisect-builds.py
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py
index 8a02b25f45b816a6c46e69afe8b6aae8e825f6e5..04b4689d4e42dd5935ff9fcb4b6b21bc11c7001f 100755
--- a/tools/bisect-builds.py
+++ b/tools/bisect-builds.py
@@ -240,29 +240,25 @@ def UnzipFilenameToDir(filename, dir):
filename = os.path.join(cwd, filename)
zf = zipfile.ZipFile(filename)
# Make base.
- try:
- if not os.path.isdir(dir):
- os.mkdir(dir)
- os.chdir(dir)
- # Extract files.
- for info in zf.infolist():
- name = info.filename
- if name.endswith('/'): # dir
- if not os.path.isdir(name):
- os.makedirs(name)
- else: # file
- dir = os.path.dirname(name)
- if not os.path.isdir(dir):
- os.makedirs(dir)
- out = open(name, 'wb')
- out.write(zf.read(name))
- out.close()
- # Set permissions. Permission info in external_attr is shifted 16 bits.
- os.chmod(name, info.external_attr >> 16L)
- os.chdir(cwd)
- except Exception, e:
- print >>sys.stderr, e
- sys.exit(1)
+ if not os.path.isdir(dir):
+ os.mkdir(dir)
+ os.chdir(dir)
+ # Extract files.
+ for info in zf.infolist():
+ name = info.filename
+ if name.endswith('/'): # dir
+ if not os.path.isdir(name):
+ os.makedirs(name)
+ else: # file
+ dir = os.path.dirname(name)
+ if not os.path.isdir(dir):
+ os.makedirs(dir)
+ out = open(name, 'wb')
+ out.write(zf.read(name))
+ out.close()
+ # Set permissions. Permission info in external_attr is shifted 16 bits.
+ os.chmod(name, info.external_attr >> 16L)
+ os.chdir(cwd)
def FetchRevision(context, rev, filename, quit_event=None, progress_event=None):
@@ -476,12 +472,18 @@ def Bisect(platform,
up_fetch.Start()
# Run test on the pivot revision.
- (status, stdout, stderr) = RunRevision(context,
- rev,
- zipfile,
- profile,
- num_runs,
- try_args)
+ status = None
+ stdout = None
+ stderr = None
+ try:
+ (status, stdout, stderr) = RunRevision(context,
+ rev,
+ zipfile,
+ profile,
+ num_runs,
+ try_args)
+ except Exception, e:
+ print >>sys.stderr, e
os.unlink(zipfile)
zipfile = None
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698