Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard link creation successful print but the file do not exist. #4904

Open
Userzxcvbvnm opened this issue Jun 26, 2024 · 0 comments
Open

Hard link creation successful print but the file do not exist. #4904

Userzxcvbvnm opened this issue Jun 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working 📦 lib-vfs About wasmer-vfs priority-high High priority issue

Comments

@Userzxcvbvnm
Copy link
Contributor

Describe the bug

Hard link creation successful print but the file do not exist.
Related to #4870

Steps to reproduce

(1)The test case is :


#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

int get_fd(const char *filename, int flags) {
    int fd = open(filename, flags);
    
    if (fd == -1) {
        printf("Get file descriptor of file %s failed!\n", filename);
        return -1;
    } else {
        printf("Get file descriptor of file %s succeed!\n", filename);
        return fd;
    }
}

void closebyfd(int fd) {
    if (close(fd) == -1) {
        printf("Close the file %d by descriptor failed!\n", fd);
    }
}


void path_link_00002_Nan21() {

    printf("Enter function path_link_00002_Nan21\n");
    
    
    
    int result = linkat(AT_FDCWD, "subdir_2/subdir_1/subfile_3", AT_FDCWD, "HARDLINKFILE", AT_SYMLINK_NOFOLLOW);
    
    if (result == -1) {
        printf("linkat failed");
    } else {
        printf("Hard link creation successful\n");
    }

    
}

int main() {
    printf("Enter function main\n");
   
    path_link_00002_Nan21();

    return 0;
}


(2)compile to wasm:./wasi-sdk-21.0/bin/clang --target=wasm32-unkown-wasi --sysroot=./wasi-sdk-21.0/share/wasi-sysroot test.c -o test.wasm

(3)Running wasm:
(Before run the Wasm file, file subdir_2/subdir_1/subfile_3 exists.)
wasmer run --dir=. test.wasm

Expected behavior

Successfully create the link file and print:

Enter function main
Enter function path_link_00002_Nan21
Hard link creation successful

And this is what WAMR, wasmtime and WasmEdge do.

Actual behavior

wasmer print:

Enter function main
Enter function path_link_00002_Nan21
Hard link creation successful

But the file HARDLINKFILE does not exist checking by command line, which is different from wasmtime, WAMR and WasmEdge.

Additional context

Ubuntu 20.04
x86_64
wasmer-4.2.2

@maminrayej maminrayej added bug Something isn't working 📦 lib-vfs About wasmer-vfs priority-high High priority issue labels Jun 27, 2024
@maminrayej maminrayej self-assigned this Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📦 lib-vfs About wasmer-vfs priority-high High priority issue
Projects
None yet
Development

No branches or pull requests

2 participants