wizer.initialize can't read file even if --allow-wasi --dir . specified?
还没有人认领这个 Issue。
评估
调研方向
使用 main.go、main.wasm、test.txt 以及带有 --allow-wasi --dir . 的 wizer 命令重现该失败,然后将其与成功的 wasmtime --dir . 运行进行比较。跟踪 wizer 在 wizer.initialize 入口点期间如何处理 --dir preopen;当初始化函数能够读取 test.txt 并在没有 errno 76 错误的情况下生成 out.wasm 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Given the program
package main
import "os"
var theText string
//go:export wizer.initialize
func WizerInitialize() {
buf, err := os.ReadFile("test.txt")
if err != nil {
println("error: Cannot read test.txt", err.Error())
}
theText = string(buf)
}
func main() {
if theText == "" {
WizerInitialize()
}
println("theText", theText)
}
This succeeds, and outputs foobar as expected:
tinygo build -target=wasi -scheduler=none -wasm-abi=generic -o main.wasm main.go
echo "foobar" > test.txt
wasmtime --dir . main.wasm
but this
wizer --allow-wasi --dir . -o out.wasm < main.wasm
fails with
error: Cannot read test.txt open test.txt: errno 76
Setting RUST_LOG=debug shows that it is at least preopening the directory:
[2021-07-20T16:12:44Z DEBUG wizer] Validating input Wasm
[2021-07-20T16:12:44Z DEBUG wizer] Preparing input Wasm
[2021-07-20T16:12:44Z DEBUG wasmtime_cache::worker] Cache worker thread started.
[2021-07-20T16:12:44Z DEBUG wasmtime_cache::worker] New nice value of worker thread: 3
[2021-07-20T16:12:44Z DEBUG wizer] Validating the exported initialization function
[2021-07-20T16:12:44Z DEBUG wizer] Calling the initialization function
[2021-07-20T16:12:44Z DEBUG wizer] Preopening directory: .
[2021-07-20T16:12:44Z DEBUG wizer] Creating dummy imports
error: Cannot read test.txt open test.txt: errno 76
Passing a bad directory to --dir does abort, so it is at least opening the directory.
This is on mac, so I have not gone through the agony of using dtruss to see if it is actually trying to open a file.
- 主要语言
- Rust
- 星标
- 1.1k
- 派生
- 64
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bytecodealliance/wizer 的其他 Issue
-
Broken link (2021 WebAssembly Summit)可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 1/5 1 小时以内 新手友好度 72/100
bytecodealliance/wizer#130 ·
-
难度 5/5 一周以上 新手友好度 30/100
bytecodealliance/wizer#153 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
bytecodealliance/wizer#126 ·
-
难度 4/5 3-5 天 新手友好度 25/100
bytecodealliance/wizer#125 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 32/100
bytecodealliance/wizer#105 · 1 条评论 ·
查看 bytecodealliance/wizer 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 63/100
pop-os/cosmic-files#2117 ·
维护者通常 2 天内回复
-
L: java:gradle L: java:maven L: ruby:bundler T: bug 🐞
难度 2/5 1-3 小时 新手友好度 76/100
dependabot/dependabot-core#16547 ·
维护者通常 1 天内回复
-
bug status:ready-for-test
难度 2/5 1-3 小时 新手友好度 78/100
UniClipboard/UniClipboard#1985 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
RustCrypto/SSH#596 ·
-
area:breg rust
难度 2/5 1-3 小时 新手友好度 76/100
registrystack/registry-stack#2034 ·
维护者通常 1 天内回复