diff --git a/tools/ci-build/runtime-versioner/Cargo.lock b/tools/ci-build/runtime-versioner/Cargo.lock index 85f026845130290f2be4804665574f493c08183f..c05300ed67b8fbce5e31d1bb4ceaa9355fe10256 100644 --- a/tools/ci-build/runtime-versioner/Cargo.lock +++ b/tools/ci-build/runtime-versioner/Cargo.lock @@ -797,6 +797,15 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" version = "1.10.4" @@ -1156,6 +1165,7 @@ dependencies = [ "camino", "tempfile", "test_bin", + "whoami", ] [[package]] @@ -1436,6 +1446,12 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" version = "0.2.92" @@ -1512,6 +1528,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "whoami" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" +dependencies = [ + "redox_syscall", + "wasite", + "web-sys", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/tools/ci-build/runtime-versioner/test-common/Cargo.toml b/tools/ci-build/runtime-versioner/test-common/Cargo.toml index e23fab820ed5657f8d024a1a13b7649653863822..a8bf500df7cd990895044016302ec8a7f006895b 100644 --- a/tools/ci-build/runtime-versioner/test-common/Cargo.toml +++ b/tools/ci-build/runtime-versioner/test-common/Cargo.toml @@ -8,3 +8,4 @@ publish = false camino = "1.1.6" tempfile = "3.8.1" test_bin = "0.4.0" +whoami = "1.5.1" diff --git a/tools/ci-build/runtime-versioner/test-common/src/lib.rs b/tools/ci-build/runtime-versioner/test-common/src/lib.rs index 7f151cb88dbbd747e146708ffcc257fa056cb2ee..7c45bc43446b086f14525447179be16e0d3febc0 100644 --- a/tools/ci-build/runtime-versioner/test-common/src/lib.rs +++ b/tools/ci-build/runtime-versioner/test-common/src/lib.rs @@ -37,6 +37,18 @@ impl TestBase { .success(), "untarring the test_base into the temp directory failed" ); + // ensure unpacked file has the current user assigned to the owner, + // otherwise we could get the `fatal: detected dubious ownership in repository` error + let test_repo = Utf8PathBuf::try_from(tmp.path().join("test_base.git")).unwrap(); + assert!( + Command::new("chown") + .args(&[&format!("{}", whoami::username()), test_repo.as_str(),]) + .current_dir(tmp.path()) + .status() + .unwrap() + .success(), + "setting the owner of `test_base.git` to the current user failed" + ); assert!( Command::new("git") .args(["clone", "test_base.git"])