Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
test-82ba4ba1: Add support for a new behavior of chroot(1) + fix a typo.
Browse files Browse the repository at this point in the history
    chroot with an argument of "/" no longer implicitly changes the
    current directory to "/", allowing changing only user credentials
    for a command.

    -- Coreutils-8.23 Changelog

Note that only the behavior of the tool has changed, not the behavior
of the syscall.

Reported-by: Rémi Duraffort <[email protected]>
  • Loading branch information
cedric-vincent committed Sep 4, 2014
1 parent 8788c61 commit da96a8d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test-82ba4ba1.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if [ ! -x /bin/true ] [ -z `which id` ] || [ -z `which grep` ] || [ -z `which env` ] || [ -z `which chown` ] || [ -z `which chroot` ] || [ ! /bin/true ] ; then
if [ ! -x /bin/true ] || [ -z `which id` ] || [ -z `which grep` ] || [ -z `which env` ] || [ -z `which chown` ] || [ -z `which chroot` ] || [ ! /bin/true ] ; then
exit 125;
fi

Expand All @@ -17,10 +17,16 @@ ${PROOT} -i 123:456 env LD_SHOW_AUXV=1 /bin/true | grep '^AT_EGID:[[:space:]]*45
! ${PROOT} -i 123:456 chown root.root /root
[ $? -eq 0 ]

! chroot / /bin/true
EXPECTED=$?

! ${PROOT} -i 123:456 chroot / /bin/true
[ $? -eq 0 ]
[ $? -eq ${EXPECTED} ]

! ${PROOT} -i 123:456 chroot /tmp/.. /bin/true
[ $? -eq ${EXPECTED} ]

! ${PROOT} -i 123:456 chroot /tmp /bin/true
[ $? -eq 0 ]

${PROOT} -0 id -u | grep ^0$
Expand Down

0 comments on commit da96a8d

Please sign in to comment.