This adds FS.Path which holds the pre-open path currently only used in WASI. It also fixes a TODO where we didn't know for sure if the FD parameter for `path_` functions must always be a pre-open. The TL;DR; is that usually it is, but it may not be (e.g. in our zig-cc example we can see any directory FD, not just pre-opens). Finally, this fixes a bug in our path resolution where we mistook paths like "foo/foo" for "foo" because we only considered basenames instead of the full path from the pre-open root. This also makes pre-open directory lookup lazy because I noticed in Trivy specifically, this is unnecessary for us to do eagerly, as they change the FS at runtime per-call. In other words, any value from init time is invalid later. Signed-off-by: Adrian Cole <adrian@tetrate.io>
2.0 KiB
2.0 KiB