From e5a9d18f2897af845cf42b791ccc56bc35584a0b Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 9 Dec 2025 14:49:40 +0100 Subject: [PATCH 1/2] Update documentation for `wasi:filesystem:descriptor#link-at`. It would have been nice for `linkat` to do just what POSIX does, but Windows includes the case of hard-linking a directory in EACCESS instead of the POSIX-prescribed EPERM. --- proposals/filesystem/wit-0.3.0-draft/types.wit | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proposals/filesystem/wit-0.3.0-draft/types.wit b/proposals/filesystem/wit-0.3.0-draft/types.wit index 141072bdb..7211889c1 100644 --- a/proposals/filesystem/wit-0.3.0-draft/types.wit +++ b/proposals/filesystem/wit-0.3.0-draft/types.wit @@ -489,11 +489,12 @@ interface types { /// Create a hard link. /// - /// Fails with `error-code::no-entry` if the old path does not exist, - /// with `error-code::exist` if the new path already exists, and - /// `error-code::not-permitted` if the old path is not a file. + /// Behavior is as described by [POSIX + /// `linkat`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html). /// - /// Note: This is similar to `linkat` in POSIX. + /// Note: some platforms return `error-code::access` instead of + /// `error-code::not-permitted` when attempting to hard-link a + /// directory. @since(version = 0.3.0-rc-2025-09-16) link-at: async func( /// Flags determining the method of how the path is resolved. From cc52ae2590acb7f539eba6ca7f9df4c0a3ceaf93 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 9 Dec 2025 15:15:02 +0100 Subject: [PATCH 2/2] Add language forbidding hard links to directories. Fixes https://github.com/WebAssembly/WASI/issues/722. --- proposals/filesystem/wit-0.3.0-draft/types.wit | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/proposals/filesystem/wit-0.3.0-draft/types.wit b/proposals/filesystem/wit-0.3.0-draft/types.wit index 7211889c1..32be7ecac 100644 --- a/proposals/filesystem/wit-0.3.0-draft/types.wit +++ b/proposals/filesystem/wit-0.3.0-draft/types.wit @@ -492,9 +492,8 @@ interface types { /// Behavior is as described by [POSIX /// `linkat`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html). /// - /// Note: some platforms return `error-code::access` instead of - /// `error-code::not-permitted` when attempting to hard-link a - /// directory. + /// Hard links between directories are forbidden, and produce either + /// `error-code::access` or `error-code::not-permitted` error results. @since(version = 0.3.0-rc-2025-09-16) link-at: async func( /// Flags determining the method of how the path is resolved.