Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 671182 - >=dev-lang/rust{,-bin}-1.30.1: cargo symlink missing
Summary: >=dev-lang/rust{,-bin}-1.30.1: cargo symlink missing
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords:
: 671212 671220 671260 671386 671408 671474 671600 671748 671794 672224 672276 672304 672488 676860 676936 676944 676978 677004 677164 684072 688048 688262 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-11-15 11:38 UTC by Thomas Deutschmann (RETIRED)
Modified: 2019-06-18 06:18 UTC (History)
29 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-15 11:38:12 UTC
Now that dev-util/cargo is integrated into >=dev-lang/rust{,-bin}-1.30.1 again every user upgrading will see that dev-util/cargo will be unmerged as part of the upgrade process (see bug 671150) but

> eselect rust update --if-unset

which will be called in pkg_postinst won't create "/usr/bin/cargo" symlink with the result that any package requiring cargo will complain about missing cargo.

Once you manually run

> eselect rust list
> eselect rust set <number>

and select >=rust-1.30.1, the symlink will be created but this isn't a good upgrade experience.

If we cannot do that better please display at least an ewarn to tell people to manually check symlinks/call eselect.
Comment 1 Dirkjan Ochtman (RETIRED) gentoo-dev 2018-11-15 12:37:22 UTC
I agree that the current situation sucks, but I find the eselect code pretty messy and so I don't really want to make involved changes to it. Not sure if any other Rust team members have ideas how to fix this cleanly?

As for an ewarn message, how about something like this?

"cargo is now installed from dev-lang/rust{,-bin} instead of dev-util/cargo. This might have resulted in a dangling symlink for /usr/bin/cargo on some systems. This can be resolved by calling `sudo eselect rust set ${P}`."
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-15 19:14:54 UTC
*** Bug 671212 has been marked as a duplicate of this bug. ***
Comment 3 Brian Evans (RETIRED) gentoo-dev 2018-11-15 20:26:24 UTC
*** Bug 671220 has been marked as a duplicate of this bug. ***
Comment 4 Arfrever Frehtes Taifersar Arahesis 2018-11-15 21:01:14 UTC
It would be easier if 'eselect rust' provided 'show' action...

Anyway:

