diff options
author | Kerin Millar <kfm@plushkava.net> | 2023-06-25 21:03:04 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-07-03 21:18:37 +0100 |
commit | f24dd0d9808559571509add2c8c69c1bcb2bfec6 (patch) | |
tree | c40399b087679a33a078f59fada5e7da131fafde /bin/save-ebuild-env.sh | |
parent | NEWS: update (diff) | |
download | portage-f24dd0d9808559571509add2c8c69c1bcb2bfec6.tar.gz portage-f24dd0d9808559571509add2c8c69c1bcb2bfec6.tar.bz2 portage-f24dd0d9808559571509add2c8c69c1bcb2bfec6.zip |
bin/save-ebuild-env.sh: refrain from using the compgen builtin
For the compgen builtin to be available requires that bash be compiled
with --enable-readline. Rather than rely on compgen to generate a list
of function names, parse their names out of declare -F instead.
Specify -v for the following unset command, so that bash is coerced into
unsetting only variables, as is intended.
Expand the applicable variable names with "${!___@}". Owing to the
constraints placed on identifiers, it's not particularly important that
it be done this way, but I think it better expresses the intent.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Bug: https://bugs.gentoo.org/909148
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'bin/save-ebuild-env.sh')
-rw-r--r-- | bin/save-ebuild-env.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh index bba468da1..20cd86866 100644 --- a/bin/save-ebuild-env.sh +++ b/bin/save-ebuild-env.sh @@ -83,8 +83,12 @@ __save_ebuild_env() { ___eapi_has_usex && unset -f usex # Clear out the triple underscore namespace as it is reserved by the PM. - unset -f $(compgen -A function ___) - unset ${!___*} + while IFS=' ' read -r _ _ REPLY; do + if [[ ${REPLY} == ___* ]]; then + unset -f "${REPLY}" + fi + done < <(declare -F) + unset -v REPLY "${!___@}" # portage config variables and variables set directly by portage unset ACCEPT_LICENSE BUILD_PREFIX COLS \ |