Skip to content

Commit

Permalink
Merge pull request #5971 from grondo/issue#2852
Browse files Browse the repository at this point in the history
flux-job: improve EPERM error message
  • Loading branch information
mergify[bot] committed May 16, 2024
2 parents a3cfb3b + 4149a9e commit 8a6eb0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cmd/job/attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,9 @@ void attach_event_continuation (flux_future_t *f, void *arg)
goto done;
if (errno == ENOENT)
log_msg_exit ("Failed to attach to %s: No such job", ctx->jobid);
if (errno == EPERM)
log_msg_exit ("Failed to attach to %s: that is not your job",
ctx->jobid);
log_msg_exit ("flux_job_event_watch_get: %s",
future_strerror (f, errno));
}
Expand Down
9 changes: 9 additions & 0 deletions t/t2500-job-attach.t
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,13 @@ test_expect_success 'attach: writing to stdin of closed tasks returns EPIPE' '
test_debug "cat pipe.out" &&
grep -i "Broken pipe" pipe.out
'
test_expect_success 'attach: EPERM generates sensible error' '
jobid=$(flux job last) &&
( export FLUX_HANDLE_USERID=42 &&
export FLUX_HANDLE_ROLEMASK=0x2 &&
test_must_fail flux job attach -vEX $jobid 2>eperm.err
) &&
test_debug "cat eperm.err" &&
grep -i "not your job" eperm.err
'
test_done

0 comments on commit 8a6eb0e

Please sign in to comment.