commit:     63aae2a1775e501678290c6dbeac53215decffc2
Author:     Lucio Sauer <watermanpaint <AT> posteo <DOT> net>
AuthorDate: Fri May 10 12:07:16 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 11 03:11:51 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/gentoo-bashcomp.git/commit/?id=63aae2a1

portageq envvar: fix variables selected for completion

With lines like VAR="foo" BAZ="1 2 3", \(.*\)=".*$ not only matches VAR,
but also VAR="foo" BAZ.
This applies at line ^USE=.*, where the regular USE flags are followed
by a list of all present USE_EXPAND variables together with their
respective values.

The current sed invocation also ignores environment variables that start
with a lowercase letter, such as gl_cv_compiler_check_decl_option.

Closes: https://bugs.gentoo.org/931671
Signed-off-by: Lucio Sauer <watermanpaint <AT> posteo.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 completions/portageq | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/completions/portageq b/completions/portageq
index a8a113b..7775cc4 100644
--- a/completions/portageq
+++ b/completions/portageq
@@ -48,7 +48,7 @@ _portageq() {
     # this also isn't the fastest, but I welcome an alternative method
     envvar)
         COMPREPLY=($(compgen -W "$(env -i PATH="${PATH}" emerge -v --info | \
-                sed -n -e '/^[[:upper:]].*=".*"/s/^\(.*\)=".*$/\1/p')" -- 
${cur}))
+                cut -s -d = -f 1)" -- ${cur}))
         ;;
 
     *v@(isible|ersion)|match)

Reply via email to