Skip to content

Commit

Permalink
ci: define runas function inline
Browse files Browse the repository at this point in the history
We don't have `test/units/util.sh`, which provides the definition of `runas` function in the RHEL9 codebase

Also partially backport systemd/systemd@c7bf195

rhel-only

Related: RHEL-35703
  • Loading branch information
jamacku authored and github-actions[bot] committed Jun 12, 2024
1 parent 10e811e commit 3e50911
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/test-functions
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ BASICTOOLS=(
seq
setfattr
setfont
setpriv
setsid
sfdisk
sh
Expand Down Expand Up @@ -2616,10 +2617,10 @@ inst_binary() {
# Same as above, but we need to wrap certain libraries unconditionally
#
# chown, getent, login, su, useradd, userdel - dlopen()s (not only) systemd's PAM modules
# ls, stat - pulls in nss_systemd with certain options (like ls -l) when
# ls, setpriv, stat - pulls in nss_systemd with certain options (like ls -l) when
# nsswitch.conf uses [SUCCESS=merge] (like on Arch Linux)
# tar - called by machinectl in TEST-25
if get_bool "$IS_BUILT_WITH_ASAN" && [[ "$bin" =~ /(chown|getent|login|id|ls|stat|su|tar|useradd|userdel)$ ]]; then
if get_bool "$IS_BUILT_WITH_ASAN" && [[ "$bin" =~ /(chown|getent|login|id|ls|setpriv|stat|su|tar|useradd|userdel)$ ]]; then
wrap_binary=1
fi

Expand Down
7 changes: 7 additions & 0 deletions test/units/testsuite-65.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ set -eux
# shellcheck source=test/units/assert.sh
. "$(dirname "$0")"/assert.sh

# On RHEL9 we don't have the `util.sh` script, so we need to define the `runas` function here
runas() {
local userid="${1:?}"
shift
XDG_RUNTIME_DIR=/run/user/"$(id -u "$userid")" setpriv --reuid="$userid" --init-groups "$@"
}

systemctl log-level debug
export SYSTEMD_LOG_LEVEL=debug

Expand Down

0 comments on commit 3e50911

Please sign in to comment.