commit a33d15751b3e3910bd06125efbeae6569844f313 from: Alexander Barton date: Sat Apr 13 13:54:06 2024 UTC Test suite: Don't use "pgrep -u" when LOGNAME and USER are not set Thanks for reporting this on IRC, luca! commit - b362b5a94554a3f4818c90bf54f8715b58ab923b commit + a33d15751b3e3910bd06125efbeae6569844f313 blob - 8505914208e68538013bd0777d40d380ccbe2fc7 blob + 3cc186e1c9b8ff3c1b02d38484614dffb20aeb20 --- src/testsuite/getpid.sh +++ src/testsuite/getpid.sh @@ -23,7 +23,13 @@ if [ -x /usr/bin/pgrep ]; then *) PGREP_FLAGS="" esac - exec /usr/bin/pgrep $PGREP_FLAGS -n -u "${LOGNAME:-$USER}" "$1" + if [ -n "$LOGNAME" ] || [ -n "$USER" ]; then + # Try to narrow the search down to the current user ... + exec /usr/bin/pgrep $PGREP_FLAGS -n -u "${LOGNAME:-$USER}" "$1" + else + # ... but neither LOGNAME nor USER were set! + exec /usr/bin/pgrep $PGREP_FLAGS -n "$1" + fi fi # pidof(1) could be a good alternative on elder Linux systems