Repository navigation
Conversation
Build the vendored libgit2 for `target_os = "wasi"` (tested on wasm32-wasip1; wasip2 is untested). There is no system libgit2 to link against, so WASI always builds the vendored copy. In git2, path conversions accept WASI's `OsStr`, and `Repository::open_ext` and `discover_path` join ceiling directories themselves, since std's `env::join_paths` is unsupported on WASI. WASI preview 1 lacks several things libgit2's unix build assumes: - mmap: build with `NO_MMAP`, so pack windows are read into memory. - threads: leave `GIT_THREADS` undefined, and reject the -threads targets, where git2's `Send` types could then race inside libgit2. - network connections: replace `streams/socket.c` with a stream that always fails, and reject the `https` and `ssh` features. - user and process identity: wasi/compat.c defines getuid and friends (uid 0, pid 1). wasi-libc has no pwd.h, so wasi/include/pwd.h provides one; libgit2 only consults it when setuid, so the home directory comes from $HOME. On wasm32, `size_t` is `unsigned long` but `SIZE_MAX == UINT_MAX`, so libgit2's `integer.h` passes a `size_t *` to `__builtin_uadd_overflow`. The types have the same width, so clang's error is downgraded for WASI as a stopgap until libgit2 uses the type-generic builtins (libgit2/libgit2#7406). Add a CI job that builds for wasm32-wasip1 with wasi-sdk.
Author
|
This needs the libz-sys fix in rust-lang/libz-sys#273, which is merged but not yet released (release requested in rust-lang/libz-sys#276). Until then, the DO NOT MERGE commit pulls libz-sys from git. It's stacked on #1314, whose commit also shows up here. |
Run the tests for wasm32-wasip1 under wasmtime in CI instead of only building. MSRV still only builds: before Rust 1.94, std on WASI can't canonicalize paths and its remove_dir_all fails on what the tests create. - std has no temporary directory on WASI, so tests create theirs with `test::tempdir()`, which points tempfile at /tmp there, as tempfile's own tests do. The runner preopens /tmp. - Test helpers with only unix and windows variants (`realpath`, `ostr_to_cstr`, file URLs, the symlink in `repo_status`) now cover WASI, and `search_path` joins paths itself, since `env::join_paths` is unsupported there. - Skipped on WASI: `compile_fail` (trybuild runs cargo), `non_utf8_branch` (WASI paths are UTF-8), and two tests that remove directories through paths ending in a slash, which wasmtime rejects (bytecodealliance/wasmtime#11524). forge-parent: okkxkyxpvspw
msuozzo
force-pushed
the
push-xnrmkmtrunox
branch
from
October 11, 2026 21:19
7d6844d to
d9772da
Compare
Author
|
Folded into #1314 now that libz-sys 1.1.30 is out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Run the tests for wasm32-wasip1 under wasmtime in CI instead of only
building. MSRV still only builds: before Rust 1.94, std on WASI can't
canonicalize paths and its remove_dir_all fails on what the tests
create.
test::tempdir(), which points tempfile at /tmp there, as tempfile'sown tests do. The runner preopens /tmp.
realpath,ostr_to_cstr, file URLs, the symlink inrepo_status) now coverWASI, and
search_pathjoins paths itself, sinceenv::join_pathsis unsupported there.
compile_fail(trybuild runs cargo),non_utf8_branch(WASI paths are UTF-8), and two tests that removedirectories through paths ending in a slash, which wasmtime rejects
(wasip1 path_remove_directory fails with paths with trailing slashes bytecodealliance/wasmtime#11524).