From 75cfee465bcba16eb33b0c63bab91fdef0111be7 Mon Sep 17 00:00:00 2001 From: Earthmark Date: Fri, 20 Sep 2024 17:12:21 -0700 Subject: [PATCH 1/2] Implemented `is_path_owned_by_current_user` for wasi. Not that it's doing very much when wasi doesn't have a concept of current user. This is part of trying to get this to build with wasi as a build target. --- gix-sec/src/identity.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gix-sec/src/identity.rs b/gix-sec/src/identity.rs index a9633b18f8a..9fcdc2cb84d 100644 --- a/gix-sec/src/identity.rs +++ b/gix-sec/src/identity.rs @@ -17,7 +17,15 @@ pub fn is_path_owned_by_current_user(path: &Path) -> std::io::Result { impl_::is_path_owned_by_current_user(path) } -#[cfg(not(windows))] +// Wasi doesn't have a concept of a user, so this is implicitly true. +#[cfg(target_os = "wasi")] +mod impl_ { + pub fn is_path_owned_by_current_user(_path: &std::path::Path) -> std::io::Result { + Ok(true) + } +} + +#[cfg(all(not(windows), not(target_os = "wasi")))] mod impl_ { use std::path::Path; From 67536a08e50b5a37625e5c5521a8cae7ccbd0d81 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 21 Sep 2024 09:03:33 +0200 Subject: [PATCH 2/2] test `gix-sec` for WASI This would allow tests for crates that have partial support as well. --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f3546f2aca..e27397b6f9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -177,6 +177,9 @@ jobs: - name: Install Rust run: rustup update stable && rustup default stable && rustup target add ${{ matrix.target }} - uses: Swatinem/rust-cache@v2 + - run: set +x; for name in gix-sec; do (cd $name && cargo build --target ${{ matrix.target }}); done + name: "WASI only: crates without feature toggle" + if: endsWith(matrix.target, '-wasi') - run: set +x; for name in gix-actor gix-attributes gix-bitmap gix-chunk gix-command gix-commitgraph gix-config-value gix-date gix-glob gix-hash gix-hashtable gix-mailmap gix-object gix-packetline gix-path gix-pathspec gix-prompt gix-quote gix-refspec gix-revision gix-traverse gix-url gix-validate; do (cd $name && cargo build --target ${{ matrix.target }}); done name: crates without feature toggles - run: set +x; for feature in progress fs-walkdir-parallel parallel io-pipe crc32 zlib zlib-rust-backend fast-sha1 rustsha1 cache-efficiency-debug; do (cd gix-features && cargo build --features $feature --target ${{ matrix.target }}); done