Saurabh Vyas wrote: > And I modified TarBundle.py to raise EnvironmentError (rather than > just returning False), then the error trickle downs to gen_action & > finally caught in trans_import() & trans_generate() > > just for ref : http://cr.opensolaris.org/~saurabhv/fix-15646-rev-3/ > > does this approach seems right now ?
You're getting there, I think. But you don't need to be as explicit about catching and re-raising exceptions. For instance, your change to TarBundle.test() could simply have removed the try/except statements, and simply run the is_tarfile() function -- it would have identical functionality, and be much simpler. (Indeed, is_tarfile() wouldn't ever raise TypeError -- that's something that make_bundle() does, one level up -- so catching that isn't at all useful.) Similarly, in gen_actions(), you don't need to try/except just to re-raise. In trans_import(), you refer to "generate" in the except clauses. > This is where I need more inputs / ideas about how to handle other cases The cases you need to cover are: - pathname is a tarfile - pathname is a generic directory - pathname is an SVr4 package in directory format - pathname is an SVr4 package in datastream format - pathname is something else - pathname doesn't exist That is, handle everything that the code already handled, and add the case at the end. Other cases could (and likely should) be handled by other bugs. For instance, you could have a case to handle selected other I/O errors (other than ENOENT) without printing a stack trace, but for the purposes of fixing this bug, you don't have to. Danek _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
