Open Userzxcvbvnm opened 1 week ago
Looks like AT_SYMLINK_FOLLOW
is explicitly denied: https://github.com/bytecodealliance/wasmtime/blob/95fee6f4bd0b96460dfc5411ff678d0b2967b772/crates/wasi/src/host/filesystem.rs#L483-L485 This is explicitly required by the wasi test suite: https://github.com/WebAssembly/wasi-testsuite/blob/2fec29ea6de1244c124f7fe3bfe9f2946113f66e/tests/rust/src/bin/path_link.rs#L177-L189 (seems to originate from https://github.com/bytecodealliance/wasmtime/commit/17f43d4cc347a54e34e7a0e65a34e5faef92919e) Wasmtime has been rejecting AT_SYMLINK_FOLLOW
on path_link
since https://github.com/bytecodealliance/wasmtime/commit/fded424e689dd5f5a3f3e1539f4bc2b36a6e324e.
Test Case
The c test case is:
Steps to Reproduce
(1)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
(2)Running wasm: (Before run the Wasm file, file subdir_1/subdir_3/subfile_1 exists.)
wasmtime run --dir=. test.wasm
Expected Results
Successfully create the link file and print:
This is what WAMR and WasmEdge do.
Actual Results
wasmtime prints:
However, with the parameter AT_SYMLINK_NOFOLLOW, wasmtime could cucceed, but with parameter AT_SYMLINK_FOLLOW, wasmtime fails. The parameter AT_SYMLINK_FOLLOW means if the file subdir_1/subdir_3/subfile_1 is a softlink file, the file HARDLINKFILE is expected to points to the source file of subdir_1/subdir_3/subfile_1. In this case, subdir_1/subdir_3/subfile_1 is a not a softlink file, but, I think, in this way,it is expected that HARDLINKFILE points to subdir_1/subdir_3/subfile_1 directly. I'm not sure whether this is a bug.
Versions and Environment
Wasmtime version or commit: 19.0.2 and 13.0.1 Operating system: Ubuntu 20.04 Architecture: x86_64