Skip to content

wasi: container 'std.fs' has no member called 'resolve' #13644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
codefromthecrypt opened this issue Nov 24, 2022 · 3 comments · Fixed by #13646
Closed

wasi: container 'std.fs' has no member called 'resolve' #13644

codefromthecrypt opened this issue Nov 24, 2022 · 3 comments · Fixed by #13646
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. os-wasi standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@codefromthecrypt
Copy link
Contributor

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

@codefromthecrypt codefromthecrypt added the bug Observed behavior contradicts documented or intended behavior label Nov 24, 2022
@codefromthecrypt
Copy link
Contributor Author

@topolarity #11021 looked pretty cool, which led me down this path, I'm new at zig so forgive my trespasses

@Vexu Vexu added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. os-wasi labels Nov 24, 2022
@Vexu Vexu added this to the 0.10.1 milestone Nov 24, 2022
@codefromthecrypt
Copy link
Contributor Author

thanks a lot!

@topolarity
Copy link
Contributor

Any time! Keep the bug reports coming 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. os-wasi standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants