summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2024-04-17 08:20:10 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2024-04-17 08:35:27 +0200
commit645c3c07a7d6ae501822f381fd65baf944530389 (patch)
treeeec5de6f0086edd38897a605fc5a4b91d53bb0cc
parente4896c01b88a11052ba54ae2bc750687f5bcf30a (diff)
abuild: exclude provides for commans with @
the '@' characted serves as a repository separator (eg. pkg@repo) so we should not add a cmd: provides for binaries having this character. This avoids conflicts with for example `who` from coreutils and `who@` from ucspi-tpc6. fixes https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10074
-rw-r--r--abuild.in7
-rwxr-xr-xtests/abuild_test2
2 files changed, 9 insertions, 0 deletions
diff --git a/abuild.in b/abuild.in
index 9951dba..3e41902 100644
--- a/abuild.in
+++ b/abuild.in
@@ -1299,6 +1299,13 @@ prepare_command_provides() {
if ! [ -x "$i" ] || ! [ -f "$i" ]; then
continue
fi
+ # exclude any provides: lines for commands that has '@' because '@'
+ # is used as seperator between command name and repository. This
+ # avoids potential conflicts
+ # ref: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10074
+ case "$i" in
+ *@*) continue;;
+ esac
local f=${i##*/}
echo $f >> "$controldir"/.provides-command
done
diff --git a/tests/abuild_test b/tests/abuild_test
index 7e500d1..f358e56 100755
--- a/tests/abuild_test
+++ b/tests/abuild_test
@@ -1056,6 +1056,7 @@ abuild_command_provides_body() {
mkdir -p "\$pkgdir/usr/bin"
printf "%s\n" '#!/bin/sh' >"\$pkgdir/usr/bin/foo"
chmod +x "\$pkgdir/usr/bin/foo"
+ cp -a "\$pkgdir/usr/bin/foo" "\$pkgdir/usr/bin/foo@"
mkdir -p "\$pkgdir/usr/bin/dir/"
}
EOF
@@ -1063,6 +1064,7 @@ abuild_command_provides_body() {
atf_check \
-o match:"provides = cmd:foo=1.0-r0" \
+ -o not-match:"provides = cmd:foo@=1.0-r0" \
-o not-match:"provides = cmd:dir=1.0-r0" \
grep '^provides = ' pkg/.control.testprovides/.PKGINFO
}