Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 497912 - app-portage/gentoolkit- Incorrect parsing of the package atom in euse, missing several valid package strings
Summary: app-portage/gentoolkit- Incorrect parsing of the package atom in e...
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Portage Tools Team
: 507356 (view as bug list)
Depends on:
Reported: 2014-01-12 17:08 UTC by Ilya Mochalov
Modified: 2016-08-15 14:34 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Mochalov 2014-01-12 17:08:45 UTC
Incorrect parsing of the package atom in euse, if the digit is at the end of the package name.

Reproducible: Always

Steps to Reproduce:
euse -p sys-fs/lvm2 -D thin
Actual Results:  
Adding "sys-fs/lvm2[-thin]" use flag in "/etc/portage/package.use"

Expected Results:  
ERROR: Invalid package atom. Did you forget the leading '='?

Maybe this fix, but I'm not sure that it will not break something else.

--- /usr/bin/euse	2013-12-02 08:45:48.000000000 +0600
+++ /usr/bin/euse	2014-01-12 22:56:23.793372987 +0600
@@ -1015,7 +1015,7 @@
 # Environment:
 # PACKAGE - Package atom for which to remove flag
 scrub_use_flag() {
-	local atom_re="^[<>]?=?([a-z][\da-z/-]+[a-z])(-[0-9pr._*-]+)?"
+	local atom_re="^[<>]?=?([a-z][\da-z/-]+[0-9a-z])(-[0-9pr._*-]+)?"
 	local filename=${1}
 	# Ignore leading - on flag
 	local flag=${2#*-}
@@ -1074,7 +1074,7 @@
 modify_package() {
-	local atom_re="^[<>]?=?([a-z][0-9a-z/-]+[a-z])(-[0-9pr._*-]+)?"
+	local atom_re="^[<>]?=?([a-z][0-9a-z/-]+[0-9a-z])(-[0-9pr._*-]+)?"
 	local pkg=$(echo "${PACKAGE}" | sed -re "s/${atom_re}/\1/")
 	local V=$(echo "${PACKAGE}" | sed -re "s/${atom_re}/\2/")
 	local pkg_re="[<>]?=?${pkg}(-[\dpr._*-]+)?"
Comment 1 Pacho Ramos gentoo-dev 2014-05-25 14:38:41 UTC
*** Bug 507356 has been marked as a duplicate of this bug. ***
Comment 2 Brian Evans Gentoo Infrastructure gentoo-dev 2016-08-15 14:34:23 UTC
In addition to not having a number at the end, it also does not account for:

having + on the end (i.e. x11-libs/gtk+ )
containing a _ in the package name (i.e. net-wireless/wpa_supplicant)

Perhaps a way too hook into the portage API would be better? Something with portageq perhaps?