sandlock icon indicating copy to clipboard operation
sandlock copied to clipboard

`-i/--interactive` is accepted and never read

Open dzerik opened this issue 4 months ago • 1 comments

crates/sandlock-cli/src/main.rs:137-138 declares the flag:

#[arg(short = 'i', long)]
interactive: bool,

The field is never read anywhere in the crate. Every *_interactive occurrence in main.rs (:651, :660, :681, :722, :731) is a policy method — run_interactive, dry_run_interactive, create_interactive — reached unconditionally, not gated on the flag.

Reproduction

Verified on main (0.8.5). It is accepted, and it does nothing:

$ sandlock run -r /usr -r /lib -r /lib64 -r /bin -- /bin/sh -c 'echo out; echo err >&2; exit 7'
out
err
$ echo $?
7

$ sandlock run -i -r /usr -r /lib -r /lib64 -r /bin -- /bin/sh -c 'echo out; echo err >&2; exit 7'
out
err
$ echo $?
7

Identical stdout, stderr and exit status. Statically, the absence is easy to confirm — no read of the field exists:

$ rg -n '\.interactive\b|args\.interactive' crates/sandlock-cli/src/
(no matches)

It also shows up in --help with an empty description, since it is the only flag in RunArgs without a doc comment:

$ sandlock run --help
...
  -i, --interactive
          
...

Minor on its own, but it reads as a behaviour switch: someone passing -i reasonably expects the run to differ, and someone omitting it may expect a non-interactive path that does not exist.

Either wire it to something or drop it — I'd drop it, since the interactive path is already unconditional. Trivial patch either way if you want one.

dzerik avatar Jul 29 '26 13:07 dzerik

You are right, let's drop it.

congwang-mk avatar Jul 30 '26 00:07 congwang-mk