fix(apiserver): propagate submit user as job execuser (bug-1780)

modelJobToSubmit() never set job_startinfo_t.execuser when converting
a submitted job to the C struct sent to the controller/worker, so
every job ran as the worker's 'nobody' default and failed to exec
(exit 126). Default execuser to the submitting user via a new
resolveExecUser() pure helper, and free the newly allocated C string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hb6Edtj4KbS8CrgEWYdA2E
This commit is contained in:
Rongsong Shen 2026-09-07 08:10:10 +00:00
parent 37ea6dfd9f
commit 5ab344e1ae
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 61 additions and 0 deletions

View file

@ -104,6 +104,18 @@ func WorkerDefaultOutputPath(uniqueJobID int64, taskIdx int) string {
return fmt.Sprintf("/tmp/job_%s_task%d.out", FormatJobID(uniqueJobID), taskIdx)
}
// resolveExecUser returns the effective exec user for a job submission: the
// caller-specified ExecUser if present, otherwise the submitting user
// (bug-1780: an unset execuser in the startjob request reaches xcecd as
// empty, which controller_connector.c defaults to the literal Linux user
// 'nobody' -- a user with no home/shell that then fails to exec the job).
func resolveExecUser(execUser, submitUser string) string {
if execUser != "" {
return execUser
}
return submitUser
}
// rawStartInfo mirrors the C job_startinfo_t fields used by the Go model.
type rawStartInfo struct {
cmdline string