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

Print successfully create link, however, the link file do not exist. #4878

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

Comments

@Userzxcvbvnm
Copy link
Contributor

Userzxcvbvnm commented Jun 20, 2024

Describe the bug

Fail to write the array content into the file, although print success.

Steps to reproduce

(1)The test case is :



#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>

void path_symlink_00001_Hxmt0() {
    printf("Enter function path_symlink_00001_Hxmt0\n");
    

    
    if (symlinkat("softfile_1", AT_FDCWD, "NEWFILE") == -1) {
        perror("symlinkat");
        return;
    }
    
    printf("Symbolic link created successfully\n");
}

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);
    }
}

int main() {
    
    
    path_symlink_00001_Hxmt0();
    
    
    
    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, softfile_1 exists and points to subdir_1/subdir_3/subfile_2, the file subdir_1/subdir_3/subfile_2 also exists.)
wasmer run --dir=. test.wasm

Expected behavior

print:

Enter function path_symlink_00001_Hxmt0
Symbolic link created successfully

and the NEWFILE file exists.

This is what wasmtime, WAMR and WasmEdge do.

Actual behavior

wasmer also print:

Enter function path_symlink_00001_Hxmt0
Symbolic link created successfully

but NEWFILE do not exist.

Additional context

Ubuntu 20.04
x86_64
wasmer-4.3.1 and wasmer-4.2.2

@maminrayej maminrayej self-assigned this Jun 20, 2024
@maminrayej maminrayej added bug Something isn't working 📦 lib-vfs About wasmer-vfs priority-high High priority issue labels Jun 20, 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