Open
Description
I'm trying to run some code with to-be Go 1.21's wasip1/wasm support.
We have some code:
cfgPath := filepath.Join(s.rootPath, "tailscaled.log.conf")
lpc, err := logpolicy.ConfigFromFile(cfgPath)
switch {
case os.IsNotExist(err):
lpc = logpolicy.NewConfig(logtail.CollectionNode)
if err := lpc.Save(cfgPath); err != nil {
return fmt.Errorf("logpolicy.Config.Save for %v: %w", cfgPath, err)
}
case err != nil:
return fmt.Errorf("logpolicy.LoadConfig for %v: %w", cfgPath, err)
}
And instead of hitting that os.IsNotExist
path, it's going into the case err != nil
path with:
$ wasmtime run --env=HOME=$HOME --dir=. ~/go/bin/wasip1_wasm/tshello
2023/06/12 00:28:09 tsnet: logpolicy.LoadConfig for tailscaled.log.conf: open tailscaled.log.conf: Bad file number
It's possible I'm holding wasmtime
wrong, but "Bad file number" doesn't tell me much. Is that a not found error or a sandbox violation error, or ...?
/cc @johanbrandhorst