[Sugar-devel] [PATCH 1/2] This fixes part of http://bugs.sugarlabs.org/ticket/1876 .
Aleksey Lim
alsroot at member.fsf.org
Fri May 7 06:23:18 EDT 2010
On Thu, May 06, 2010 at 01:41:54PM +0200, Tomeu Vizoso wrote:
> On Wed, May 5, 2010 at 09:37, Aleksey Lim <alsroot at member.fsf.org> wrote:
> > On Tue, May 04, 2010 at 07:25:12PM -0400, Bernie Innocenti wrote:
> >> To reclaim space in case of a crash, we also need to delete temporary
> >> files at startup time. The rest of the bug is addressed by a separate
> >> patch in sugar-toolkit.
> >>
> >> Signed-off-by: Bernie Innocenti <bernie at codewiz.org>
> >> ---
> >> bin/sugar.in | 3 +++
> >> 1 files changed, 3 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/bin/sugar.in b/bin/sugar.in
> >> index b9f467c..4a5e523 100644
> >> --- a/bin/sugar.in
> >> +++ b/bin/sugar.in
> >> @@ -19,4 +19,7 @@ fi
> >> matchbox-window-manager -use_titlebar no -theme sugar \
> >> -kbdconfig @prefix@/share/sugar/data/kbdconfig &
> >>
> >> +# Remove temporary files. See http://bugs.sugarlabs.org/ticket/1876
> >> +rm -rf $HOME/.sugar/default/data/*
> >
> > code should not rely on using only "default" profile, so it could be:
> > (because it's pretty useless to count profile directory in several placess)
> >
> > diff --git a/bin/sugar-session b/bin/sugar-session
> > old mode 100644
> > new mode 100755
> > index 1582b65..4eb052b
> > --- a/bin/sugar-session
> > +++ b/bin/sugar-session
> > @@ -20,6 +20,7 @@ import os
> > import sys
> > import time
> > import subprocess
> > +import shutil
> >
> > if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug':
> > print '%r STARTUP: Starting the shell' % time.time()
> > @@ -204,6 +205,10 @@ def main():
> > try:
> > from sugar import env
> > cleanup_logs(env.get_logs_path())
> > + # Remove temporary files. See http://bugs.sugarlabs.org/ticket/1876
> > + data_dir = os.path.join(env.get_profile_path(), 'data')
> > + shutil.rmtree(data_dir, ignore_errors=True)
> > + os.makedirs(data_dir)
>
> Shouldn't we remove those files before cleanup_logs() because that one
> can fail if disk is full (based on the commend below)?
yeah, good catch
>
> Regards,
>
> Tomeu
>
> > except OSError, e:
> > # logs cleanup is not critical; it should not prevent sugar from
> > # starting if (for example) the disk is full or read-only.
> >
> >> +rm -rf $HOME/.sugar/default/data/*
> >
> >> +
> >> exec sugar-session
> >> --
> >> 1.7.0.1
> >>
> >> _______________________________________________
> >> Sugar-devel mailing list
> >> Sugar-devel at lists.sugarlabs.org
> >> http://lists.sugarlabs.org/listinfo/sugar-devel
> >>
> >
> > --
> > Aleksey
> >
>
--
Aleksey
More information about the Sugar-devel
mailing list