-
Notifications
You must be signed in to change notification settings - Fork 989
Description
With a fresh windows 11 machine and today's dev (including clang 14):
$ ~/src/tinygo/build/tinygo test -target wasi os
Returning nil error open C:\Users\dank\AppData\Local\Temp\tinygotmp1446174477/TestFd.txt147587007: file not found
Caused by:
1: 0x63ad - runtime.nilPanic
at C:\Users\dank\src\tinygo\src\runtime\panic.go:32:14
2: 0x332f5 - (*os.File).Name
3: 0x755c5 - os_test.TestFd
at C:\Users\dank\src\tinygo\src\os\file_anyos_test.go:98:21
Running wasmtime os.test under procmon, I noticed something funny: temporary files being opened were at the wrong location, as if wasmtime was confused by drive letters. Building just the test by itself, then creating a writable directory C:\TMP,
then running in a CMD window, I saw that the command
wasmtime --dir=. --dir=.. --dir=..\.. --dir=/tmp --env=TMPDIR=/tmp os.test
succeeds, but the commands
wasmtime --dir=. --dir=.. --dir=..\.. --dir=c:/tmp --env=TMPDIR=c:/tmp os.test
wasmtime --dir=. --dir=.. --dir=..\.. --dir=\tmp --env=TMPDIR=\tmp os.test
wasmtime --dir=. --dir=.. --dir=..\.. --dir=c:\tmp --env=TMPDIR=c:\tmp os.test
all fail. It seems that TMPDIR must be a unix style directory... which makes sense, since wasi is unix-ish.
And since wasmtime probably does an exact compare on the dirs to grant access, it needs the unix style directory, too.
The workaround is easy as long as TMPDIR is on the default drive...
This seems like a regression; wasn't this working before? Maybe not; we haven't been running tinygo-test-wasm in ci on windows...