commit:     44cc0ab2caf13a18cbb99580b91a8afe61ce9cc4
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jul  8 01:07:33 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul 13 04:19:06 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=44cc0ab2

save-ebuild-env.sh: clear triple-underscore namespace just before printing 
declarations

Presently, the __save_ebuild_env() function contains a routine that is
responsible for unsetting functions and variables whose names lead with
three consecutive underscores. Reposition this routine so that it
immediately precedes the invocations of the declare builtin that
conclude the function. This is to support an impending refactoring.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/save-ebuild-env.sh | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 5d5d25bbd7..a162334374 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -90,14 +90,6 @@ __save_ebuild_env() (
        ___eapi_has_in_iuse && unset -f in_iuse
        ___eapi_has_version_functions && unset -f ver_cut ver_rs ver_test
 
-       # Clear out the triple underscore namespace as it is reserved by the PM.
-       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 \
                DISTDIR DOC_SYMLINKS_DIR \
@@ -127,6 +119,14 @@ __save_ebuild_env() (
        # user config variables
        unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK
 
+       # Clear out the triple underscore namespace as it is reserved by the PM.
+       while IFS=' ' read -r _ _ REPLY; do
+               if [[ ${REPLY} == ___* ]]; then
+                       unset -f "${REPLY}"
+               fi
+       done < <(declare -F)
+       unset -v REPLY "${!___@}"
+
        declare -p
        declare -fp
 )

Reply via email to