myxce/src/harness
Rongsong Shen da1a663f05
fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs)
Stack overflows on user input:
- bug-1702 jobrun -m: host segment strncpy'd into a 256-byte buffer
  unbounded (ASAN stack-buffer-overflow); now cmdutil_split_host_tasks()
  refuses an over-long host.
- bug-1703 jobsub -n: min strncpy'd into a 64-byte buffer; now
  cmdutil_parse_ntasks() parses in place, 1 <= min <= max.
- resupdate's 16-entry vals[] had no bound either; a 17th -n overflowed.

Wrong or silent results:
- bug-1574 resupdate type/model: set_resval() had no string case, left the
  entry's name uninitialized, and crashed the encoder. Moved to
  resval_typeresolve.c as resval_fill(), which fills every type.
- bug-1705 jobsub -x was overwritten (and leaked) by the default exdata;
  cmdutil_default_exdata() only fills an unset one. jobsub's
  execuser/exechome/execcwd copies leaked on every call.
- bug-1707 a trailing -n without -v was dropped silently; resupdate also
  returned 0 after its RPC failed and "succeeded" with nothing to send.
- bug-1708 jobkill -s SIGKILL became signal 0 and was sent.
- bug-1709 jobinfo exited 0 with no -j, a malformed -j, or no hits.
- bug-1710 hello -c 0 sent nothing and reported success.
- bug-1712 a duplicate -v was reported as "no res name found".
- bug-1777 workerlist showed join-time maxmem/maxswap/maxtmp, not the
  effective values (hosts.yaml overrides) the reply already carries in
  resvals_to_sched and the scheduler uses.
- bug-1793 join's maxswap/maxtmp defaults were 1 KB / 2 KB in bytes; now
  1 GiB / 2 GiB, and -m/-s/-t no longer overflow atoi() above 2 GB.

Error reporting and leaks:
- bug-1796 RPC failures printed perror() of a stale errno ("Connection
  refused" / "Invalid argument" / "Inappropriate ioctl for device" for
  the same failure). cmdutil_rpc_error() prints the RPC's own code
  (E_XCE_* included) at all 19 sites.
- bug-1797 qctrl leaked the queue name on the RPC-error path; repeated
  -q/-h leaked the earlier copy.

New src/harness/cmdutil.c (+ cmdutil_unit_test, 14 cases); 9 new
test_test_cli.c cases, 8 RED on the old xce_test; new resval_fill,
worker_effective_attr and join-default tests (join ones RED on the old
join_worker_args.c). Harness suite 6/6 (asan), harness_unit_test 141/0.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 04:17:04 +00:00
..
include fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
testsuite fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
CLAUDE.md docs(xce-harness-component): refresh harness CLAUDE.md post-implementation 2026-09-14 11:27:15 +00:00
cmdutil.c fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
configcompare.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
confirm.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
flagspec.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
interruptcall.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
joblist_display.c fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
join_worker_args.c fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
listfmt_json.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
listrow_json.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
meson.build fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
rcfile.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
resval_typeresolve.c fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
snapdiff.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
snapverify.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
test.c fix(harness): xce_test argument validation, RPC error text and leaks (13 bugs) 2026-09-28 04:17:04 +00:00
walcompare.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00
waldump.c feat(xce-harness-component): relocate xce_test into standalone harness component 2026-09-14 05:08:15 +00:00