Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative removed on update removes current provider's symlink #219

Closed
st3r4g opened this issue Feb 6, 2020 · 1 comment
Closed

Alternative removed on update removes current provider's symlink #219

st3r4g opened this issue Feb 6, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@st3r4g
Copy link

st3r4g commented Feb 6, 2020

After the update that removed the tar alternative group in void today, I noticed that xbps removed the symlink when bsdtar was updated, even though my current provider and owner of the symlink was gtar. Here is a test case to reproduce (please adjust test name and file placement):

diff --git a/tests/xbps/xbps-alternatives/main_test.sh b/tests/xbps/xbps-alternatives/main_test.sh
index 5dd1310d..9c235911 100644
--- a/tests/xbps/xbps-alternatives/main_test.sh
+++ b/tests/xbps/xbps-alternatives/main_test.sh
@@ -801,6 +801,45 @@ replace_alternative_with_symlink_body() {
        atf_check_equal $? 0
 }
 
+newtest_head() {
+       atf_set "descr" "Alternative removed on update removes current provider's symlink"
+}
+
+newtest_body() {
+       mkdir -p tar/usr/bin/ bsdtar/usr/bin
+       touch tar/usr/bin/gtar bsdtar/usr/bin/bsdtar
+       mkdir repo
+
+       cd repo
+       xbps-create -n tar-1.0_1 -s tar -A noarch --alternatives 'tar:tar:/usr/bin/gtar' ../tar
+       atf_check_equal $? 0
+       xbps-create -n bsdtar-1.0_1 -s bsdtar -A noarch --alternatives 'tar:tar:/usr/bin/bsdtar' ../bsdtar
+       atf_check_equal $? 0
+       xbps-rindex -a *xbps
+       atf_check_equal $? 0
+       cd ..
+
+       xbps-install -r root --repo=repo -y tar bsdtar
+       atf_check_equal $? 0
+       link=$(readlink -v root/usr/bin/tar)
+       atf_check_equal $? 0
+       atf_check_equal $link gtar
+
+       cd repo/
+       xbps-create -n bsdtar-1.0_2 -s bsdtar -A noarch ../bsdtar
+       atf_check_equal $? 0
+       xbps-rindex -a bsdtar-1.0_2.noarch.xbps
+       atf_check_equal $? 0
+       cd ..
+
+       xbps-install -r root --repo=repo -yu
+       atf_check_equal $? 0
+
+       link=$(readlink -v root/usr/bin/tar)
+       atf_check_equal $? 0
+       atf_check_equal $link gtar
+}
+
 atf_init_test_cases() {
        atf_add_test_case register_one
        atf_add_test_case register_one_dangling
@@ -821,4 +860,5 @@ atf_init_test_cases() {
        atf_add_test_case respect_current_provider
        atf_add_test_case prune_leftover_groups
        atf_add_test_case replace_alternative_with_symlink
+       atf_add_test_case newtest
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
@st3r4g and others