E524 fix(tool): Return Erro BADF error when try to sync a directory by tushar1977 · Pull Request #4572 · WasmEdge/WasmEdge · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@tushar1977
Copy link

This change aligns WasmEdge’s fd_sync behavior with wasmtime and POSIX by returning __WASI_ERRNO_BADF when fd_sync is invoked on a directory file descriptor, instead of __WASI_ERRNO_NOTCAPABLE.

Issue - #3039

As implemented in wasmtime, the same error is returned whenever a directory file descriptor is encountered. In wasmtime, fd_sync first validates that the file descriptor refers to a regular file:

    async fn fd_sync(&mut self, _memory: &mut GuestMemory<'_>, fd: types::Fd) -> Result<(), Error> {
    self.table().get_file(u32::from(fd))?  <------ get file will invoke and returns Bad file descriptor error
        .file
        .sync()
        .await?;
    Ok(())
}

@tushar1977 tushar1977 requested a review from ibmibmibm as a code owner January 28, 2026 13:52
@github-project-automation github-project-automation bot moved this to Triage-required in WasmEdge Roadmap Jan 28, 2026
@github-actions github-actions bot added the WASI https://github.com/WebAssembly/WASI label Jan 28, 2026
Signed-off-by: Tushar Gupta <tushar.197712@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WASI https://github.com/WebAssembly/WASI

Projects

Status: Triage-required

Development

Successfully merging this pull request may close these issues.

1 participant

0