wallet_child: spawn errors must name argv[0] and refuse a bin that is not an executable file #203

Merged
sirius merged 2 commits from wt/t_af5bbc1a into main 2026-10-31 05:47:28 +00:00
Owner

Why

The Android wallet screen showed Wallet error → spawn monero-wallet-rpc: No such file or directory (os error 2).
That names the label, not the argv[0] that failed, so a bare monero-wallet-rpc (never resolvable in an APK sandbox) and an absolute /data/app/.../libmonerowalletrpc.so (present in the v0.7.0 APK) produced the same undiagnosable message.

What changed

  • spawn(argv, what) now carries both halves: spawn monero-wallet-rpc (<argv[0]>): <errno verbatim>. The existing human label stays; no cause is invented for indistinguishable ErrorKinds.
  • New check_wallet_rpc_bin(configured, resolved, bare_resolvable) pre-flights the resolved wallet RPC bin before anything is spawned (before monerod/Cuprate, before the SOCKS child, before creds):
    • ... not found (<errno>)
    • ... is not a file
    • ... is not executable
    • message carries the configured path (and the resolved one when they differ).
    • No PATH search and no fallback location: a bare name is left to exec where a PATH exists.
  • ChildConfig::validate() now refuses a bare wallet_rpc_bin where a child has no PATH to resolve it (cfg!(target_os = "android")), instead of persisting a setting that could only fail at exec. Desktop behaviour is unchanged (the bare-name default still passes there and resolves via PATH).
  • ChainSource::None is untouched: start returns before start_children, so receive-only still spawns nothing and validates nothing.

Verification (this host, branch wt/t_af5bbc1a @ a375ef9)

$ cargo test --lib wallet_child
test result: ok. 41 passed; 0 failed; 0 ignored   (includes a_spawn_error_names_argv0_and_the_label,
  a_missing_wallet_rpc_bin_is_refused_with_the_configured_path, a_wallet_rpc_bin_that_is_not_a_file_is_refused,
  a_wallet_rpc_bin_without_any_execute_bit_is_refused, a_bare_wallet_rpc_bin_is_refused_where_path_cannot_resolve_it,
  start_refuses_a_wallet_rpc_bin_that_is_not_there)

$ cargo test --lib
test result: ok. 179 passed; 0 failed; 2 ignored

$ cargo test --test wallet
test result: ok. 62 passed; 0 failed; 0 ignored

$ cargo clippy --all-targets -- -D warnings
Finished `dev` profile

$ cargo build --release --bin onionwire
Finished `release` profile [optimized]

Existing node::tests::a_missing_binary_fails_the_start_and_leaves_no_child asserted only err.contains("spawn"); it now asserts the configured path and not found.

Notes

  • Platform check is compile-time (cfg!(target_os = "android")) inside the core; the Android branch of check_wallet_rpc_bin is unit-tested by passing bare_resolvable = false explicitly on this host, so the rule has a test that runs here.
  • No argv, port, --rpc-login, --trusted-daemon, arti/SOCKS, Kotlin or docs changes.
## Why The Android wallet screen showed `Wallet error` → `spawn monero-wallet-rpc: No such file or directory (os error 2)`. That names the label, not the `argv[0]` that failed, so a bare `monero-wallet-rpc` (never resolvable in an APK sandbox) and an absolute `/data/app/.../libmonerowalletrpc.so` (present in the v0.7.0 APK) produced the same undiagnosable message. ## What changed - `spawn(argv, what)` now carries both halves: `spawn monero-wallet-rpc (<argv[0]>): <errno verbatim>`. The existing human label stays; no cause is invented for indistinguishable `ErrorKind`s. - New `check_wallet_rpc_bin(configured, resolved, bare_resolvable)` pre-flights the resolved wallet RPC bin **before anything is spawned** (before `monerod`/Cuprate, before the SOCKS child, before creds): - `... not found (<errno>)` - `... is not a file` - `... is not executable` - message carries the configured path (and the resolved one when they differ). - No `PATH` search and no fallback location: a bare name is left to `exec` where a `PATH` exists. - `ChildConfig::validate()` now refuses a bare `wallet_rpc_bin` where a child has no `PATH` to resolve it (`cfg!(target_os = "android")`), instead of persisting a setting that could only fail at `exec`. Desktop behaviour is unchanged (the bare-name default still passes there and resolves via `PATH`). - `ChainSource::None` is untouched: `start` returns before `start_children`, so receive-only still spawns nothing and validates nothing. ## Verification (this host, branch `wt/t_af5bbc1a` @ `a375ef9`) ``` $ cargo test --lib wallet_child test result: ok. 41 passed; 0 failed; 0 ignored (includes a_spawn_error_names_argv0_and_the_label, a_missing_wallet_rpc_bin_is_refused_with_the_configured_path, a_wallet_rpc_bin_that_is_not_a_file_is_refused, a_wallet_rpc_bin_without_any_execute_bit_is_refused, a_bare_wallet_rpc_bin_is_refused_where_path_cannot_resolve_it, start_refuses_a_wallet_rpc_bin_that_is_not_there) $ cargo test --lib test result: ok. 179 passed; 0 failed; 2 ignored $ cargo test --test wallet test result: ok. 62 passed; 0 failed; 0 ignored $ cargo clippy --all-targets -- -D warnings Finished `dev` profile $ cargo build --release --bin onionwire Finished `release` profile [optimized] ``` Existing `node::tests::a_missing_binary_fails_the_start_and_leaves_no_child` asserted only `err.contains("spawn")`; it now asserts the configured path and `not found`. ## Notes - Platform check is compile-time (`cfg!(target_os = "android")`) inside the core; the Android branch of `check_wallet_rpc_bin` is unit-tested by passing `bare_resolvable = false` explicitly on this host, so the rule has a test that runs here. - No argv, port, `--rpc-login`, `--trusted-daemon`, arti/SOCKS, Kotlin or docs changes.
wallet_child: name argv[0] in spawn errors and pre-flight the RPC bin
All checks were successful
ci / test (pull_request) Successful in 29m37s
ci / sdk (pull_request) Successful in 10s
a375ef9d1e
The Android report was `spawn monero-wallet-rpc: No such file or directory
(os error 2)` — the label, not the argv[0] that failed, so a bare name and
an absolute jniLibs path read identically.

- spawn() now prints the label and argv[0]: `spawn monero-wallet-rpc
  (/data/app/.../libmonerowalletrpc.so): ...`, errno verbatim.
- check_wallet_rpc_bin() pre-flights the resolved bin before anything is
  spawned: not found / not a file / not executable, with the configured
  path in the message. No PATH search, no fallback.
- A bare wallet_rpc_bin is refused where a child has no PATH to resolve it
  (cfg(target_os = "android")), in ChildConfig::validate() and in the
  start-path pre-flight. Desktop keeps the bare-name default.
- Tests for each refusal and for the argv[0] error; the node test that
  asserted the old `spawn` copy now asserts the path.
Merge branch 'main' into wt/t_af5bbc1a
Some checks failed
ci / test (pull_request) Has been cancelled
ci / sdk (pull_request) Has been cancelled
android-ci / android (pull_request) Has been cancelled
3092b9d63e
sirius merged commit 83e9527a5f into main 2026-10-31 05:47:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!203
No description provided.