From: Zac Medico Date: Fri, 15 Aug 2008 17:19:50 +0000 (-0000) Subject: In order to avoid an unhandled InvalidAtom exception, validate atoms from X-Git-Tag: v2.2_rc9~88 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=09ac9d49e8fc3f50d0be5fb7a9acb54c32e865b9;p=portage.git In order to avoid an unhandled InvalidAtom exception, validate atoms from command line arguments before passing them to unmerge(). Thanks to Cardoe for reporting. svn path=/main/trunk/; revision=11413 --- diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index d21960449..fcf4ab4a8 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -13678,6 +13678,20 @@ def emerge_main(): elif myaction in ("clean", "unmerge") or \ (myaction == "prune" and "--nodeps" in myopts): validate_ebuild_environment(trees) + + # Ensure atoms are valid before calling unmerge(). + # For backward compat, leading '=' is not required. + for x in myfiles: + if is_valid_package_atom(x) or \ + is_valid_package_atom("=" + x): + continue + msg = [] + msg.append("'%s' is not a valid package atom." % (x,)) + msg.append("Please check ebuild(5) for full details.") + writemsg_level("".join("!!! %s\n" % line for line in msg), + level=logging.ERROR, noiselevel=-1) + return 1 + # When given a list of atoms, unmerge # them in the order given. ordered = myaction == "unmerge"