myxce/.wolf/bugs/bug-1705.md
Rongsong Shen 4c13412720
chore: sync harness batch and bug-1872/1874-1877 to Gitea (#298-#315)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 04:42:34 +00:00

2.1 KiB

id status status_updated status_note component severity timestamp last_seen occurrences files tags related fix_commits legacy gitea_issue gitea_synced_status gitea_synced_hash
bug-1705 fixed 2026-09-28 controller leak 2026-08-26T09:32:18Z 2026-09-19T09:00:00Z 1
src/harness/test.c
controller
testsuite
xce_test
cmd_jobsub
dead-flag
silent-data-loss
memory-leak
cli-ux-audit
da1a663f
true 301 fixed fe75b0b8060f

bug-1705: cmd_jobsub's -x <exdata> flag is documented (USAGE_JOBSUB) as overriding the built-in PATH-only…

Description

cmd_jobsub's -x <exdata> flag is documented (USAGE_JOBSUB) as overriding the built-in PATH-only exdata JSON, but build_job_exdata()/build_job_envs() unconditionally overwrite submit.start_info->exdata with the built-in PATH JSON regardless of whether -x already set a value -- the exact opposite of the documented behavior. The original -x value is also leaked (never freed before being replaced).

Environment

Not recorded (migrated from buglog.json).

Reproduction

Not recorded (migrated from buglog.json).

Root cause

build_job_exdata()/build_job_envs() have no guard for an already-non-NULL exdata field before overwriting it.

Fix

The default exdata comes from cmdutil_default_exdata(), which only builds the PATH JSON when exdata is still NULL, so -x's value is kept and no longer leaked; a repeated -x frees the earlier copy. cmd_jobsub's cleanup also frees execuser/exechome/execcwd, which leaked on every call.

Verification

  • Test: test_default_exdata_keeps_caller_value and test_default_exdata_builds_path_json_when_unset in src/harness/testsuite/test_cmdutil.c; the old build_job_exdata() overwrote exdata unconditionally, which the first test forbids
  • Suites: harness 6/6 (asan): harness_unit_test 141/0, cmdutil 14/0, resval_typeresolve 7/0, joblist_display 22/0, join_worker_args 7/0, listrow_json 12/0
  • Live: n/a; xce_test is a client tool and every case above runs without a controller

References

Not recorded (migrated from buglog.json).