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

[Bug]: Environment Variables CARGO_HOME and RUSTUP_HOME Not Set Correctly in rustup.json #13600

Closed
3 tasks done
Paspartame opened this issue Jul 11, 2024 · 1 comment · Fixed by ScoopInstaller/Scoop#6057
Closed
3 tasks done
Labels

Comments

@Paspartame
Copy link

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues/PRs to ensure it has not already been reported or fixed.
  • I have verified that I am using the latest version of Scoop and corresponding bucket.

Package Name

rustup

Expected/Current Behaviour

When installing rustup using the provided rustup.json file, the environment variables CARGO_HOME and RUSTUP_HOME are set to $persist_dir\\.cargo and $persist_dir\\.rustup respectively. After installation, executing rustup commands results in the creation of a $persist_dir folder in the current directory. The environment variables also seem to get wrong.
Snipaste_2024-07-11_13-46-55

Steps to Reproduce

PS C:\Users\Paspar> Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Initializing...
Downloading...
Extracting...
Creating shim...
Adding ~\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.
PS C:\Users\Paspar> scoop install 7zip git
Installing '7zip' (24.07) [64bit] from 'main' bucket
7z2407-x64.msi (1.9 MB) [=====================================================================================] 100%
Checking hash of 7z2407-x64.msi ... ok.
Extracting 7z2407-x64.msi ... done.
Linking ~\scoop\apps\7zip\current => ~\scoop\apps\7zip\24.07
Creating shim for '7z'.
Creating shim for '7zFM'.
Making C:\Users\Paspar\scoop\shims\7zfm.exe a GUI binary.
Creating shim for '7zG'.
Making C:\Users\Paspar\scoop\shims\7zg.exe a GUI binary.
Creating shortcut for 7-Zip (7zFM.exe)
Persisting Codecs
Persisting Formats
Running post_install script...done.
'7zip' (24.07) was installed successfully!
Notes
-----
Add 7-Zip as a context menu option by running: "C:\Users\Paspar\scoop\apps\7zip\current\install-context.reg"
Installing 'git' (2.45.2) [64bit] from 'main' bucket
PortableGit-2.45.2-64-bit.7z.exe (60.1 MB) [==================================================================] 100%
Checking hash of PortableGit-2.45.2-64-bit.7z.exe ... ok.
Extracting PortableGit-2.45.2-64-bit.7z.exe ... done.
Linking ~\scoop\apps\git\current => ~\scoop\apps\git\2.45.2
Creating shim for 'sh'.
Creating shim for 'bash'.
Creating shim for 'git'.
Creating shim for 'gitk'.
Making C:\Users\Paspar\scoop\shims\gitk.exe a GUI binary.
Creating shim for 'git-gui'.
Making C:\Users\Paspar\scoop\shims\git-gui.exe a GUI binary.
Creating shim for 'scalar'.
Creating shim for 'tig'.
Creating shim for 'git-bash'.
Making C:\Users\Paspar\scoop\shims\git-bash.exe a GUI binary.
Creating shortcut for Git Bash (git-bash.exe)
Creating shortcut for Git GUI (git-gui.exe)
Running post_install script...done.
'git' (2.45.2) was installed successfully!
Notes
-----
Set Git Credential Manager Core by running: "git config --global credential.helper manager"

To add context menu entries, run 'C:\Users\Paspar\scoop\apps\git\current\install-context.reg'

To create file-associations for .git* and .sh files, run
'C:\Users\Paspar\scoop\apps\git\current\install-file-associations.reg'
PS C:\Users\Paspar> scoop update
Updating Scoop...
Updating Buckets...
INFO  Converting 'main' bucket to git repo...
The main bucket was removed successfully.
Checking repo... OK
The main bucket was added successfully.
Scoop was updated successfully!
PS C:\Users\Paspar> scoop install rustup
Installing 'rustup' (1.27.1) [64bit] from 'main' bucket
rustup-init.exe (8.5 MB) [====================================================================================] 100%
Checking hash of rustup-init.exe ... ok.
Running installer script...warning: installing msvc toolchain without its prerequisites
info: profile set to 'default'
info: default host triple is x86_64-pc-windows-msvc
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 57.7 MiB /  57.7 MiB (100 %)  45.5 MiB/s in  1s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 15.4 MiB /  15.4 MiB (100 %)   1.4 MiB/s in 12s ETA:  0s
info: retrying renaming 'C:\Users\Paspar\scoop\persist\rustup\.rustup\tmp\iom_0l0ohbvjaebm_dir\rust-docs\share/doc/rust/html' to 'C:\Users\Paspar\scoop\persist\rustup\.rustup\toolchains\stable-x86_64-pc-windows-msvc\share/doc/rust/html'
info: retrying renaming 'C:\Users\Paspar\scoop\persist\rustup\.rustup\tmp\iom_0l0ohbvjaebm_dir\rust-docs\share/doc/rust/html' to 'C:\Users\Paspar\scoop\persist\rustup\.rustup\toolchains\stable-x86_64-pc-windows-msvc\share/doc/rust/html'
info: retrying renaming 'C:\Users\Paspar\scoop\persist\rustup\.rustup\tmp\iom_0l0ohbvjaebm_dir\rust-docs\share/doc/rust/html' to 'C:\Users\Paspar\scoop\persist\rustup\.rustup\toolchains\stable-x86_64-pc-windows-msvc\share/doc/rust/html'
info: installing component 'rust-std'
 18.3 MiB /  18.3 MiB (100 %)  11.5 MiB/s in  1s ETA:  0s
info: installing component 'rustc'
 57.7 MiB /  57.7 MiB (100 %)  10.5 MiB/s in  5s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-pc-windows-msvc'

  stable-x86_64-pc-windows-msvc installed - rustc 1.79.0 (129f3b996 2024-06-10)


Rust is installed now. Great!

To get started you need Cargo's bin directory (C:\Users\Paspar\scoop\persist
\rustup\.cargo\bin) in your PATH
environment variable. This has not been done automatically.
done.
Linking ~\scoop\apps\rustup\current => ~\scoop\apps\rustup\1.27.1
Adding ~\scoop\apps\rustup\current\.cargo\bin to your path.
Persisting .cargo
Persisting .rustup
'rustup' (1.27.1) was installed successfully!
Notes
-----
This package defaults to using the MSVC toolchain in new installs; use "rustup set default-host" to configure it
(existing installs may be using the GNU toolchain by default)
According to https://doc.rust-lang.org/book/ch01-01-installation.html#installing-rustup-on-windows
Microsoft C++ Build Tools is needed and can be downloaded here:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
When installing build tools, these two components should be selected:
- MSVC - VS C++ x64/x86 build tools
- Windows SDK
PS C:\Users\Paspar> $env:CARGO_HOME
$persist_dir\.cargo
PS C:\Users\Paspar> $env:RUSTUP_HOME
$persist_dir\.rustup
PS C:\Users\Paspar> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\Paspar\$persist_dir\.rustup

no active toolchain
PS C:\Users\Paspar> PS C:\Users\Paspar> ls


    目录: C:\Users\Paspar


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2024/7/11     13:52                $persist_dir
d-----         2024/7/11     13:42                .config
d-r---          2024/6/6     21:30                3D Objects
d-r---          2024/6/6     21:30                Contacts
d-r---          2024/6/6     21:30                Desktop
d-r---          2024/6/6     21:30                Documents
d-r---          2024/6/6     21:30                Downloads
d-r---          2024/6/6     21:30                Favorites
d-r---          2024/6/6     21:30                Links
d-r---          2024/6/6     21:30                Music
d-r---          2024/6/6     21:32                OneDrive
d-r---          2024/6/6     21:31                Pictures
d-r---          2024/6/6     21:30                Saved Games
d-----         2024/7/11     13:42                scoop
d-r---          2024/6/6     21:31                Searches
d-r---          2024/6/6     22:55                Videos

Possible Solution

I don't know why, when installing rustup using Scoop, it correctly sets the home directories of rustup and Cargo to the corresponding persistence directories, but the environment variables CARGO_HOME and RUSTUP_HOME do not point to the correct directories. I think there might be a syntax error in rustup.json?

Scoop and Buckets Version

PS C:\Users\Paspar> scoop --version
Current Scoop version:
716b6db3 (HEAD -> master, tag: v0.5.0, origin/master, origin/HEAD) chore(release): Bump to version 0.5.0 (#6035)

'main' bucket:
dcce43323 (HEAD -> master, origin/master, origin/HEAD) twitchdownloader-cli: Update to version 1.54.8

Scoop Config

PS C:\Users\Paspar> scoop config

last_update                       scoop_repo                              scoop_branch
-----------                       ----------                              ------------
2024-07-11T13:43:47.6390230+08:00 https://github.com/ScoopInstaller/Scoop master

PowerShell Version

PS C:\Users\Paspar> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.4597
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4597
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Additional Softwares

No response

@Paspartame Paspartame added the bug label Jul 11, 2024
@Paspartame Paspartame changed the title [Bug]: Setting CARGO_HOME and RUSTUP_HOME to $persist_dir in rustup.json wrong and causes directory creation in current folder [Bug]: Environment Variables CARGO_HOME and RUSTUP_HOME Not Set Correctly in rustup.json Jul 11, 2024
@niheaven
Copy link
Member

Will fix in next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants