wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

Write content through softlink file bug ?

Open Userzxcvbvnm opened this issue 1 year ago • 1 comments

Test Case

The c file is uploaded as test-c.txt

The wasm file is uploaded as test-wasm.txt

Steps to Reproduce

We create a normal file Data/hello.txt, and a softlink file Data/link/hello_softlink.txt points to Data/hello.txt using command wasmtime run --dir=./Data test.wasm to execute the wasm file.

Expected Results

In windows, WAMR could write content successfully to the source file Data/hello.txt. And this behavior could be considered as a right behavior, since Data/link/hello_softlink.txt points to Data/hello.txt.

Actual Results

wasmtime create a new file Data/link/hello.txt and write content to this file rather the file Data/hello.txt. This may be a bug?

Versions and Environment

Wasmtime version or commit: 13.0.0

Operating system: Windows 10

Architecture: amd64

Userzxcvbvnm avatar Dec 08 '23 11:12 Userzxcvbvnm

Thanks for the report. I've gotten around now to debugging this. I am, however, unfortunately unable to reproduce. Here's what I did:

$ mkdir Data
$ cd Data
# ... create a `hello.txt` file here
$ mkdir link
$ cd link
$ mklink hello_softlink.txt ..\hello.txt

When I run Wasmtime with that --dir Data file then the wasm module executes successfully and the contents show up in Data/hello.txt as expected.

Can you clarify exactly how you set up the symlinks and such? I find the syntax for creating symlinks often confusing so I'm curious if you may have made a mistake in the direction of the symlink or forgotten a ../ for example.

alexcrichton avatar Jan 28 '24 20:01 alexcrichton