Ticket #1876: 0001-Failure-to-cleanup-temporary-files-after-filesystem-.patch

File 0001-Failure-to-cleanup-temporary-files-after-filesystem-.patch, 1.0 KB (added by alsroot, 14 years ago)
  • bin/sugar-session

    From 3a8d812b6988ed2258ad219b22a256c29910849b Mon Sep 17 00:00:00 2001
    From: Aleksey Lim <alsroot@member.fsf.org>
    Date: Wed, 2 Jun 2010 10:31:14 +0000
    Subject: Failure to cleanup temporary files after filesystem full errors #1876
    
    
    diff --git a/bin/sugar-session b/bin/sugar-session
    old mode 100644
    new mode 100755
    index 1582b65..cc8358c
    a b import os 
    2020import sys
    2121import time
    2222import subprocess
     23import shutil
    2324
    2425if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug':
    2526    print '%r STARTUP: Starting the shell' % time.time()
    def set_fonts(): 
    203204def main():
    204205    try:
    205206        from sugar import env
     207        # Remove temporary files. See http://bugs.sugarlabs.org/ticket/1876
     208        data_dir = os.path.join(env.get_profile_path(), 'data')
     209        shutil.rmtree(data_dir, ignore_errors=True)
     210        os.makedirs(data_dir)
    206211        cleanup_logs(env.get_logs_path())
    207212    except OSError, e:
    208213        # logs cleanup is not critical; it should not prevent sugar from