Compare commits

...

3 Commits

Author SHA1 Message Date
Sertonix a83dcebbff Merge branch 'shell-escape' into 'master'
abuild: improve and test shell_escape

See merge request alpine/abuild!275
2024-04-27 01:12:54 +00:00
Piraty a45d12d4c3
abuild-rootbld: copy SRCDEST value from host to chroot
Otherwise the default hardcoded in abuild-fetch (var/cache/distfiles) is
used.

(in the same vein as 6864df03aa)

Fixes: 1582617 ("abuild-rootbld: clear environment for bwrap container")
2024-04-26 00:24:09 +02:00
Sertonix 23910d50f6 abuild: improve and test shell_escape 2024-04-17 18:29:18 +02:00
2 changed files with 9 additions and 4 deletions

View File

@ -38,7 +38,7 @@ doc_threshold=$((2 * 1024 * 1024)) # 2 MiB
umask 022
shell_escape() {
echo \'${1/\'/\'\\\'\'}\'
printf %s\\n \'"${1//\'/\'\\\'\'}"\'
}
# run optional log command for remote logging
@ -2406,10 +2406,10 @@ apk_add_makedeps() {
local repo_args="--repository $(shell_escape "$REPODEST/$repo")"
[ -s "$repo_template" ] && repo_args=$(while read r; do
echo --repository "$(shell_escape "$REPODEST/${r##*/}")"
printf %s\\n "--repository $(shell_escape "$REPODEST/${r##*/}")"
done) < "$repo_template"
eval $SUDO_APK add $apk_opt_wait $repo_args \
eval "$SUDO_APK" add "$apk_opt_wait" "$repo_args" \
--virtual .${prefix}depends-$pkgname "\$@" || return
}
@ -2625,6 +2625,7 @@ rootbld() {
--setenv CARCH "$CARCH" \
--setenv HOME "$HOME" \
--setenv REPODEST "$REPODEST" \
--setenv SRCDEST "$SRCDEST" \
--setenv ABUILD_USERDIR "$ABUILD_USERDIR" \
${ABUILD_BOOTSTRAP:+--setenv ABUILD_BOOTSTRAP "$ABUILD_BOOTSTRAP"} \
${APORTS_BOOTSTRAP:+--setenv APORTS_BOOTSTRAP "$APORTS_BOOTSTRAP"} \

View File

@ -1181,7 +1181,7 @@ create_mock_apk() {
echo 'aarch64'
exit 0
fi
echo apk "\$@" >&2
printf 'apk %s\n' "\$*" >&2
EOF
chmod +x bin/apk
ln -s apk bin/abuild-apk
@ -1242,4 +1242,8 @@ abuild_deps_body() {
-e not-match:'apk add.*--arch armhf.*builddep' \
abuild deps
# Check shell_escape
atf_check \
-e match:"apk add .*--repository It's \\\\b'\"\"' \"escaped\"/.*" \
abuild -P "It's \b'\"\"' \"escaped\"" deps
}