commit: 5746a0538af080ee4953f5bb43c61852ba4fff72
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 10 03:18:42 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 5 11:22:06 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5746a053
phase-functions.sh: treat the {i,n}sz variables as scalar in __dyn_install()
Capture the output of du(1) without relying on word splitting behaviour.
Instead, strip the unwanted field afterwards. This eliminates two SC2207
warnings.
Rectify two SC2086 warnings by quoting the expansions conveyed to the
size() helper function.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/phase-functions.sh | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index a35cd5129e..ed32073111 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -634,8 +634,13 @@ __dyn_install() {
(
hash du 2>/dev/null || exit 0
- local nsz=( $(du -ks "${WORKDIR}") )
- local isz=( $(du -ks "${D}") )
+ local nsz isz
+
+ nsz=$(du -ks "${WORKDIR}")
+ isz=$(du -ks "${D}")
+ nsz=${nsz%% *}
+ isz=${isz%% *}
+
# align $1 to the right to the width of the widest of $1 and $2
padl() {
local s1=$1
@@ -676,8 +681,8 @@ __dyn_install() {
fi
echo "${out}"
}
- einfo "Final size of build directory: $(size ${nsz[0]}
${isz[0]})"
- einfo "Final size of installed tree: $(size ${isz[0]}
${nsz[0]})"
+ einfo "Final size of build directory: $(size "${nsz}" "${isz}")"
+ einfo "Final size of installed tree: $(size "${isz}" "${nsz}")"
)
__vecho