commit:     463af696914237bc6e210306fbc2f09f3a1005ce
Author:     Raul E Rangel <rrangel <AT> chromium <DOT> org>
AuthorDate: Thu Nov 10 04:26:18 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 13 10:19:00 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=463af696

bin/phase-functions: Move du stats into subshell

These variables are only used inside this subshell. This avoids
polluting the environment.

Apparently this calculation isn't hermetic. I'm not sure why:

@@ -268,10 +268,10 @@
 declare -x cros_setup_hooks_run="booya"
 declare -a exclude_hermetic=([0]="--exclude-non-hermetic")
 declare -- f
-declare -a isz=([0]="264" [1]="/var/tmp/portage/dev-libs/libffi-3.1-r8/image/")
-declare -a nsz=([0]="2803" [1]="/var/tmp/portage/dev-libs/libffi-3.1-r8/work")
+declare -a isz=([0]="16" [1]="/var/tmp/portage/dev-libs/libffi-3.1-r8/image/")
+declare -a nsz=([0]="2599" [1]="/var/tmp/portage/dev-libs/libffi-3.1-r8/work")
 declare -- phase_func
 __eapi6_src_install ()

Bug: https://bugs.gentoo.org/914441
Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/phase-functions.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 071941ff72..cd672a878c 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -620,12 +620,11 @@ __dyn_install() {
 
        # record build & installed size in build log
        if type -P du &>/dev/null; then
-               local nsz=( $(du -ks "${WORKDIR}") )
-               local isz=( $(du -ks "${D}") )
-
                # subshell to avoid polluting the caller env with the helper
                # functions below
                (
+                       local nsz=( $(du -ks "${WORKDIR}") )
+                       local isz=( $(du -ks "${D}") )
                        # align $1 to the right to the width of the widest of 
$1 and $2
                        padl() {
                                local s1=$1

Reply via email to