GithubHelp home page GithubHelp logo

Comments (3)

yagehu avatar yagehu commented on June 21, 2024

Sorry for the noise. I think I was on a bad commit.

from wasmer.

yagehu avatar yagehu commented on June 21, 2024

I've reverted back to a good commit and this problem remains. I'll investigate and confirm with a wasi-fyi test case.

from wasmer.

yagehu avatar yagehu commented on June 21, 2024

Here's a wasi-fyi test that confirms the problem.

use std::ffi::CString;
use std::fs;

#[link(wasm_import_module = "wasi_snapshot_preview1")]
extern "C" {
    pub fn path_open(
        fd: i32,
        dirflags: i32,
        path: i32,
        path_len: i32,
        oflags: i32,
        fs_rights_base: i64,
        fs_rights_inheriting: i64,
        fdflags: i32,
        result_fd: i32,
    ) -> i32;
}

const ERRNO_SUCCESS: i32 = 0;
const ERRNO_EXIST: i32 = 20;
const OFLAGS_CREAT: i32 = 1;
const OFLAGS_EXCL: i32 = 4;
const RIGHTS_FD_READ: i64 = 2;
const RIGHTS_FD_WRITE: i64 = 64;

fn main() {
    unsafe {
        let fd = 5;
        let path0 = CString::new("fyi/fs_open_dir_excl.dir").unwrap();
        let path1 = CString::new("fyi/fs_open_dir_excl.dir/file").unwrap();
        let errno = path_open(
            fd,
            0,
            path0.as_ptr() as i32,
            path0.as_bytes().len() as i32,
            OFLAGS_CREAT | OFLAGS_EXCL,
            RIGHTS_FD_READ | RIGHTS_FD_WRITE,
            0,
            0,
            1024,
        );
        assert_eq!(
            errno, ERRNO_EXIST,
            "opening an existing directory with excl should fail"
        );

        let _ = fs::remove_file("/fyi/fs_open_dir_excl.dir/file");
        let errno = path_open(
            fd,
            0,
            path1.as_ptr() as i32,
            path1.as_bytes().len() as i32,
            OFLAGS_CREAT | OFLAGS_EXCL,
            RIGHTS_FD_READ | RIGHTS_FD_WRITE,
            0,
            0,
            1024,
        );
        assert_eq!(
            errno, ERRNO_SUCCESS,
            "opening a non-existing path with excl should succeed"
        );
    }
}

from wasmer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.