bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.75k stars 597 forks source link

Open softlink error? #2869

Open Userzxcvbvnm opened 8 months ago

Userzxcvbvnm commented 8 months ago

Steps to reproduce

The test.c file is uploaded test-c.txt And the test.wasm file is uploaded test-wasm.txt

using command iwasm --dir=./Data test.wasm to execute the wasm file.

We create a normal file Data/hello.txt, and a softlink file Data/link/hello_softlink.txt points to Data/hello.txt

Environment

ubuntu 20.04 Windows 10 WAMR-1.2.3

Result

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

However, in Ubuntu, WAMR could not write content to Data/hello.txt. And WAMR create a new file Data/link/hello.txt and write content to Data/link/hello.txt. Maybe this is not correct.

TianlongLiang commented 7 months ago

Hi, I tried your wasm file on my Ubuntu 20.04, it seems that I didn't get the behavior like you descripted. My Steps:

  1. first have a soft link Data/link/hello_softlink.txt points to Data/hello.txt image
  2. run commands iwasm --dir=~./Data test.wasm image

My results are: Successfully write the content to the hello.txt and the hello_softlink.txt remained as a soft link(no matter WAMR-1.2.3 or latest commit)

image

image

Is my step the same as yours? Could you please think of anything that would influence results and make our results different?