-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Hello, while investigating wasmerio/wasmer#372 I tried to reproduce what the submitter said and found:
wasmtime --dir=../ --dir=./ ~/etc/hello-wasi/copy.wasm ../LICENSE ./LICENSE
error opening input ../LICENSE: Capabilities insufficient
fails.
However, changing the order of the --dir flags to:
wasmtime --dir=./ --dir=../ ~/etc/hello-wasi/copy.wasm ../LICENSE ./LICENSE
works.
The way I'm approaching this so far for Wasmer is to canonicalize all the preopen dir paths, sort them lexicographically (ensuring parent directories come before child directories (assuming symlinks have been resolved away(1) (which is WIP currently))), then each path is reduced until it's empty or it matches a directory we've already seen and then they're connected (creating intermediate directory entries as necessary).
I'm not entirely clear on the desired behavior, but this seems correct from what I've read so far.
I'd be curious to hear your thoughts on this!
(1): which seems to be the desired behavior anyways, pre-opened FDs seem like they should be snapshotted at the moment of FS instantiation rather than relying on symlinks that could change during execution