I'm attaching patches that fix two issues related to the completion of portageq envvar: First, when any of Portage's env vars that undergo command validation are set to a relative value, portageq envvar <tab><tab> raises warnings, because it cannot find the binary with an empty PATH. e.g. `portageq envvar <tab><tab> PORTAGE_BZIP2_COMMAND setting is invalid: 'bzip2' PORTAGE_BZIP2_COMMAND setting from make.globals is invalid: 'bzip2'` Second, portageq envvar <tab<tab> completes incorrect values, because for lines such as USE="foo" ABI_X86="64", sed not only matches `USE` but also `USE="foo" ABI_X86`. Also lowercase variables such as gl_cv_compiler_check_decl_option are missing. Reproducible: Always Steps to Reproduce: First issue 1. echo PORTAGE_BZIP2_COMMAND="bzip2" >> /etc/portage/make.conf 2. portageq envvar <tab><tab> --- Second issue 1. Set at least USE=".." and one USE_EXPAND flag in /etc/portage/make.conf 2. Observe the output of portageq envvar <tab><tab> Actual Results: First issue portageq envvar <tab><tab> PORTAGE_BZIP2_COMMAND setting is invalid: 'bzip2' PORTAGE_BZIP2_COMMAND setting from make.globals is invalid: 'bzip2 --- Second issue portageq envvar <tab><tab> [snip] USE=X [snip] acl actions [snip] Expected Results: First issue No warnings. --- Second issue No individual USE flags pollute the output and no variable is missing. Portage 3.0.63 (python 3.11.9-final-0, default/linux/amd64/23.0/split-usr/hardened/selinux, gcc-13, glibc-2.38-r13, 6.6.21-gentoo-x86_64 x86_64) ================================================================= System uname: Linux-6.6.21-gentoo-x86_64-x86_64-Intel-R-_Core-TM-_i5-6600K_CPU_@_3.50GHz-with-glibc2.38 KiB Mem: 16340720 total, 10074468 free KiB Swap: 33554428 total, 33554428 free Timestamp of repository gentoo: Fri, 10 May 2024 11:05:00 +0000 Head commit of repository gentoo: 687a9f6445e70191bd23a16e0a72349131272588 Timestamp of repository gentoo-zh: Fri, 10 May 2024 08:33:41 +0000 Head commit of repository gentoo-zh: c80269dae18d4ba1412eb5cbaee3a9e9e4d5b55f Timestamp of repository guru: Fri, 10 May 2024 07:48:39 +0000 Head commit of repository guru: 91115b24a2b0f78092c5a8071e54e1cfb12dde2e Timestamp of repository steam-overlay: Wed, 08 May 2024 18:51:40 +0000 Head commit of repository steam-overlay: 2577a2d14477e11e3a2d0abb748f12214d5a25d3 sh bash 5.1_p16-r6 ld GNU ld (Gentoo 2.41 p5) 2.41.0 app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.1_p16-r6::gentoo dev-build/autoconf: 2.13-r8::gentoo, 2.71-r7::gentoo dev-build/automake: 1.16.5-r2::gentoo dev-build/cmake: 3.28.3::gentoo dev-build/libtool: 2.4.7-r4::gentoo dev-build/make: 4.4.1-r1::gentoo dev-build/meson: 1.4.0-r1::gentoo dev-java/java-config: 2.3.3-r1::gentoo dev-lang/perl: 5.38.2-r3::gentoo dev-lang/python: 3.11.9::gentoo, 3.12.3::gentoo dev-lang/rust: 1.77.1::gentoo sec-policy/selinux-base: 2.20240226-r1::gentoo sys-apps/baselayout: 2.15::gentoo sys-apps/openrc: 0.54::gentoo sys-apps/sandbox: 2.38::gentoo sys-devel/binutils: 2.41-r5::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/clang: 17.0.6::gentoo sys-devel/gcc: 13.2.1_p20240210::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/lld: 17.0.6::gentoo sys-devel/llvm: 17.0.6::gentoo sys-kernel/linux-headers: 6.6-r1::gentoo (virtual/os-headers) sys-libs/glibc: 2.38-r13::gentoo sys-libs/libselinux: 3.6-r1::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: False sync-rsync-verify-max-age: 24 sync-rsync-verify-metamanifest: yes sync-rsync-extra-opts: sync-rsync-verify-jobs: 1 gentoo-zh location: /var/db/repos/gentoo-zh sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo-zh.git masters: gentoo priority: -1 volatile: False guru location: /var/db/repos/guru sync-type: git sync-uri: https://github.com/gentoo-mirror/guru.git masters: gentoo volatile: False local location: /var/db/repos/local masters: guru gentoo volatile: True steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo volatile: False Installed sets: @gentoodev, @optdeps, @uni ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS="--quiet-build" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" FCFLAGS="-march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=native -O2 -pipe -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing" GENTOO_MIRRORS="https://mirror.init7.net/gentoo/ https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ https://mirror.leaseweb.com/gentoo/ https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs" LEX="flex" MAKEOPTS="-j4" PKGDIR="/home/queenie/Downloads/repos/gentoo/containers/binpkgs" PORTAGE_BZIP2_COMMAND="/bin/bzip2" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" RUSTFLAGS="-C target-cpu=native" SHELL="/bin/bash" USE="X acl amd64 audit bzip2 caps clang crypt dbus elogind emacs gdbm hardened iconv ipv6 jpeg libtirpc lto man matroska metric multilib ncurses openmp pam pcre pgo pic pie png policykit pulseaudio readline seccomp selinux split-usr ssl ssp test-rust unicode xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="NVPTX" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS
Created attachment 892657 [details, diff] Patch to fix command validation warnings I also thought about not purging the environment before running emerge -v --info, but I believe we should avoid completing variables that Portage should ignore anyways (?).
Created attachment 892658 [details, diff] Patch to fix variables selected for completion
Created attachment 892659 [details, diff] Patch to fix variables selected for completion -- v2 I added this bug to the `Closes:` commit tag.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/gentoo-bashcomp.git/commit/?id=63aae2a1775e501678290c6dbeac53215decffc2 commit 63aae2a1775e501678290c6dbeac53215decffc2 Author: Lucio Sauer <watermanpaint@posteo.net> AuthorDate: 2024-05-10 12:07:16 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-05-11 03:11:51 +0000 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@posteo.net> Signed-off-by: Sam James <sam@gentoo.org> completions/portageq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thank you! I forgot to add the bug tag to the first commit. commit aa32f1e126bdf947efc012d4d6b93a7150d74b24 Author: Lucio Sauer <watermanpaint@posteo.net> Date: Fri May 10 13:59:16 2024 +0200 portageq envvar: preserve PATH to avoid command validation warnings Some of Portage's environment variables undergo command validation. When one is set to a relative value, Portage relies on PATH to find the binary. We need to preserve it after purging the environment (`env -i`) if we want to avoid "<key> is invalid: <value>" warnings. For Portage 3.0.63, this affects PORTAGE_{B{,UN}ZIP2_COMMAND,LOG_FILTER_FILE_CMD}. Bug: https://bugs.gentoo.org/588642 Signed-off-by: Lucio Sauer <watermanpaint@posteo.net> Signed-off-by: Sam James <sam@gentoo.org> I'll make a new release, but please feel free to send any other patches for gentoo-bashcomp too. Thanks again!
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5af5f9898cfe42bbff09e720ce6ccd7eb1e002db commit 5af5f9898cfe42bbff09e720ce6ccd7eb1e002db Author: Sam James <sam@gentoo.org> AuthorDate: 2024-05-11 03:14:34 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-05-11 03:14:34 +0000 app-shells/gentoo-bashcomp: add 20240511 Lucio Sauer (2): portageq envvar: preserve PATH to avoid command validation warnings portageq envvar: fix variables selected for completion Sam James (8): completions/emerge: add additional options completions/emerge: add --verbose-conflicts completions/emerge: add --with-test-deps helpers/gentoo-common.sh: fix whitespace completions/emerge: add --changed-* options completions/emerge: add various further options completions/emerge: fix indentation Makefile: bzip2 -> xz Bug: https://bugs.gentoo.org/588642 Bug: https://bugs.gentoo.org/931671 Signed-off-by: Sam James <sam@gentoo.org> app-shells/gentoo-bashcomp/Manifest | 1 + .../gentoo-bashcomp/gentoo-bashcomp-20240511.ebuild | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+)