Ticket #1876: 0001-sl-1876-cleanup-partially-extracted-bundle-on-filesy.patch

File 0001-sl-1876-cleanup-partially-extracted-bundle-on-filesy.patch, 1.9 KB (added by bernie, 14 years ago)

Patch by Martin Dangler

  • src/sugar/bundle/bundle.py

    From a16dc2ffe3037da5f5db210a5108e58f8c4e70b9 Mon Sep 17 00:00:00 2001
    From: Martin Dengler <martin@martindengler.com>
    Date: Mon, 26 Apr 2010 16:16:52 -0400
    Subject: [PATCH] sl#1876: cleanup partially extracted bundle on filesystem error
    Organization: Sugar Labs Foundation
    X-Subversion: sucks
    
    This patch solves the most severe issue in #1876: filling up the
    filesystem with temporary files that won't be deleted afterwards.
    
    Before we can consider this bug completely fixed, we still need
    to do something for the remaining issues:
    
     1) Unpacking shouldn't be attempted if there isn't a safety margin
    
     2) System becomes unresponsive during unpacking
    
     3) No progress indication for the operation, so users are tempted
        to click multiple times
    
     4) No error messages displayed for unpacking errors, which is a
        common Sugar nuisance.
    
    http://bugs.sugarlabs.org/ticket/1876#comment:5 offers possible
    strategies for (1) and (2).
    
    Signed-off-by: Martin Dengler <martin@martindengler.com>
    Signed-off-by: Bernie Innocenti <bernie@codewiz.org>
    ---
     src/sugar/bundle/bundle.py |    7 ++++++-
     1 files changed, 6 insertions(+), 1 deletions(-)
    
    diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
    index c9763a0..a04c873 100644
    a b class Bundle(object): 
    7272        if os.path.isdir(self._path):
    7373            self._zip_file = None
    7474        else:
    75             self._zip_file = zipfile.ZipFile(self._path)
     75            try:
     76                self._zip_file = zipfile.ZipFile(self._path)
     77            except (zipfile.error, LargeZipFile), ziperror:
     78                raise MalformedBundleException(
     79                    "Error accessing zip file %s: %s"
     80                    % (self._path, ziperror))
    7681            self._check_zip_bundle()
    7782
    7883        # manifest = self._get_file(self._infodir + '/contents')