jameysharp opened PR #6283 from jameysharp:backport-6163
to bytecodealliance:release-8.0.0
:
The
O_DIRECTORY
flag is a request that open should fail if the named path is not a directory. Opening a path which turns out to be a directory is not supposed to fail if this flag is not specified. However, wasi-common required callers to use it when opening directories.With this PR, we always open the path the same way whether or not the
O_DIRECTORY
flag is specified. However, after opening it, westat
it to check whether it turned out to be a directory, and determine which operations the file descriptor should support accordingly. In addition, we explicitly check whether the precondition defined byO_DIRECTORY
is satisfied.On Windows, when opening a path which might be a directory using
CreateFile
, cap-primitives also removes theFILE_SHARE_DELETE
mode. That means that if we implement WASI'spath_open
such that it always usesCreateFile
on Windows, for both files and directories, then holding an open file handle prevents deletion of that file.
jameysharp requested alexcrichton for a review on PR #6283.
jameysharp requested wasmtime-core-reviewers for a review on PR #6283.
alexcrichton submitted PR review:
Thanks! Mind adding an entry to
RELEASES.md
as well?
jameysharp requested wasmtime-default-reviewers for a review on PR #6283.
jameysharp updated PR #6283.
alexcrichton submitted PR review.
jameysharp merged PR #6283.
Last updated: Nov 22 2024 at 16:03 UTC