-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.os-wasistandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.10.0
Steps to Reproduce and Observed Behavior
I'm trying to trigger use of wasi path_filestat_get, and noticed it should be used internally for chdir. My runtime (wazero) has a pre-open of "/" so theoretically I should be able to chdir to that. However, it fails at compile time, not runtime.
const std = @import("std");
const allocator = std.heap.page_allocator;
const PreopenList = std.fs.wasi.PreopenList;
pub fn main() !void {
var preopens = PreopenList.init(allocator);
defer preopens.deinit();
try std.os.initPreopensWasi(allocator, "/");
try std.os.chdir("/");
}
Here's the output
/usr/local/Cellar/zig/0.10.0/lib/std/os.zig:3002:28: error: container 'std.fs' has no member called 'resolve'
const path = try fs.resolve(alloc.allocator(), &.{ wasi_cwd.cwd, dir_path });
^
error: cat...
error: The following command exited with error code 1:
/usr/local/Cellar/zig/0.10.0/zig build-exe -fstage1 /Users/adrian/oss/wazero/imports/wasi_snapshot_preview1/example/testdata/zig/cat.zig -OReleaseSmall --cache-dir /Users/adrian/oss/wazero/imports/wasi_snapshot_preview1/example/testdata/zig/zig-cache --global-cache-dir /Users/adrian/.cache/zig --name cat -target wasm32-wasi -mcpu generic --enable-cache
error: the following build command failed with exit code 1:
/Users/adrian/oss/wazero/imports/wasi_snapshot_preview1/example/testdata/zig/zig-cache/o/ebccba9fa4e73739244c3826d3931fab/build /usr/local/Cellar/zig/0.10.0/zig /Users/adrian/oss/wazero/imports/wasi_snapshot_preview1/example/testdata/zig /Users/adrian/oss/wazero/imports/wasi_snapshot_preview1/example/testdata/zig/zig-cache /Users/adrian/.cache/zig -fstage1 -fstage1 -Drelease-small=true
make: *** [imports/wasi_snapshot_preview1/example/testdata/zig/cat.wasm] Error 1
Expected Behavior
I was hoping this to compile, or something else that ends up invoking fstatatWasi so that I can test tetratelabs/wazero#858
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.os-wasistandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.