Skip to content

Commit

Permalink
Fix "tests: ido: rework test for option -P"
Browse files Browse the repository at this point in the history
The Github Actions FreeBSD-vm, NetBSD-vm and OpenBSD-vm run the CI as
root.

The test prepends the hardcoded value of root (i.e. 0) to the list of
the expected GROUPS.

That value is already part of the GROUPS since ido does not "switch" to
another user (i.e. it runs as root and it usurps the root identity).

As a consequence, the root user-id is duplicated and raises the error
attached below.

This fixes commit 657c1be.

Fixes:

	Running ido: test option -P preserves group vector 0 0 0 5...
	GROUPS=0 0 5
	ido: test option -P preserves group vector 0 0 0 5: [KO]
  • Loading branch information
gportay committed Nov 24, 2024
1 parent 6f5b718 commit d0e7d8a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions tests/tests-ido.bash
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,26 @@ else
fi
echo

run "ido: test option -P preserves group vector 0 ${GROUPS[*]}"
if ( export SHELL=bash && ido -P -s <<<'echo "GROUPS=${GROUPS[*]}"' | tee /dev/stderr | grep -q "^GROUPS=0 ${GROUPS[*]}$" )
if [[ "$UID" -eq 0 ]]
then
ok
run "ido: test option -P preserves group vector ${GROUPS[*]}"
if ( export SHELL=bash && ido -P -s <<<'echo "GROUPS=${GROUPS[*]}"' | tee /dev/stderr | grep -q "^GROUPS=${GROUPS[*]}$" )
then
ok
else
ko
fi
echo
else
ko
run "ido: test option -P preserves group vector 0 ${GROUPS[*]}"
if ( export SHELL=bash && ido -P -s <<<'echo "GROUPS=${GROUPS[*]}"' | tee /dev/stderr | grep -q "^GROUPS=0 ${GROUPS[*]}$" )
then
ok
else
ko
fi
echo
fi
echo

run "ido: test option --preserve-groups preserves group vector ${GROUPS[*]}"
if ( export SHELL=bash && ido --user="$USER" --preserve-groups --shell <<<'echo "GROUPS=${GROUPS[*]}"' | tee /dev/stderr | grep -q "GROUPS=${GROUPS[*]}" )
Expand Down

0 comments on commit d0e7d8a

Please sign in to comment.