eradman/entr

tmux tests fail with disabled account

Closed this issue · 2 comments

entr/system_test.sh

Lines 176 to 193 in 6954418

# terminal tests
unset TMUX
try "spacebar triggers utility"
setup
tmux new-session -s $tsession -d
echo "waiting" > $tmp/file1
echo "finished" > $tmp/file2
tmux send-keys -t $tsession:0 \
"ls $tmp/file2 | ./entr -p cp $tmp/file2 $tmp/file1" C-m ; zz
assert "$(cat $tmp/file1)" "waiting"
tmux send-keys -t $tsession:0 "xyz" C-m ; zz
assert "$(cat $tmp/file1)" "waiting"
tmux send-keys -t $tsession:0 " " ; zz
assert "$(cat $tmp/file1)" "finished"
tmux send-keys -t $tsession:0 "q" ; zz
tmux kill-session -t $tsession

At least on OpenBSD, the system user running system_test.sh has nologin(8) configured as SHELL, that is to say all builds and tests are run as unprivileged, noninteractive user.

This means tmux starts, but fails to run any commands, in effect causing #150.

................no server running on /tmp/tmux-55/default
.no server running on /tmp/tmux-55/default
.no server running on /tmp/tmux-55/default

FAIL: spacebar triggers utility
'waiting' != 'finished'
*************************************
System test directory contents:
==> /usr/ports/pobj/entr-5.6/entr-system-test-cT8yX2/file1 <==
waiting

==> /usr/ports/pobj/entr-5.6/entr-system-test-cT8yX2/file2 <==
finished
*************************************
*** Error 1 in /usr/ports/pobj/entr-5.6/entr-5.6 (Makefile.bsd:21 'check')

Is it possible to run tmux as a user without a valid login shell? At first it doesn't appear so

$ doas -u _pbuild tmux -c /bin/ksh
This account is currently not available.

$ doas -u _pbuild tmux
[exited]

Is it possible to run tmux as a user without a valid login shell?

Yes, either set default-shell or provide SHELL in the environment; both will pop a shell in tmux:

$ echo 'set -g default-shell /bin/sh' >conf
$ doas -u _pbuild tmux -f conf
$ doas -u _pbuild env SHELL=/bin/sh tmux

I just committed the latter in OpenBSD's ports Makefile as its simpler and makes all 49 tests pass.