whitequark opened issue #8955:
Feature
I would like it to be possible to override
argv[0]
for commands executed withwasmtime run
. E.g.:wasmtime run --argv0=clang++ bin/clang.wasm ...
Benefit
Certain applications use the value of
argv[0]
to:
- Dispatch between incompatible code paths (multi-call binaries), e.g. Clang;
- Discover location of data via executable-relative paths, e.g. also Clang in some cases.
In general I think the path passed to
wasmtime run
is only meaningful on the host and will rarely if ever mean anything within the sandbox.Implementation
A new option
--argv0=
would work for me, but really anything that gets the job done is fine.Alternatives
I can't think of any besides not having the functionality.
whitequark edited issue #8955:
Feature
I would like it to be possible to override
argv[0]
for commands executed withwasmtime run
. E.g.:wasmtime run --argv0=clang++ bin/clang.wasm ...
Benefit
Certain applications use the value of
argv[0]
to:
- Dispatch between incompatible code paths (multi-call binaries), e.g. Clang;
- Discover location of data via executable-relative paths, e.g. also Clang in some cases (not the usual configuration though).
In general I think the path passed to
wasmtime run
is only meaningful on the host and will rarely if ever mean anything within the sandbox.Implementation
A new option
--argv0=
would work for me, but really anything that gets the job done is fine.Alternatives
I can't think of any besides not having the functionality.
alexcrichton commented on issue #8955:
This sounds reasonable to me to implement as well, and I think
--argv0
is a fine name as well. We already infer it from the provided wasm module so providing the ability to customize that seems like a good idea.
whitequark commented on issue #8955:
I was going to implement it originally, but unfortunately I lost the direct motivation for this as I've moved to shipping the combined LLVM compiler driver (the
llvm
command, if you've seen it, as it's a bit obscure... it's likebusybox
) which takes the command to invoke asargv[1]
.
whitequark edited a comment on issue #8955:
I was going to implement it originally, but unfortunately I lost the direct motivation for this as I've moved to shipping the combined LLVM compiler driver (the
llvm
command, if you've seen it, as it's a bit obscure... it's likebusybox
) which takes the command to invoke asargv[1]
. The combined binary is about 25% smaller so it's clearly preferable to ship.
whitequark edited a comment on issue #8955:
I was going to implement it originally, but unfortunately I lost the direct motivation for this as I've moved to shipping the combined LLVM compiler driver (the
llvm
command, if you've seen it, as it's a bit obscure... it's likebusybox
with every single tool compiled into it) which takes the command to invoke asargv[1]
. The combined binary is about 25% smaller so it's clearly preferable to ship.
alexcrichton closed issue #8955:
Feature
I would like it to be possible to override
argv[0]
for commands executed withwasmtime run
. E.g.:wasmtime run --argv0=clang++ bin/clang.wasm ...
Benefit
Certain applications use the value of
argv[0]
to:
- Dispatch between incompatible code paths (multi-call binaries), e.g. Clang;
- Discover location of data via executable-relative paths, e.g. also Clang in some cases (not the usual configuration though).
In general I think the path passed to
wasmtime run
is only meaningful on the host and will rarely if ever mean anything within the sandbox.Implementation
A new option
--argv0=
would work for me, but really anything that gets the job done is fine.Alternatives
I can't think of any besides not having the functionality.
whitequark commented on issue #8955:
Thank you!
Last updated: Nov 22 2024 at 16:03 UTC