wasmer
wasmer copied to clipboard
Print successfully create link, however, the link file do not exist.
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