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
This commit is contained in:
Natanael Copa 2024-04-17 08:20:10 +02:00
parent e4896c01b8
commit 645c3c07a7
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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
}