On 09/13/12 02:00, Abhinandan Ekande wrote:
Folks,
Please review fix for CR :
7139743 license actions without a path can cause a stacktrace
webrev :
https://cr.opensolaris.org/action/browse/pkg/ae112802/7139743-rev1/webrev/
Unit testing done for both pkgsend and pkgdepend commands.
Ran the IPS test suite. All tests passed.
src/modules/actions/__init__.py:
lines 348-352: In general, when writing things in Python, the
preferred approach is to "leap first, then look". That is,
don't check for a key or value, simply perform the action and
catch the exception raised and handle it. In addition, the
exception raised here assumes that because there is no "path"
that this is a license action. That's not necessarily true.
So instead of:
if "path" in action.attrs and payload == "NOHASH":
filepath = os.path.sep + action.attrs["path"]
elif "path" not in action.attrs and payload == "NOHASH":
raise ActionDataError(_("Hash attribute is missing "
"for license action"))
...I'd try this:
if payload == "NOHASH":
try:
filepath = os.path.sep + action.attrs["path"]
except KeyError:
raise InvalidPathAttributeError(action)
src/modules/publish/dependencies.py:
I don't think this change is needed if you do the above.
We may need to tweak this, so can you try that and see what you get?
-Shawn
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss