Versioned cargo wrapper script points to default cargo

Bug #2100266 reported by Simon Chopin
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rustc-1.76 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Jammy
New
Undecided
Unassigned
Noble
New
Undecided
Unassigned
rustc-1.77 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Jammy
New
Undecided
Unassigned
Noble
New
Undecided
Unassigned
rustc-1.78 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Jammy
New
Undecided
Unassigned
Noble
New
Undecided
Unassigned
rustc-1.79 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Jammy
New
Undecided
Unassigned
Noble
New
Undecided
Unassigned
rustc-1.80 (Ubuntu)
Invalid
Undecided
Unassigned
Focal
New
Undecided
Unassigned
Jammy
New
Undecided
Unassigned
Noble
New
Undecided
Unassigned
Oracular
Won't Fix
Undecided
Unassigned
rustc-1.81 (Ubuntu)
In Progress
Undecided
Max Gilmour
Noble
New
Undecided
Unassigned
Oracular
Won't Fix
Undecided
Unassigned
Plucky
New
Undecided
Unassigned
rustc-1.82 (Ubuntu)
In Progress
Undecided
Max Gilmour
Noble
New
Undecided
Unassigned
Plucky
New
Undecided
Unassigned
rustc-1.83 (Ubuntu)
In Progress
Undecided
Max Gilmour
Noble
New
Undecided
Unassigned
Plucky
New
Undecided
Unassigned
rustc-1.84 (Ubuntu)
In Progress
High
Max Gilmour
Noble
New
Undecided
Unassigned
Plucky
Triaged
High
Unassigned
rustc-1.85 (Ubuntu)
In Progress
Undecided
Max Gilmour
Noble
New
Undecided
Unassigned
Questing
New
Undecided
Unassigned
rustc-1.88 (Ubuntu)
Status tracked in Resolute
Questing
New
Undecided
Unassigned
Resolute
In Progress
Undecided
Max Gilmour

Bug Description

[ Impact ]

 * If you use the Cargo wrapper script provided by a versioned
   cargo package, e.g. /usr/lib/rust-1.85/share/cargo/bin/cargo,
   it will invoke /usr/bin/cargo rather than
   /usr/lib/rust-1.85/bin/cargo.

 * This means that users expecting a particular Cargo version are
   actually invoking the rust-defaults Cargo version behind the
   scenes.

 * Additionally, if the rust-defaults Cargo version isn't
   installed, the versioned Cargo wrapper script doesn't work at
   all (because it's trying to invoke the nonexistent default).

 * As stated in the comments of this bug report, this is blocking
   the update of authd's Rust dependencies.

 * This upload fixes the bug by making the Cargo wrapper script
   invoke the versioned Cargo instead.

 * In addition, it adds a new "versioned-cargo-wrapper" autopkgtest
   which verifies that the Cargo version invoked by the wrapper
   script matches the version of the package itself.

[ Test Plan ]

 * To reproduce on Noble, do the following:
   - # apt install -y cargo-1.85
   - $ /usr/lib/rust-1.85/share/cargo/bin/cargo --version
     - This should produce a FileNotFoundError.
   - # apt install -y cargo
   - $ /usr/lib/rust-1.85/share/cargo/bin/cargo --version
     - This should (incorrectly) show cargo 1.75.0.

 * To test the fix on Noble, do the following:
   - # add-apt-repository -y ppa:maxgmr/rustc-lp2100266
   - # apt update && apt upgrade -y
   - # apt remove -y cargo
   - $ /usr/lib/rust-1.85/share/cargo/bin/cargo --version
     - This should now show cargo 1.85.1 (instead of FileNotFound)
   - # apt install -y cargo
   - $ /usr/lib/rust-1.85/share/cargo/bin/cargo --version
     - This should also show cargo 1.85.1 (instead of 1.75.0)

 * Additionally, the new "versioned-cargo-wrapper" autopkgtest
   should pass.

[ Where problems could occur ]

 * This upload changes the toolchain version which is invoked by the
   versioned Cargo wrapper. As a result, applying this SRU means that
   packages will be built with a different Rust version.

 * This means that, for example, on Noble, packages built with
   cargo-1.85 were being built with 1.75 the whole time. When the
   SRU is applied, all these packages will be (correctly) built with
   1.85 as intended, but this could potentially cause builds to fail.

 * This change does not affect the vast majority of Rust packages, as
   they are all built with the default Rust version.

[ Other Info ]

 * In d/rules, my exclusion of 'librustc_driver' from the dh_dwz step
   is not related to this bug, but the build failed otherwise, so I
   needed to include this fix as well.

Related branches

Simon Chopin (schopin)
Changed in rustc-1.76 (Ubuntu Oracular):
status: New → Invalid
Changed in rustc-1.76 (Ubuntu Plucky):
status: New → Invalid
Changed in rustc-1.77 (Ubuntu Plucky):
status: New → Invalid
Changed in rustc-1.77 (Ubuntu Oracular):
status: New → Invalid
no longer affects: rustc-1.78 (Ubuntu Oracular)
no longer affects: rustc-1.77 (Ubuntu Oracular)
no longer affects: rustc-1.84 (Ubuntu Focal)
no longer affects: rustc-1.84 (Ubuntu Jammy)
no longer affects: rustc-1.84 (Ubuntu Noble)
no longer affects: rustc-1.84 (Ubuntu Oracular)
no longer affects: rustc-1.83 (Ubuntu Focal)
no longer affects: rustc-1.83 (Ubuntu Jammy)
no longer affects: rustc-1.83 (Ubuntu Noble)
no longer affects: rustc-1.83 (Ubuntu Oracular)
no longer affects: rustc-1.82 (Ubuntu Focal)
no longer affects: rustc-1.82 (Ubuntu Jammy)
no longer affects: rustc-1.82 (Ubuntu Noble)
no longer affects: rustc-1.82 (Ubuntu Oracular)
Simon Chopin (schopin)
no longer affects: rustc-1.81 (Ubuntu Focal)
no longer affects: rustc-1.81 (Ubuntu Jammy)
no longer affects: rustc-1.81 (Ubuntu Noble)
no longer affects: rustc-1.76 (Ubuntu Oracular)
no longer affects: rustc-1.77 (Ubuntu Plucky)
no longer affects: rustc-1.76 (Ubuntu Plucky)
no longer affects: rustc-1.78 (Ubuntu Plucky)
no longer affects: rustc-1.79 (Ubuntu Oracular)
no longer affects: rustc-1.79 (Ubuntu Plucky)
no longer affects: rustc-1.80 (Ubuntu Plucky)
Changed in rustc-1.78 (Ubuntu):
status: New → Invalid
Changed in rustc-1.79 (Ubuntu):
status: New → Invalid
Changed in rustc-1.80 (Ubuntu):
status: New → Invalid
Simon Chopin (schopin)
tags: added: rls-nn-incoming
tags: added: foundations-todo
removed: rls-nn-incoming
Revision history for this message
Ural Tunaboyu (uralt) wrote :

Ubuntu 24.10 (Oracular Oriole) has reached end of life, so this bug will not be fixed for that specific release.

Changed in rustc-1.80 (Ubuntu Oracular):
status: New → Won't Fix
Changed in rustc-1.81 (Ubuntu Oracular):
status: New → Won't Fix
Max Gilmour (maxgmr)
no longer affects: rustc-1.84 (Ubuntu Questing)
no longer affects: rustc-1.83 (Ubuntu Questing)
no longer affects: rustc-1.76 (Ubuntu Questing)
no longer affects: rustc-1.77 (Ubuntu Questing)
no longer affects: rustc-1.78 (Ubuntu Questing)
no longer affects: rustc-1.79 (Ubuntu Questing)
no longer affects: rustc-1.80 (Ubuntu Questing)
no longer affects: rustc-1.81 (Ubuntu Questing)
no longer affects: rustc-1.82 (Ubuntu Questing)
Changed in rustc-1.81 (Ubuntu):
assignee: nobody → Max Gilmour (maxgmr)
status: New → In Progress
Changed in rustc-1.82 (Ubuntu):
assignee: nobody → Max Gilmour (maxgmr)
status: New → In Progress
Changed in rustc-1.83 (Ubuntu):
assignee: nobody → Max Gilmour (maxgmr)
status: New → In Progress
Changed in rustc-1.84 (Ubuntu):
assignee: nobody → Max Gilmour (maxgmr)
status: Triaged → In Progress
Changed in rustc-1.85 (Ubuntu):
assignee: nobody → Max Gilmour (maxgmr)
status: New → In Progress
Changed in rustc-1.88 (Ubuntu):
assignee: nobody → Max Gilmour (maxgmr)
status: New → In Progress
no longer affects: rustc-1.85 (Ubuntu Questing)
Max Gilmour (maxgmr)
no longer affects: rustc-1.82 (Ubuntu Questing)
no longer affects: rustc-1.82 (Ubuntu Resolute)
no longer affects: rustc-1.83 (Ubuntu Questing)
no longer affects: rustc-1.83 (Ubuntu Resolute)
no longer affects: rustc-1.84 (Ubuntu Questing)
no longer affects: rustc-1.84 (Ubuntu Resolute)
no longer affects: rustc-1.85 (Ubuntu Resolute)
no longer affects: rustc-1.76 (Ubuntu Questing)
no longer affects: rustc-1.76 (Ubuntu Resolute)
no longer affects: rustc-1.78 (Ubuntu Questing)
no longer affects: rustc-1.78 (Ubuntu Resolute)
no longer affects: rustc-1.79 (Ubuntu Questing)
no longer affects: rustc-1.79 (Ubuntu Resolute)
no longer affects: rustc-1.80 (Ubuntu Questing)
no longer affects: rustc-1.80 (Ubuntu Resolute)
no longer affects: rustc-1.81 (Ubuntu Questing)
no longer affects: rustc-1.81 (Ubuntu Resolute)
no longer affects: rustc-1.77 (Ubuntu Questing)
no longer affects: rustc-1.77 (Ubuntu Resolute)
Revision history for this message
Max Gilmour (maxgmr) wrote :

I've created fixes for several of the targeted versions. Their debdiffs shall be included in future comments.

======
Before
======

root@plucky-bug:~# apt install -yU cargo cargo-1.82
[...]
root@plucky-bug:~# cargo --version
cargo 1.84.1 (66221abde 2024-11-19)
root@plucky-bug:~# /usr/lib/rust-1.82/share/cargo/bin/cargo --version
cargo 1.84.1 (66221abde 2024-11-19)

=====
After
=====

root@plucky-bug:~# add-apt-repository ppa:maxgmr/rustc-lp-2100266
[...]
root@plucky-bug:~# apt-cache policy cargo-1.82
cargo-1.82:
  Installed: 1.82.0+dfsg0ubuntu1-0ubuntu2
  Candidate: 1.82.0+dfsg0ubuntu1-0ubuntu3~ppa2
  Version table:
     1.82.0+dfsg0ubuntu1-0ubuntu3~ppa2 500
        500 https://ppa.launchpadcontent.net/maxgmr/rustc-lp-2100266/ubuntu plucky/main amd64 Packages
 *** 1.82.0+dfsg0ubuntu1-0ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu plucky/universe amd64 Packages
        100 /var/lib/dpkg/status
root@plucky-bug:~# apt install cargo-1.82
[...]
root@plucky-bug:~# cargo --version
cargo 1.84.1 (66221abde 2024-11-19)
root@plucky-bug:~# /usr/lib/rust-1.82/share/cargo/bin/cargo --version
cargo 1.82.0 (8f40fc59f 2024-08-21)

Revision history for this message
Max Gilmour (maxgmr) wrote :
Revision history for this message
Adrian Dombeck (adombeck) wrote :

The issue doesn't seem to be fixed on noble, the cargo wrapper still uses /usr/bin/cargo:

$ sudo apt-cache policy cargo-1.85
cargo-1.85:
  Installed: 1.85.1+dfsg0ubuntu2~bpo0-0ubuntu0.24.04
  Candidate: 1.85.1+dfsg0ubuntu2~bpo0-0ubuntu0.24.04
  Version table:
 *** 1.85.1+dfsg0ubuntu2~bpo0-0ubuntu0.24.04 500
        500 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages
        100 /var/lib/dpkg/status

$ /usr/lib/rust-1.85/share/cargo/bin/cargo --version
cargo 1.75.0

Am I doing something wrong?

Revision history for this message
Adrian Dombeck (adombeck) wrote :

Oh, I think I misunderstood your last comment. I now see that the status is "In Progress", not "Fixed".

Max Gilmour (maxgmr)
no longer affects: rustc-1.80 (Ubuntu Noble)
no longer affects: rustc-1.79 (Ubuntu Noble)
no longer affects: rustc-1.78 (Ubuntu Noble)
no longer affects: rustc-1.77 (Ubuntu Noble)
no longer affects: rustc-1.76 (Ubuntu Noble)
no longer affects: rustc-1.88 (Ubuntu Noble)
Revision history for this message
Adrian Dombeck (adombeck) wrote :

This is still blocking the update of authd's Rust dependencies. Can we get this fixed in rustc-1.85 in Noble?

Revision history for this message
Max Gilmour (maxgmr) wrote :

> Can we get this fixed in rustc-1.85 in Noble?

Hi Adrian,

Thank you for your patience on this issue. I've finished the Noble rustc-1.85 fix and I'll get it uploaded ASAP.

description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.