Repository navigation
fix: treat an empty CARGO_HOME as unset - #49
Merged
Merged
Conversation
An empty CARGO_HOME made terminal::installed look for Cargo's bin folder at the relative path `bin`, so a program installed with `cargo install` into ~/.cargo/bin was reported as an install-script copy: `graphicle update` printed the install script command and `graphicle uninstall` said to rm the file instead of `cargo uninstall graphicle-runtime`. Cargo itself treats an empty CARGO_HOME as unset and uses ~/.cargo. Signed-off-by: Lenin Mookiah <2639584+leninworld@users.noreply.github.com>
Member
|
Merged, thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
terminal::installedused an emptyCARGO_HOMEas a folder, so Cargo's bin folder became the relativebin. A program thatcargo installput in~/.cargo/binwas then not recognised as a Cargo install:graphicle updatereported"installed": "script"and printed the install script command (curl ... install.sh | sh -s -- --bin-dir ~/.cargo/bin) instead ofcargo install --path runtime --locked --force.graphicle uninstall, which uses the sameinstalled, said torm ~/.cargo/bin/graphicleinstead ofcargo uninstall graphicle-runtime, which would leave Cargo's install record behind.CARGO_HOMEas unset and uses~/.cargo, as doespackaging/release_build.py(os.environ.get('CARGO_HOME') or ...).installednow does the same, with the empty-value filter the program already uses for its other variables. A non-empty value is still used as given.Not changed: a relative
CARGO_HOME(Cargo joins it to the current folder;installedstill compares it as given, as onmain), andcrates/graphicle-graph/tools/vendor_engine_grammars.py, which also readsCARGO_HOMEwithout theorfallback.Test plan
ux_terminal::update_and_uninstall_treat_an_empty_cargo_home_as_unsetputs the built program in the sandbox's~/.cargo/binand runsupdatewithCARGO_HOMEunset, empty, and set to another Cargo home holding a copy, thenuninstallwithCARGO_HOME="". Onmainthe empty case fails (installedis"script";uninstallgivesrm ...); with this change each run reports Cargo. The test gets a smallSandbox::command_ofhelper so it can run the copied program with the sandbox's usual environment.cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo clippy --locked --all-targets --features local-inference -- -D warningsandcargo test --locked --all-targetsincrates/graphicle(Rust 1.95.0, macOS). Linux and Windows run in CI.