mej / nhc

LBNL Node Health Check
Other
226 stars 79 forks source link

bug in nhc_job_find_users() leading to misjudgment of illegal process #119

Open taleintervenor opened 1 year ago

taleintervenor commented 1 year ago

nhc/scripts/lbnl_job.nhc: function nhc_job_find_users()

if [[ "${JOBUSERS[*]//$JOBUSER}" = "${JOBUSERS[*]}" ]]; then
     JOBUSERS[${#JOBUSERS[*]}]="$JOBUSER"
fi

I can not understand why using variable substitution to check element exist in array. The trick seem to be quite meaningless and will cause misjudgement when one element is substring of another. For example: 2 user bob and bob_01 both have running jobs on a node, and nhc execute check_ps_unauth_users . When bob is checked after bob_01 , this code will think bob already exist in array and thus not count it as authorized user.