fix(worker): restore getpwnam execuser-existence check (bug-1507 merge regression)
The scheduler-framework merge (4e894d21) reverted the bug-1507 fix fromc091a8da: job_start_local_task fell back to nobody only when execuser was EMPTY, not when it does not exist on the worker host — a submit-user missing from /etc/passwd makes systemd fail the worker unit with EXIT_USER (217) and every job dies. Restored the getpwnam() existence check (+ #include <pwd.h>). All 21 worker tests pass; fallback log message verified in the built xcecd. Also records the merge-overwrite lesson in cerebrum Do-Not-Repeat: after any branch-sync merge, re-verify each previously-fixed bug's marker symbol survived (git show <merge>:<file> | grep -c <symbol> vs <merge>^).
This commit is contained in:
parent
10865a4e63
commit
05ac57b183
4 changed files with 26 additions and 5 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "xcelog.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -1000,7 +1001,23 @@ static int job_start_local_task(xce_request_t* request)
|
|||
}
|
||||
|
||||
if (job_ctx->startinfo->execuser != NULL) {
|
||||
job_ctx->limits->user_name = strdup(job_ctx->startinfo->execuser);
|
||||
/* bug-1507 (merge-regression-restored): the exec user is the
|
||||
* submitting account, which is not necessarily a real /etc/passwd
|
||||
* account on this worker host, and systemd then fails the worker
|
||||
* unit with EXIT_USER (217), killing every job. Fall back to
|
||||
* nobody so the job still runs. (Restored from c091a8da — the
|
||||
* scheduler-framework merge 4e894d21 had reverted this check.) */
|
||||
struct passwd* pw = getpwnam(job_ctx->startinfo->execuser);
|
||||
if (pw != NULL) {
|
||||
job_ctx->limits->user_name
|
||||
= strdup(job_ctx->startinfo->execuser);
|
||||
} else {
|
||||
job_ctx->limits->user_name = strdup("nobody");
|
||||
XCECD_LOG(XCE_LOG_WARN,
|
||||
"exec user '%s' does not exist on this host, "
|
||||
"running job as nobody",
|
||||
job_ctx->startinfo->execuser);
|
||||
}
|
||||
} else {
|
||||
job_ctx->limits->user_name = strdup("nobody");
|
||||
XCECD_LOG(XCE_LOG_WARN,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue