[arch-projects] [devtools] [PATCH 1/2] makechrootpkg: Fix unconditionally running namcap

Eli Schwartz eschwartz at archlinux.org
Fri Sep 1 22:53:12 UTC 2017

Fixes regression in 49088b0860276c664933c2b3e36a2fef714b7a07

$run_namcap will always be set to ""
`if $not_a_var; then ...; fi` is always truthful when $not_a_var is
unset or equal to "" and the `then` clause will always be run.

I'm not entirely sure why everything had to be moved into functions
purely for the sake of being moved into functions, as it goes against
the general theme of devtools/makepkg/etc. especially since it doesn't
seem to have been thoroughly tested.
I'm also not sure why global state variables need to be cloned locally
for their sole explicit purpose.

But for now this patch implements the minimum necessary work to properly
pass the "do I want namcap" variable into prepare_chroot() according to
the current logic flow.
Note that I have still not thorougly tested makechrootpkg.

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
 makechrootpkg.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makechrootpkg.in b/makechrootpkg.in
index 664f9f6..b1c9545 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -403,7 +403,7 @@ main() {
 	download_sources "$copydir" "$makepkg_user"
-	prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir"
+	prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
 	if arch-nspawn "$copydir" \
 		--bind="$PWD:/startdir" \

More information about the arch-projects mailing list