-
Notifications
You must be signed in to change notification settings - Fork 144
fix: respect CARGO_HOME in install.sh #326
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| install.sh: GitHub repository: https://github.com/Byron/dua-cli | ||
| install.sh: Crate: dua | ||
| install.sh: Tag: v2.29.0 | ||
| install.sh: Target: does-not-exist | ||
| install.sh: Installing to: /tmp/dua-cargo-home/bin | ||
| install.sh: Downloading: https://github.com/Byron/dua-cli/releases/download/v2.29.0/dua-v2.29.0-does-not-exist.tar.gz | ||
| stub tar failure |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| install.sh: GitHub repository: https://github.com/Byron/dua-cli | ||
| install.sh: Crate: dua | ||
| install.sh: Tag: v2.29.0 | ||
| install.sh: Target: does-not-exist | ||
| install.sh: Installing to: /tmp/dua-install-home/.cargo/bin | ||
| install.sh: Downloading: https://github.com/Byron/dua-cli/releases/download/v2.29.0/dua-v2.29.0-does-not-exist.tar.gz | ||
| stub tar failure |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -113,3 +113,41 @@ WITH_FAILURE=1 | |||||||
| } | ||||||||
| ) | ||||||||
| ) | ||||||||
|
|
||||||||
| (with "the install script" | ||||||||
| (sandbox | ||||||||
| mkdir fakebin | ||||||||
| cat > fakebin/curl <<'EOF' | ||||||||
| #!/bin/sh | ||||||||
| exit 0 | ||||||||
| EOF | ||||||||
| cat > fakebin/tar <<'EOF' | ||||||||
| #!/bin/sh | ||||||||
| echo "stub tar failure" >&2 | ||||||||
| exit 1 | ||||||||
| EOF | ||||||||
| chmod +x fakebin/curl fakebin/tar | ||||||||
| rm -rf /tmp/dua-install-home /tmp/dua-cargo-home | ||||||||
| it "uses CARGO_HOME for the default install location" && { | ||||||||
| WITH_SNAPSHOT="$snapshot/failure-install-script-defaults-to-cargo-home" \ | ||||||||
| PATH="$PWD/fakebin:$PATH" \ | ||||||||
| HOME=/tmp/dua-install-home \ | ||||||||
| CARGO_HOME=/tmp/dua-cargo-home \ | ||||||||
| expect_run ${WITH_FAILURE} sh "$root/../ci/install.sh" \ | ||||||||
|
Comment on lines
+130
to
+136
|
||||||||
| --git Byron/dua-cli \ | ||||||||
| --crate dua \ | ||||||||
| --tag v2.29.0 \ | ||||||||
| --target does-not-exist | ||||||||
| } | ||||||||
| it "falls back to HOME/.cargo/bin when CARGO_HOME is unset" && { | ||||||||
| WITH_SNAPSHOT="$snapshot/failure-install-script-defaults-to-home-cargo-bin" \ | ||||||||
| PATH="$PWD/fakebin:$PATH" \ | ||||||||
| HOME=/tmp/dua-install-home \ | ||||||||
|
||||||||
| HOME=/tmp/dua-install-home \ | |
| HOME=/tmp/dua-install-home \ | |
| CARGO_HOME= \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
destis optional and may be unset/empty when--tois omitted. In POSIX sh,[ -z $dest ]becomes[ -z ]and typically exits with a "missing argument"/"unary operator expected" error (and withset -ethis aborts the script). Quote the variable in the test (and ideally keep it consistently quoted anywhere it’s tested).