Skip to content

wasip3 filesystem: Opening dir with MUTATE_DIRECTORY but not READ doesn't preserve MUTATE_DIRECTORY #11667

@wingo

Description

@wingo
async fn test_flags_and_type(dir: &Descriptor) {
    let open = |path: &str, oflags: OpenFlags, fdflags: DescriptorFlags| -> _ {
        dir.open_at(PathFlags::empty(), path.to_string(), oflags, fdflags)
    };
    let d = open(".", OpenFlags::empty(), DescriptorFlags::MUTATE_DIRECTORY).await.unwrap();
    assert_eq!(d.get_flags().await,
               Ok(DescriptorFlags::READ | DescriptorFlags::MUTATE_DIRECTORY));
}

I would expect that the directory is opened with MUTATE_DIRECTORY. However it seems it is not:

openat2(3, ".", {flags=O_RDONLY|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC, resolve=RESOLVE_NO_MAGICLINKS|RESOLVE_BENEATH}, 24) = 12
statx(12, "", AT_STATX_SYNC_AS_STAT|AT_EMPTY_PATH, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=4096, ...}) = 0
fcntl(12, F_GETFL)                      = 0x28000 (flags O_RDONLY|O_LARGEFILE|O_NOFOLLOW)

It seems we only have READ:

thread '<unnamed>' (1) panicked at src/bin/filesystem.rs:620:5:
assertion `left == right` failed
  left: Ok(DescriptorFlags(READ))
 right: Ok(DescriptorFlags(READ | MUTATE_DIRECTORY))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixingwasiIssues pertaining to WASIwasi:implIssues pertaining to WASI implementation in Wasmtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions