Skip to content

Expected behavior for fd_prestat with an empty prefix? #227

@zeux

Description

@zeux

I'm using wasi-libc with a custom implemention of WASI on top of it to bridge file system calls from the guest to the host OS; the intention is to provide a pass-through scheme where file paths are handed off as is.

My current implementation of prestat returns a single directory with an empty path.

This works well for relative paths, and for absolute paths on Windows, but doesn't work for absolute paths on Linux/macOS, since a call to open a file "/foo/bar" is translated to a call to path_open with "foo/bar" (no leading slash) - and the same is true for a call to open a file "foo/bar". So from the point of WASI implementation it's impossible to distinguish "foo/bar" from "/foo/bar" when using an empty prestat.

Is that behavior intended? I suspect I can work around this by registering two prestat paths, "/" and "", but it would be great to avoid that for simplicity...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions