mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Fix detect-targets
on ubuntu 20.04, glibc 2.31 (#1379)
* Fix `detect-targets` on ubuntu 20.04, glibc 2.31 Fixed #1375 and fixed #1378 glibc 2.31 does not support `--version`, so we need to detect and fallback to passing an executable linked with that glibc to check if it is indeed glibc. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix compilation faillure on ubuntu-20.04 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
f6e6a2f899
commit
efbd20857b
2 changed files with 22 additions and 1 deletions
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -153,10 +153,18 @@ jobs:
|
||||||
alpine test.sh "$TARGET"
|
alpine test.sh "$TARGET"
|
||||||
|
|
||||||
detect-targets-ubuntu-test:
|
detect-targets-ubuntu-test:
|
||||||
runs-on: ubuntu-latest
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-20.04
|
||||||
|
- ubuntu-latest
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
key: ${{ matrix.os }}
|
||||||
- name: Build detect-targets
|
- name: Build detect-targets
|
||||||
run: cargo build --bin detect-targets
|
run: cargo build --bin detect-targets
|
||||||
- name: Run test in ubuntu
|
- name: Run test in ubuntu
|
||||||
|
|
|
@ -108,6 +108,19 @@ You are not meant to run this directly.
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
} else if status.code() == Some(127) {
|
||||||
|
// On Ubuntu 20.04 (glibc 2.31), the `--version` flag is not supported
|
||||||
|
// and it will exit with status 127.
|
||||||
|
let status = Command::new(cmd)
|
||||||
|
.arg("/bin/true")
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
|
.status()
|
||||||
|
.await
|
||||||
|
.ok()?;
|
||||||
|
|
||||||
|
status.success().then_some(Libc::Gnu)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue