Change -e/--exec's short option to -x
-e was going to collide with the shape of other single-letter destructive- ish operational flags; -x frees up the letter and reads fine as --exec's short form. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gv3s5jckJKzh6JkMoi2Akz
This commit is contained in:
@@ -35,12 +35,12 @@ Source layout (all under `src/`):
|
||||
the top of `main()`: mode/`--volume` interaction (`-v` alone vs. combined
|
||||
with `-r`, see below), `--group` requires `--user`, no leftover positional
|
||||
args outside `-r`/`-e`, and (moved here from what used to be inline in the
|
||||
`Mode::exec` dispatch arm) `-e/--exec <pid>`'s own pid parsing/validation
|
||||
`Mode::exec` dispatch arm) `-x/--exec <pid>`'s own pid parsing/validation
|
||||
(`ParsedArgs::exec_pid`, a positive integer or a hard error) and its
|
||||
trailing-command requirement (`ParsedArgs::command`, required non-empty).
|
||||
`-k/--kill <pid>` (`ParsedArgs::kill_pid`) shares that same positive-integer
|
||||
parsing/validation via a small extracted `parse_pid_arg()` helper (`.cpp`-local)
|
||||
rather than duplicating the `strtol` dance a second time — unlike `-e/--exec`,
|
||||
rather than duplicating the `strtol` dance a second time — unlike `-x/--exec`,
|
||||
it takes no trailing command, so it's simply not added to the leftover-args
|
||||
exemption list (`Mode::run`/`Mode::exec` only). Returns an exit code `main()`
|
||||
should return immediately (`0` for `-h`/`-V`,
|
||||
@@ -283,9 +283,9 @@ Source layout (all under `src/`):
|
||||
`find_priv_drop_helper()` and the `priv_drop::path`/`priv_drop::helper_name`
|
||||
constants live in `bwrap.h` (not just internal to `bwrap.cpp`) specifically so
|
||||
`exec_in_session()` (`exec_session.cpp`, see below) can reuse the exact same
|
||||
already-bind-mounted helper for `-e/--exec`'s own `--user`/`--group` support,
|
||||
already-bind-mounted helper for `-x/--exec`'s own `--user`/`--group` support,
|
||||
instead of a second copy needing to be bind-mounted for it (which wouldn't even
|
||||
be possible — `-e/--exec` joins an *already-running* session's mount namespace,
|
||||
be possible — `-x/--exec` joins an *already-running* session's mount namespace,
|
||||
it doesn't get to add bind mounts to it). `find_priv_drop_helper()` itself only
|
||||
checks this binary's own host-side existence; it says nothing about whether a
|
||||
given session actually has it bind-mounted (only true when that session's
|
||||
@@ -503,7 +503,7 @@ Source layout (all under `src/`):
|
||||
pattern for "there's only ever one of these per process" runtime state),
|
||||
since `report_daemon_started()` is called later, from a different function,
|
||||
not threaded explicitly through every call in between.
|
||||
- `exec_session.{h,cpp}` — implements `-e/--exec <pid>`: joins an already-running
|
||||
- `exec_session.{h,cpp}` — implements `-x/--exec <pid>`: joins an already-running
|
||||
`-r/--run` session's namespaces via `nsenter` and runs a command inside it in
|
||||
the foreground. `exec_in_session()` first confirms `pid` is a tracked, running
|
||||
session via `list_sessions()` (`pid_file.h`) — same liveness check
|
||||
@@ -546,12 +546,12 @@ Source layout (all under `src/`):
|
||||
`user_spec.h`, see below); if unset, defaults to whatever uid/gid the session's
|
||||
own sandboxed command is *already* running as (read from `/proc/<ns_pid>/status`),
|
||||
rather than root/the caller — fixing a real bug (reported after this project's
|
||||
own `-e/--exec` and priv-drop features had both shipped separately): without this,
|
||||
`-e/--exec` always ran as whatever the *host* invocation was, ignoring any
|
||||
own `-x/--exec` and priv-drop features had both shipped separately): without this,
|
||||
`-x/--exec` always ran as whatever the *host* invocation was, ignoring any
|
||||
`--user`/`--group` the session itself was started with. Either way, the resolved
|
||||
identity is applied by running `command` through the session's already
|
||||
bind-mounted `slocker-lite-priv-drop` helper (`priv_drop::path`, `bwrap.h`) —
|
||||
reused as-is, not bind-mounted again (`-e/--exec` can't add bind mounts to an
|
||||
reused as-is, not bind-mounted again (`-x/--exec` can't add bind mounts to an
|
||||
already-running session's namespace anyway). Skipped entirely when the resolved
|
||||
uid *and* gid are both 0: a session that was never given a resolvable user at
|
||||
`-r/--run` time never got the helper bind-mounted at all, and dropping to 0:0
|
||||
@@ -778,7 +778,7 @@ Build directory is `buildDir/` (already configured).
|
||||
(see `priv_drop_helper.cpp` in "Project state")
|
||||
- Run the executable: `./buildDir/slocker-lite -m <image.tar>` (see `--help` for the
|
||||
full flag list: `-m/--mount`, `-r/--run`, `-u/--umount`, `-c/--cleanup`,
|
||||
`-l/--list-images`, `-i/--inspect`, `-e/--exec`, `-k/--kill`, `-n/--no-nsenter`, `-D/--daemonize`,
|
||||
`-l/--list-images`, `-i/--inspect`, `-x/--exec`, `-k/--kill`, `-n/--no-nsenter`, `-D/--daemonize`,
|
||||
`--user`, `--group`, `--hostname`, `--env`, `--env-file`, `-v/--volume`, `--list-volumes`, `--delete-volume`,
|
||||
`--delete-volume-full`, `--list-processes`, `--clean-processes`, `-t/--test`, `--log-level`,
|
||||
`-h/--help`, `-V/--version`)
|
||||
|
||||
Reference in New Issue
Block a user