pkg_postinst() {
    eselect rust update --if-unset
    # Re-set active version to restore cargo symlink.
    rust_active_version=$(readlink "${EROOT}/usr/bin/rustc")
    rust_active_version=${rust_active_version##*/}
    rust_active_version=${rust_active_version/rustc-/rust-}
    eselect rust set "${rust_active_version}"
Comment 5 Arfrever Frehtes Taifersar Arahesis 2018-11-15 21:02:46 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #4)
> pkg_postinst() {
>     eselect rust update --if-unset
>     # Re-set active version to restore cargo symlink.
>     rust_active_version=$(readlink "${EROOT}/usr/bin/rustc")
>     rust_active_version=${rust_active_version##*/}
>     rust_active_version=${rust_active_version/rustc-/rust-}
>     eselect rust set "${rust_active_version}"

And with 'local':

pkg_postinst() {
    eselect rust update --if-unset
    # Re-set active version to restore cargo symlink.
    local rust_active_version=$(readlink "${EROOT}/usr/bin/rustc")
    rust_active_version=${rust_active_version##*/}
    rust_active_version=${rust_active_version/rustc-/rust-}
    eselect rust set "${rust_active_version}"
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-15 21:07:36 UTC
From my understand we cannot solve the problem within pkg_* from dev-lang/rust{,-bin} because /usr/bin/cargo is never owned by dev-lang/rust{,-bin} but sometimes owned by dev-util/cargo which will be removed *after* merging dev-lang/rust{,-bin} and calling "eselect rust...".

I think dev-util/cargo would also need to call "eselect rust" with an option to check/restore symlinks after unmerge. But at the moment we only check "-e "${EROOT}"/usr/bin/rustc" which is true and return. But we have to check all files from provider list.
Comment 7 Arfrever Frehtes Taifersar Arahesis 2018-11-15 22:18:00 UTC
There appears to be no way to automatically achieve desired result.
(Except pkg_postinst() of dev-lang/rust{,-bin} directly manipulating dev-util/cargo's CONTENTS file in VDB...)

In this case, maybe the best solution would be to change soft blocker (!dev-util/cargo) to hard blocker (!!dev-util/cargo).
This would force users to uninstall dev-util/cargo before updating dev-lang/rust{,-bin}, and after update, /usr/bin/cargo symlink would be re-created.

ewarn message is likely to be missed by many users.
Comment 8 Helmut Jarausch 2018-11-16 11:08:08 UTC
I don't see any relevant comment in my elogs.

Here, installing dev-lang/rust-1.30.1-r1 seems to have uninstall dev-util/cargo

And no symlink has been installed.
Therefore installing firefox/thunderbird failed, see
https://bugs.gentoo.org/671260
Comment 9 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-16 11:28:26 UTC
We cannot really solve this:

a) Adding a hard blocker on dev-util/cargo in >=dev-lang/rust{,-bin}-1.30.1

That wouldn't help right know: Because the rust eselect module is only checking for /usr/bin/rustc, it wouldn't detect that /usr/bin/cargo symlink is missing for example.

=> app-eselect/eselect-rust would need an update first.

But adding a hard blocker would also require user interaction prior upgrading rust which is a bad user experience and would break any automatic update process.


b) Like said in comment #6, if eselect-rust would check for other required symlinks as well (=including /usr/bin/cargo), we could call it in pkg_ phase of dev-util/cargo to fix symlinks on unmerge.

=> People would need to upgrade to new dev-util/cargo first to get updated pkg_ functions so that symlinks are getting fixed during migration to >=dev-lang/rust{,-bin}-1.30.1 :/

For now we could only add an ewarn to dev-lang/rust{,-bin}. It is annoying because we would have to show that message all the time because we cannot know in any dev-lang/rust{,-bin}'s pkg_* phase if another package (like dev-util/cargo) will remove a symlink afterwards as part of the same PM run.
Comment 10 Arfrever Frehtes Taifersar Arahesis 2018-11-16 19:00:44 UTC
(In reply to Thomas Deutschmann from comment #9)
> We cannot really solve this:
> 
> a) Adding a hard blocker on dev-util/cargo in >=dev-lang/rust{,-bin}-1.30.1
> 
> That wouldn't help right know: Because the rust eselect module is only
> checking for /usr/bin/rustc, it wouldn't detect that /usr/bin/cargo symlink
> is missing for example.

If you combine hard blocker AND the code re-setting symlinks from comment #5, then it might work.

It will require users to firstly manually uninstall dev-util/cargo, but afterwards, update of dev-lang/rust{,-bin} should create /usr/bin/cargo symlink.
Comment 11 Arfrever Frehtes Taifersar Arahesis 2018-11-16 20:52:12 UTC
*** Bug 671260 has been marked as a duplicate of this bug. ***
Comment 12 Oleg 2018-11-17 07:20:59 UTC
Will it work with disabled cargo use flag and manually installed dev-util/cargo?
Comment 13 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-17 15:59:46 UTC
(In reply to Oleg from comment #12)
> Will it work with disabled cargo use flag and manually installed
> dev-util/cargo?

You forgot that there isn't a cargo USE flag in >=rust-1.30.1 anymore... so dev-util/cargo is probably going away.
Comment 14 Oleg 2018-11-17 16:17:52 UTC
How it going to work with different rust slots?
Comment 15 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-17 16:21:22 UTC
That's why we have set a soft blocker on dev-util/cargo in >=dev-lang/rust{,-bin}-1.30.1. You cannot have rust-1.30.1 and any previous rust version installed at the same time anymore due to cargo. But please, keep this bug on topic. This is about the missing /usr/bin/cargo symlink after upgrading to >=rust-1.30.1...
Comment 16 Arfrever Frehtes Taifersar Arahesis 2018-11-18 00:17:10 UTC
*** Bug 671386 has been marked as a duplicate of this bug. ***
Comment 17 Harri Nieminen (Moiman) 2018-11-18 08:19:44 UTC
*** Bug 671408 has been marked as a duplicate of this bug. ***
Comment 18 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-19 02:10:12 UTC
*** Bug 671474 has been marked as a duplicate of this bug. ***
Comment 19 Larry the Git Cow gentoo-dev 2018-11-19 16:42:18 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0718dbc84ed51edd184446fc0d9cde7195e25a0

commit c0718dbc84ed51edd184446fc0d9cde7195e25a0
Author:     Dirkjan Ochtman <djc@gentoo.org>
AuthorDate: 2018-11-19 16:41:47 +0000
Commit:     Dirkjan Ochtman <djc@gentoo.org>
CommitDate: 2018-11-19 16:42:01 +0000

    dev-lang/rust: check reqs, ewarn about cargo symlink
    
    Fixes: https://bugs.gentoo.org/626134
    Fixes: https://bugs.gentoo.org/626742
    Fixes: https://bugs.gentoo.org/663354
    Fixes: https://bugs.gentoo.org/671182
    Signed-off-by: Dirkjan Ochtman <djc@gentoo.org>
    Package-Manager: Portage-2.3.51, Repoman-2.3.11

 dev-lang/rust/rust-1.30.1-r1.ebuild | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
Comment 20 Brian Evans (RETIRED) gentoo-dev 2018-11-22 15:36:34 UTC
*** Bug 671600 has been marked as a duplicate of this bug. ***
Comment 21 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-23 13:58:26 UTC
*** Bug 671748 has been marked as a duplicate of this bug. ***
Comment 22 Jeroen Roovers (RETIRED) gentoo-dev 2018-11-24 11:37:55 UTC
*** Bug 671794 has been marked as a duplicate of this bug. ***
Comment 23 Brian Evans (RETIRED) gentoo-dev 2018-11-29 13:28:39 UTC
*** Bug 672224 has been marked as a duplicate of this bug. ***
Comment 24 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-11-30 11:25:35 UTC
*** Bug 672276 has been marked as a duplicate of this bug. ***
Comment 25 Thomas Deutschmann (RETIRED) gentoo-dev 2018-11-30 20:07:27 UTC
*** Bug 672304 has been marked as a duplicate of this bug. ***
Comment 26 Brian Evans (RETIRED) gentoo-dev 2018-12-04 13:43:49 UTC
*** Bug 672488 has been marked as a duplicate of this bug. ***
Comment 27 Georgy Yakovlev archtester gentoo-dev 2019-01-29 18:06:46 UTC
*** Bug 676860 has been marked as a duplicate of this bug. ***
Comment 28 Brian Evans (RETIRED) gentoo-dev 2019-01-30 18:04:38 UTC
*** Bug 676936 has been marked as a duplicate of this bug. ***
Comment 29 Brian Evans (RETIRED) gentoo-dev 2019-01-30 18:23:36 UTC
*** Bug 676944 has been marked as a duplicate of this bug. ***
Comment 30 Brian Evans (RETIRED) gentoo-dev 2019-01-31 13:49:30 UTC
*** Bug 676978 has been marked as a duplicate of this bug. ***
Comment 31 Brian Evans (RETIRED) gentoo-dev 2019-01-31 20:18:55 UTC
*** Bug 677004 has been marked as a duplicate of this bug. ***
Comment 32 Jeroen Roovers (RETIRED) gentoo-dev 2019-02-03 11:04:21 UTC
*** Bug 677164 has been marked as a duplicate of this bug. ***
Comment 33 Amlesh Sivanantham 2019-02-10 21:28:04 UTC
This bug has been marked as fixed. Has the patch been pushed into the portage tree yet? I currently have this bug with cbindgen (Bug 676936) and its been marked as a duplicate of this. This bug was closed over a month ago, so it should be in the tree by now right?
Comment 34 Pavel Volkov 2019-02-10 21:34:56 UTC
It's fixed.
Maybe you need to run "eselect rust set 1"?
Comment 35 Amlesh Sivanantham 2019-02-11 00:52:00 UTC
(In reply to Pavel Volkov from comment #34)
> It's fixed.
> Maybe you need to run "eselect rust set 1"?

Wow that worked. Thanks.
Comment 36 Larry the Git Cow gentoo-dev 2019-03-11 05:02:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=47ad9a4eeb74a053d1fbc854fca7d13c96fb1a5b

commit 47ad9a4eeb74a053d1fbc854fca7d13c96fb1a5b
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-11 01:11:16 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-11 04:54:44 +0000

    Add cleanup action
    
    Cleanup action will make use of new find_missing_broken_symlinks() function
    and should be called by ebuild during package removal.
    
    If we detect a missing or broken symlink, we will automatically mark latest
    available version as default (which will basically fix missing or broken
    symlinks).
    
    Bug: https://bugs.gentoo.org/671182
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 rust.eselect.in | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

https://gitweb.gentoo.org/proj/eselect-rust.git/commit/?id=99577f8e98440da176709b6e4b988b40ae42b8d1

commit 99577f8e98440da176709b6e4b988b40ae42b8d1
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-11 00:42:52 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-11 04:54:36 +0000

    Add and make use of find_missing_broken_symlinks()
    
    dev-lang/rust or dev-lang/rust-bin install more than one binary (program),
    just checking for "rustc" is not enough.
    
    In addition, set of installed programs depends on USE flags.
    
    This new (internal) function will check for all provided programs.
    
    Bug: https://bugs.gentoo.org/671182
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 rust.eselect.in | 40 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 4 deletions(-)
Comment 37 Larry the Git Cow gentoo-dev 2019-03-11 06:29:05 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0a7fbefcd8e03543df2f3b7a2c893596ca79b27

commit b0a7fbefcd8e03543df2f3b7a2c893596ca79b27
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-11 06:28:33 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-11 06:28:55 +0000

    dev-util/cargo: rev bump to add pkg_postrm function
    
    Required to help upgrading to rust-1.30+.
    
    Bug: https://bugs.gentoo.org/671182
    Package-Manager: Portage-2.3.62, Repoman-2.3.12
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 dev-util/cargo/{cargo-0.30.0.ebuild => cargo-0.30.0-r1.ebuild} | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=550eb47e987d99529b4a42e592def682047f4cfe

commit 550eb47e987d99529b4a42e592def682047f4cfe
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-11 05:17:36 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-11 06:28:54 +0000

    app-eselect/eselect-rust: bump to v20190311
    
    Bug: https://bugs.gentoo.org/671182
    Package-Manager: Portage-2.3.62, Repoman-2.3.12
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 app-eselect/eselect-rust/Manifest                  |  1 +
 .../eselect-rust/eselect-rust-20190311.ebuild      | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)
Comment 38 Arfrever Frehtes Taifersar Arahesis 2019-04-22 00:28:45 UTC
*** Bug 684072 has been marked as a duplicate of this bug. ***
Comment 39 Brian Evans (RETIRED) gentoo-dev 2019-06-14 12:38:02 UTC
*** Bug 688048 has been marked as a duplicate of this bug. ***
Comment 40 Georgy Yakovlev archtester gentoo-dev 2019-06-18 06:18:33 UTC
*** Bug 688262 has been marked as a duplicate of this bug. ***