Skip to content

Consider new syntax or a new option for the --dir CLI option #7309

@alexcrichton

Description

@alexcrichton

This issue is inspired by discussion on #7301 and Zulip. To summarize a bit, the --dir syntax is inconsistent between Wasmtime and other runtimes, and a notable inconsistency of Wasmtime is the usage of :: as a delimiter as opposed to a single character such as :. I'll also personally note that there's inconsistency with Docker which is another common tool for a similar operatin which uses :.

As of #7301 and Wasmtime 14/15 the CLI for Wasmtime will support:

  • --dir foo - opens the host directory foo and mounts it in the guest as foo
  • --dir foo::bar - opens the host directory foo and mounts it in the guest as bar

I find the discussion over on Docker's documentation pretty illuminating here. The gist, as it applies to Wasmtime, appears to be:

  • Docker's -v is the "old" syntax and is acknowledged to be cryptic and error-prone, and this is basically the same as the --dir syntax Wasmtime has today (and the subject of this comment)
  • Docker's --mount is the "new" syntax which uses --mount key=val,key2=val,key3=val which is more verbose but more clear

While I wasn't personally present (@sunfishcode maybe you were?) when this option was originally added to Wasmtime my guess is that the choice of :: delimiter for Wasmtime assists with Windows-style paths which have colons in them with absolute paths such as C:\foo\bar. Such a concern does not affect Docker, however, where Docker appears to support docker run -v z:\foo:c:\dest ... according to its documentation.

With all that in mind, there's a few questions in my mind of what to do with Wasmtime:

  1. Should --dir be kept at all? Should this be replaced entirely with a separate option with more obvious syntax to readers? (albeit more verbose to writers)
  2. If --dir is kept, can its delimiter be changed to : to be more consistent with Docker? If so how do Windows paths work?
  3. If a new option is added, what should it be called? Additionally what should its syntax be? For Docker it's a ,-delimited list of key=value pairs, but I'm also not sure how this handles paths-with-commas in them.

Personally I think that while the CLI was overhauled for Wasmtime 14 we can still perform this change when we want. It's probably not too too hard to have broad messaging of a change in syntax if --dir changes or gets replaced. So in that sense while we can't change anything for Wasmtime 14, I do still think changes should be considered for 15+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions