Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow start on full disk #271

Merged
merged 1 commit into from Nov 24, 2015
Merged

Conversation

quozl
Copy link
Contributor

@quozl quozl commented Nov 23, 2015

When disk is full, Sugar will not start, because the backup log directory cannot be created.

X session logs in tmpfs show this exception:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/jarabe/main.py", line 20, in <module>
    logger.cleanup()
  File "/usr/lib/python2.7/site-packages/sugar3/logger.py", line 113, in cleanup
    os.mkdir(backup_dir)
OSError: [Errno 28] No space left on device:
    '/home/user/.sugar/default/logs/1448258018'

Fix is to ignore the exception.

We've been here before! Was previously fixed in 2010:

But new regression introduced in 2012 during reorganisation of code by Daniel Narvaez; the exception was no longer handled:

Reported-by: Nathan Riddle nathanr333@charter.net
Tested-by: James Cameron quozl@laptop.org

When disk is full, Sugar will not start, because the backup log
directory cannot be created.

X session logs in tmpfs show this exception:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/jarabe/main.py", line 20, in <module>
    logger.cleanup()
  File "/usr/lib/python2.7/site-packages/sugar3/logger.py", line 113, in cleanup
    os.mkdir(backup_dir)
OSError: [Errno 28] No space left on device: '/home/user/.sugar/default/logs/1448258018'

Fix is to ignore the exception.

We've been here before!  Was previously fixed in 2010:

	sugarlabs/sugar@4cde481
	https://bugs.sugarlabs.org/ticket/1720
	http://dev.laptop.org/ticket/9623

But new regression introduced in 2012 during reorganisation of
code by Daniel Narvaez; the exception was no longer handled:

	sugarlabs/sugar@0e45f9d
	sugarlabs/sugar@19db9c5

Reported-by: Nathan Riddle <nathanr333@charter.net>
Tested-by: James Cameron <quozl@laptop.org>
@samdroid-apps samdroid-apps added this to the 0.108 milestone Nov 23, 2015
os.rename(source_path, dest_path)
try:
os.mkdir(backup_dir)
for log in backup_logs:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we put the renaming outside the try? Moving a file doesn't use space does it?

@samdroid-apps
Copy link
Contributor

Looks like a good fix. See comments on the patch

@quozl
Copy link
Contributor Author

quozl commented Nov 23, 2015

Yes, a rename may consume space, especially on jffs2. But if mkdir fails there's no point in doing rename, because the target directory probably does not exist. So then yet another try except is needed to protect the rename.

Yes, "as e" is the new syntax, but that's a separate issue. I would reject a patch that used inconsistent coding style while fixing a bug. There are 17 other places in sugar-toolkit-gtk3 and 57 such in sugar. You might want to submit a patch for that later?

@samdroid-apps
Copy link
Contributor

OK, I'll merge this arvo.

Re as: if ya want. It's not a biggie. We can probably wait until we want
to go python 3 to move it. I think we were blocked on telepathy python.

On Tue, Nov 24, 2015, 7:35 AM James Cameron notifications@github.com
wrote:

Yes, a rename may consume space, especially on jffs2. But if mkdir fails
there's no point in doing rename, because the target directory probably
does not exist. So then yet another try except is needed to protect the
rename.

Yes, "as e" is the new syntax, but that's a separate issue. I would reject
a patch that used inconsistent coding style while fixing a bug. There are
17 other places in sugar-toolkit-gtk3 and 57 such in sugar. You might want
to submit a patch for that later?


Reply to this email directly or view it on GitHub
#271 (comment)
.

@samdroid-apps samdroid-apps merged commit 280c74c into sugarlabs:master Nov 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants