Merge lp:~gary-lasker/software-center/fix-shutdown-crash-lp996333 into lp:software-center
Proposed by
Gary Lasker
Status: | Merged |
---|---|
Merged at revision: | 3006 |
Proposed branch: | lp:~gary-lasker/software-center/fix-shutdown-crash-lp996333 |
Merge into: | lp:software-center |
Diff against target: |
189 lines (+77/-34) 4 files modified
softwarecenter/config.py (+20/-5) softwarecenter/log.py (+2/-6) softwarecenter/utils.py (+37/-22) test/test_utils.py (+18/-1) |
To merge this branch: | bzr merge lp:~gary-lasker/software-center/fix-shutdown-crash-lp996333 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Vogt | Approve | ||
Review via email: mp+105027@code.launchpad.net |
Description of the change
This branch fixes bug 996333, which is a crash that can occur if an error is encountered when writing out the software center config file on shutdown. Note that this crash has the nasty side-effect of blocking shutdown, so software-center never exits.
I've also added logging for errors that occur when both writing and reading the config file.
Many thanks for your review!
To post a comment you must log in.
Great that you found the root cause of the issue! The fix is fine, just some thoughts below:
I currently see two conditions for the failure:
a) a file that can not be written exists, so we could use os.access(path, os.W_OK) and try unlink the file
b) disk full, nothing we can do
I think it would be good to add a bit of code that tries to auto-correct (a). Code in softwarecenter/ log.py
is a good example for this:
# according to bug 688682 many people have a non-writeable logfile exists( logfile_ path) and not os.access( logfile_ path, os.W_OK):
logging. warn("trying to fix non-writeable logfile")
os.remove( logfile_ path)
logging. exception( "failed to fix non-writeable logfile")
if os.path.
try:
except:
Do you think you could add this ? Maybe adding a "ensure_writable()" helper to utils.py to reuse the
code from log.py ?