Hey Mark,
Sorry for the lag - been busy trying to get a new HAL release out,
On Tue, 2007-03-27 at 15:14 +0100, Mark McLoughlin wrote:
Hi,
Apologies for spamming the list with 20 mails, but hopefully
it'll make it easier to review the patches.
Yeah, it did make it easier although I'm always slighty scared when
seeing a bunch of patches ;-) - would you happen to have a git repo
handy that I can pull from?
The background to this is that I was suprised to see that
livecd-creator had rather poor error handling (e.g. not unmounting
stuff after certain errors, obscure error messages etc.) since
I thought that was the main reason to re-write pilgrim in python :-)
It's understandable, though. Because Python has exceptions,
it's easy to be fooled into thinking you have error conditions
under control, but in reality, exceptions probably makes it easier
to screw up error handling.
So, here's an attempt to fix it based on the following
guidelines:
- don't intercept an exception if you can't do something useful
with it. Corollary: intercept an exception if you can do something
useful with it.
- anticipate user errors or user-fixable system errors in a user
friendly manner. Corollary: allow other types of exceptions
to be passed to the toplevel.
- i.e. there are 3 types of errors/exceptions, and 3 different
strategies for handling them:
1) errors which we can handle ourselves without ever telling
the user - e.g. a directory which we wish to create already
exists
2) user errors, or predictable system errors, which we
should do our best to help the user out with - e.g.
a busted kickstart file or running out of loop devices
3) pathological system errors or programmer errors, all
of which can be just allowed to propogate up to the
toplevel where an ugly traceback will be printed -
e.g creating a dir under the temporary build dir
fails or an unmount fails because we didn't close
the rpmdb
- whatever the error, we should do our best to clean up files,
directories, mounts, etc. which we created
- bear in mind that e.g. Ctrl-C can happen at any time
Also, I've cleanup up various parts of the code as I
worked on the error handling. Those patches come first.
This is really good stuff, thanks a bunch for working on it. I just read
through all the patches and from a cursory look they look good to me;
tomorrow I'm going to try and actually apply them to the code [1].
I'd also like for Jeremy to sign them off as he was the last one before
you to fix up my, uh, rough bash->python conversion of the pilgrim shell
script plus he's the main guy working on this stuff these days.
Thanks again, Cheers,
David
[1] : As a practical thing would you happen to have a git repo stashed
somewhere that I can pull form?