WebAssembly / WebAssembly/WASI

Specify semantics with respect to POSIX 2008

Open
#716 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-filesystem
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

This might be a hot-button issue, but the deeper I go in testing filesystem-related things, the more errors are possible, and the less the spec has to say about them. Consider the simple case of symlink-at; its specification is short:

        /// Create a symbolic link (also known as a "symlink").
        ///
        /// If `old-path` starts with `/`, the function fails with
        /// `error-code::not-permitted`.
        ///
        /// Note: This is similar to `symlinkat` in POSIX.
        @since(version = 0.3.0-rc-2025-08-15)
        symlink-at: async func(
            /// The contents of the symbolic link.
            old-path: string,
            /// The relative destination path at which to create the symbolic link.
            new-path: string,
        ) -> result<_, error-code>;

Whereas the POSIX 2008 definition is still short, but more specific: https://pubs.opengroup.org/onlinepubs/9699919799.orig/

Notably, as regards the following situations, POSIX offers important clarification

  • what happens when new-path exists
  • what happens if the new-path is in a dir that we can't write to; I guess this would mean either a preopen opened without mutate-directory, or in a subdir that we fail to open with mutate-directory, though permissions are not part of wasi
  • what the maximum length is for a path name component
  • what happens when either "old-path" or "new-path" is empty

Of course there are still some implementation-specified limits (PATH_MAX et al). But, should we just be taking language from POSIX, or applying a blanket language indicating that the errors are the same as in POSIX 2008 unless WASI explicitly specifies otherwise ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the symlink-at definition in wit-0.3.0-draft/types.wit and compare its stated behavior with the linked POSIX 2008 specification. Enumerate the proposed semantics for existing paths, directory access, component length, and empty paths; done means reaching a project decision and documenting the resulting rule or explicit exceptions.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, operating-systems
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.