[apparmor] [PATCH] aa-easyprof updates
Seth Arnold
seth.arnold at canonical.com
Fri Jul 5 19:27:11 UTC 2013
On Fri, Jul 05, 2013 at 09:59:44AM -0500, Jamie Strandboge wrote:
> >> + if opt.manifest:
> >> + try:
> >> + # should hide this in a common function
> >> + if sys.version_info[0] >= 3:
> >> + f = open(opt.manifest, "r", encoding="utf-8")
> >> + else:
> >> + f = open(opt.manifest, "r")
> >> + manifest = f.read()
> >> + except OSError:
> >> + error("Manifest file '%s' does not exist\n" % opt.manifest)
> >
> > I think the exception's reason should be printed, too -- "does not
> > exist" could be wrong if the file or directory permissions forbid
> > reading the file or if there are IO errors.
> >
>
> ACK. Updated to use:
> error("Could not read '%s'\n" % opt.manifest)
Definitely better, it doesn't give any wrong hints :) but I should have
said that I'd like it to print out the errno or strerror:
http://docs.python.org/2/library/exceptions.html#exceptions.EnvironmentError
There's a chance to give to the user the exact reason why something
failed, that'd be ideal.
Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130705/a5c582c5/attachment.pgp>
More information about the AppArmor
mailing list