diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c90073e3..0c10c8f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,10 +153,18 @@ jobs: alpine test.sh "$TARGET" detect-targets-ubuntu-test: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + - ubuntu-20.04 + - ubuntu-latest + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.os }} - name: Build detect-targets run: cargo build --bin detect-targets - name: Run test in ubuntu diff --git a/crates/detect-targets/src/detect/linux.rs b/crates/detect-targets/src/detect/linux.rs index b2c2756f..a945c881 100644 --- a/crates/detect-targets/src/detect/linux.rs +++ b/crates/detect-targets/src/detect/linux.rs @@ -108,6 +108,19 @@ You are not meant to run this directly. } else { 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 { None }