Remove support for the old way to specify guest rootfs, à la chroot.

This command-line interface was deprecated since PRoot v3.1.

Before:

    $ proot /
    proot info: neither `-r` or `-R` were specified, assuming '/' is the new root file-system.

Now:

    $ proot /
    proot error: '/' is not a regular file
This commit is contained in:
Cédric VINCENT 2014-05-16 12:38:55 +02:00
parent c0128eafb1
commit e2db9ff342
31 changed files with 149 additions and 154 deletions

View File

@ -119,7 +119,7 @@ void print_version(const Cli *cli)
static void print_execve_help(const Tracee *tracee, const char *argv0, int status)
{
notice(tracee, WARNING, SYSTEM, "execve(\"%s\")", argv0);
notice(tracee, ERROR, SYSTEM, "execve(\"%s\")", argv0);
/* Ubuntu kernel bug? */
if (status == -EPERM && getenv("PROOT_NO_SECCOMP") == NULL) {

View File

@ -22,10 +22,8 @@
#include <string.h> /* str*(3), */
#include <assert.h> /* assert(3), */
#include <sys/types.h> /* stat(2), */
#include <sys/stat.h> /* stat(2), */
#include <unistd.h> /* stat(2), */
#include <stdio.h> /* printf(3), fflush(3), */
#include <unistd.h> /* write(2), */
#include "cli/cli.h"
#include "cli/notice.h"
@ -311,7 +309,7 @@ static int post_initialize_command(Tracee *tracee, const Cli *cli UNUSED,
* are not required on the command line, i.e. "-w" and "-r".
*/
static int pre_initialize_bindings(Tracee *tracee, const Cli *cli,
size_t argc UNUSED, char *const *argv, size_t cursor)
size_t argc UNUSED, char *const *argv UNUSED, size_t cursor)
{
int status;
@ -322,27 +320,9 @@ static int pre_initialize_bindings(Tracee *tracee, const Cli *cli,
return -1;
}
/* When no guest rootfs were specified: if the first bare
* option is a directory, then the old command-line interface
* (similar to the chroot one) is expected. Otherwise this is
* the new command-line interface where the default guest
* rootfs is "/". */
/* The default guest rootfs is "/" if none was specified. */
if (get_root(tracee) == NULL) {
char path[PATH_MAX];
struct stat buf;
if (argv[cursor] != NULL
&& realpath2(tracee->reconf.tracee, path, argv[cursor], true) == 0
&& stat(path, &buf) == 0
&& S_ISDIR(buf.st_mode)) {
notice(tracee, INFO, USER,
"neither `-r` or `-R` were specified, assuming"
" '%s' is the new root file-system.", argv[cursor]);
status = handle_option_r(tracee, cli, argv[cursor]);
cursor++;
}
else
status = handle_option_r(tracee, cli, "/");
status = handle_option_r(tracee, cli, "/");
if (status < 0)
return -1;
}

View File

@ -223,8 +223,21 @@ int which(Tracee *tracee, const char *paths, char host_path[PATH_MAX], char *con
/* Is the command available without any $PATH look-up? */
status = realpath2(tracee, host_path, command, true);
found = ( status == 0 && stat(host_path, &statr) == 0
&& S_ISREG(statr.st_mode) && (statr.st_mode & S_IXUSR) != 0);
if (status == 0 && stat(host_path, &statr) == 0) {
if (!S_ISREG(statr.st_mode)) {
notice(tracee, ERROR, USER, "'%s' is not a regular file", command);
return -EACCES;
}
if ((statr.st_mode & S_IXUSR) == 0) {
notice(tracee, ERROR, USER, "'%s' is not executable", command);
return -EACCES;
}
found = true;
}
else
found = false;
/* Is the the explicit command was found? */
if (is_explicit) {
@ -275,13 +288,13 @@ not_found:
if (status < 0)
strcpy(path, "<unknown>");
notice(tracee, WARNING, USER, "'%s' not found (root = %s, cwd = %s, $PATH=%s)",
notice(tracee, ERROR, USER, "'%s' not found (root = %s, cwd = %s, $PATH=%s)",
command, get_root(tracee), path, paths);
/* Check if the command was found without any $PATH look-up
* but it didn't contain "/". */
if (found && !is_explicit)
notice(tracee, INFO, USER,
notice(tracee, ERROR, USER,
"to execute a local program, use the './' prefix, for example: ./%s", command);
return -1;

View File

@ -29,10 +29,10 @@ check-%.c: $(ROOTFS)/bin/% setup
# Special cases.
check-test-bdc90417.c: test-bdc90417
$(call check_c,$<,$(PROOT) -w . / ./$<)
$(call check_c,$<,$(PROOT) -w . ./$<)
check-test-af062114.c: test-af062114
$(call check_c,$<,$(PROOT) -v -1 -q /bin/true -b . -b /lib -b /lib64 -b /proc $(ROOTFS) ./$< | grep -- --inhibit-rpath)
$(call check_c,$<,$(PROOT) -v -1 -q /bin/true -b . -b /lib -b /lib64 -b /proc -r $(ROOTFS) ./$< | grep -- --inhibit-rpath)
# $(call check_c,$<,$(PROOT) -v -1 -q /bin/true / ./$< | grep '^./$<') deprecated
check-test-5bed7141.c: test-5bed7141

View File

@ -2,4 +2,4 @@ if [ ! -x ${ROOTFS}/bin/true ]; then
exit 125;
fi
${PROOT} ${ROOTFS} /bin/true
${PROOT} -r ${ROOTFS} /bin/true

View File

@ -2,6 +2,6 @@ if [ ! -x ${ROOTFS}/bin/pwd ] || [ -z `which grep` ]; then
exit 125;
fi
${PROOT} -m /:/hostfs -w /hostfs/etc ${ROOTFS} pwd | grep '^/hostfs/etc$'
${PROOT} -m /:/hostfs -w /hostfs ${ROOTFS} pwd | grep '^/hostfs$'
${PROOT} -m /:/hostfs -w / ${ROOTFS} pwd | grep '^/$'
${PROOT} -m /:/hostfs -w /hostfs/etc -r ${ROOTFS} pwd | grep '^/hostfs/etc$'
${PROOT} -m /:/hostfs -w /hostfs -r ${ROOTFS} pwd | grep '^/hostfs$'
${PROOT} -m /:/hostfs -w / -r ${ROOTFS} pwd | grep '^/$'

View File

@ -53,7 +53,7 @@ if [ -z ${PROOT_STAGE2} ]; then
generate $REF
env PROOT_STAGE2=$REF ${PROOT} -w ${PWD} / sh ./$0
env PROOT_STAGE2=$REF ${PROOT} -w ${PWD} sh ./$0
exit $?
fi

View File

@ -9,9 +9,9 @@ mkdir -p ${ROOTFS}/tmp
echo '#!/bin/true' > ${ROOTFS}/${TMP}
chmod -x ${ROOTFS}/${TMP}
! ${PROOT} ${ROOTFS} ${TMP}
! ${PROOT} -r ${ROOTFS} ${TMP}
chmod +x ${ROOTFS}/${TMP}
${PROOT} ${ROOTFS} ${TMP}
${PROOT} -r ${ROOTFS} ${TMP}
rm -f ${ROOTFS}/${TMP}

View File

@ -12,8 +12,8 @@ mkdir -p ${ROOTFS}/tmp
touch ${ROOTFS}/tmp/${REGULAR}
ln -fs /tmp/${REGULAR} ${ROOTFS}/tmp/${SYMLINK}
${PROOT} -b /tmp:/ced ${ROOTFS} /bin/readlink /tmp/${SYMLINK} | grep ^/tmp/${REGULAR}$
${PROOT} -b /tmp:/ced ${ROOTFS} /bin/readlink /ced/${SYMLINK} | grep ^/ced/${REGULAR}$
${PROOT} -b /tmp:/ced -r ${ROOTFS} /bin/readlink /tmp/${SYMLINK} | grep ^/tmp/${REGULAR}$
${PROOT} -b /tmp:/ced -r ${ROOTFS} /bin/readlink /ced/${SYMLINK} | grep ^/ced/${REGULAR}$
rm -f /tmp/${REGULAR}
rm -f /tmp/${SYMLINK}

View File

@ -35,25 +35,25 @@ else
COMMAND2="-0 ${TMP} ${TMP} ${TMP2}"
fi
${PROOT} -q true / ${TMP}
! ${PROOT} -q false / ${TMP}
${PROOT} -q true ${TMP}
! ${PROOT} -q false ${TMP}
[ $? -eq 0 ]
(cd /; ${PROOT} -q ./$(which true) / ${TMP})
! (cd /; ${PROOT} -q ./$(which false) / ${TMP})
(cd /; ${PROOT} -q ./$(which true) ${TMP})
! (cd /; ${PROOT} -q ./$(which false) ${TMP})
[ $? -eq 0 ]
HOST_LD_LIBRARY_PATH=$(${PROOT} -q 'echo --' / env | grep LD_LIBRARY_PATH)
HOST_LD_LIBRARY_PATH=$(${PROOT} -q 'echo --' env | grep LD_LIBRARY_PATH)
test ! -z "${HOST_LD_LIBRARY_PATH}"
unset LD_LIBRARY_PATH
${PROOT} -q 'echo --' / ${TMP} | grep -- "^-- -U LD_LIBRARY_PATH ${COMMAND1}$"
${PROOT} -q 'echo --' / env LD_LIBRARY_PATH=test1 ${TMP} | grep -- "^${TEST1}$"
env LD_LIBRARY_PATH=test2 ${PROOT} -q 'echo --' / ${TMP} | grep -- "^${TEST2}$"
${PROOT} -q 'echo --' ${TMP} | grep -- "^-- -U LD_LIBRARY_PATH ${COMMAND1}$"
${PROOT} -q 'echo --' env LD_LIBRARY_PATH=test1 ${TMP} | grep -- "^${TEST1}$"
env LD_LIBRARY_PATH=test2 ${PROOT} -q 'echo --' ${TMP} | grep -- "^${TEST2}$"
env LD_LIBRARY_PATH=test2 ${PROOT} -q 'echo --' / env LD_LIBRARY_PATH=test1 ${TMP} | grep -- "^${TEST3}$"
env LD_LIBRARY_PATH=test2 ${PROOT} -q 'echo --' env LD_LIBRARY_PATH=test1 ${TMP} | grep -- "^${TEST3}$"
${PROOT} -q 'echo --' / env LD_TRACE_LOADED_OBJECTS=1 ${TMP} | grep -E -- "^${TEST4}$"
${PROOT} -q 'echo --' env LD_TRACE_LOADED_OBJECTS=1 ${TMP} | grep -E -- "^${TEST4}$"
env LD_LIBRARY_PATH=test5 ${PROOT} -q 'echo --' sh -c ${TMP} | grep -- "^${TEST5}$"
env LD_LIBRARY_PATH=test5 ${PROOT} -q 'echo --' sh -c "sh -c ${TMP}" | grep -- "^${TEST52}$"

View File

@ -2,4 +2,4 @@ if [ -z `which sh` ] || [ -z `which kill` ] || [ -z `which grep` ] || [ -z `whic
exit 125;
fi
${PROOT} / sh -c 'kill -15 $(grep TracerPid /proc/self/status | cut -f 2 -d :)'
${PROOT} sh -c 'kill -15 $(grep TracerPid /proc/self/status | cut -f 2 -d :)'

View File

@ -2,4 +2,4 @@ if [ ! -x ${ROOTFS}/bin/pwd ]; then
exit 125;
fi
${PROOT} -m /tmp:/longer-tmp -w /longer-tmp ${ROOTFS} /bin/pwd
${PROOT} -m /tmp:/longer-tmp -w /longer-tmp -r ${ROOTFS} /bin/pwd

View File

@ -3,31 +3,31 @@ if [ -z `which mcookie` ] || [ -z `which grep` ] || [ ! -x ${ROOTFS}/bin/readlin
fi
DOES_NOT_EXIST=/$(mcookie)
${PROOT} -v -1 -b /proc -w ${DOES_NOT_EXIST} ${ROOTFS} readlink /proc/self/cwd | grep '^/$'
${PROOT} -v -1 -b /proc -w ${DOES_NOT_EXIST} -r ${ROOTFS} readlink /proc/self/cwd | grep '^/$'
${PROOT} -v -1 -w /a -b /tmp:/a -b /tmp:/b ${ROOTFS} pwd | grep '^/a$'
${PROOT} -v -1 -w /a -b /tmp:/b -b /tmp:/a ${ROOTFS} pwd | grep '^/a$'
${PROOT} -v -1 -w /b -b /tmp:/a -b /tmp:/b ${ROOTFS} pwd | grep '^/b$'
${PROOT} -v -1 -w /b -b /tmp:/b -b /tmp:/a ${ROOTFS} pwd | grep '^/b$'
${PROOT} -v -1 -w /a -b /tmp:/a -b /tmp:/b -r ${ROOTFS} pwd | grep '^/a$'
${PROOT} -v -1 -w /a -b /tmp:/b -b /tmp:/a -r ${ROOTFS} pwd | grep '^/a$'
${PROOT} -v -1 -w /b -b /tmp:/a -b /tmp:/b -r ${ROOTFS} pwd | grep '^/b$'
${PROOT} -v -1 -w /b -b /tmp:/b -b /tmp:/a -r ${ROOTFS} pwd | grep '^/b$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b ${ROOTFS} chdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a ${ROOTFS} chdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b ${ROOTFS} chdir_getcwd /b | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a ${ROOTFS} chdir_getcwd /b | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b -r ${ROOTFS} chdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a -r ${ROOTFS} chdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b -r ${ROOTFS} chdir_getcwd /b | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a -r ${ROOTFS} chdir_getcwd /b | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b ${ROOTFS} fchdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a ${ROOTFS} fchdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b ${ROOTFS} fchdir_getcwd /b | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a ${ROOTFS} fchdir_getcwd /b | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b -r ${ROOTFS} fchdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a -r ${ROOTFS} fchdir_getcwd /a | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/a -b /tmp:/b -r ${ROOTFS} fchdir_getcwd /b | grep '^/[ab]$'
${PROOT} -v -1 -b /tmp:/b -b /tmp:/a -r ${ROOTFS} fchdir_getcwd /b | grep '^/[ab]$'
! ${PROOT} ${ROOTFS} chdir_getcwd /bin/true
! ${PROOT} -r ${ROOTFS} chdir_getcwd /bin/true
[ $? -eq 0 ]
! ${PROOT} ${ROOTFS} fchdir_getcwd /bin/true
! ${PROOT} -r ${ROOTFS} fchdir_getcwd /bin/true
[ $? -eq 0 ]
! ${PROOT} -w /bin ${ROOTFS} chdir_getcwd true
! ${PROOT} -w /bin -r ${ROOTFS} chdir_getcwd true
[ $? -eq 0 ]
! ${PROOT} -w /bin ${ROOTFS} fchdir_getcwd true
! ${PROOT} -w /bin -r ${ROOTFS} fchdir_getcwd true
[ $? -eq 0 ]
${PROOT} -v -1 -w /usr -r / ${ROOTFS}/bin/chdir_getcwd share | grep '^/usr/share$'

View File

@ -3,7 +3,7 @@ if [ ! -x ${ROOTFS}/bin/pwd ] || [ -z `which mkdir` ] || [ -z `which grep` ] ||
fi
mkdir -p ${ROOTFS}/${PWD}
${PROOT} -v 1 -w . ${ROOTFS} pwd | grep ^${PWD}$
${PROOT} -v 1 -w . -r ${ROOTFS} pwd | grep ^${PWD}$
TMP=/tmp/$(mcookie)
mkdir ${TMP}

View File

@ -8,6 +8,6 @@ mkdir -p ${ROOTFS}/${TMP}/run/dbus
mkdir -p ${ROOTFS}/${TMP}/var
ln -s ../run ${ROOTFS}/${TMP}/var/run
${PROOT} -b /bin:${TMP}/var/run/dbus ${ROOTFS} readdir ${TMP}/var/run/dbus/ | grep true
${PROOT} -b /bin:${TMP}/var/run/dbus -r ${ROOTFS} readdir ${TMP}/var/run/dbus/ | grep true
rm -fr ${TMP}

View File

@ -2,5 +2,7 @@ if [ ! -x ${ROOTFS}/bin/true ] || [ -z `which env` ]; then
exit 125;
fi
! env PATH=/nib ${PROOT} ${ROOTFS} true
env PATH=/bin ${PROOT} ${ROOTFS} true
! env PATH=/nib ${PROOT} -r ${ROOTFS} true
[ $? -eq 0 ]
env PATH=/bin ${PROOT} -r ${ROOTFS} true

View File

@ -5,6 +5,6 @@ fi
TMP=/tmp/$(mcookie)
echo "OK" > ${TMP}
${PROOT} -b ${TMP}:/etc/fstab -b /dev/null -b /etc / cat /etc/fstab | grep ^OK$
${PROOT} -b ${TMP}:/etc/fstab -b /dev/null -b /etc cat /etc/fstab | grep ^OK$
rm ${TMP}

View File

@ -2,4 +2,4 @@ if [ ! -x /bin/sh ] || [ -z `which grep` ]; then
exit 125;
fi
${PROOT} -w /tmp / /bin/sh -c 'echo $PWD' | grep '^/tmp$'
${PROOT} -w /tmp /bin/sh -c 'echo $PWD' | grep '^/tmp$'

View File

@ -2,20 +2,20 @@ if [ -z `which id` ] || [ -z `which grep` ] || [ -z `which chown` ] || [ -z `whi
exit 125;
fi
${PROOT} -i 123:456 / id -u | grep ^123$
${PROOT} -i 123:456 / id -g | grep ^456$
${PROOT} -i 123:456 id -u | grep ^123$
${PROOT} -i 123:456 id -g | grep ^456$
! ${PROOT} -i 123:456 / chown root.root /root
! ${PROOT} -i 123:456 chown root.root /root
[ $? -eq 0 ]
! ${PROOT} -i 123:456 / chroot / /bin/true
! ${PROOT} -i 123:456 chroot / /bin/true
[ $? -eq 0 ]
! ${PROOT} -i 123:456 / chroot /tmp/.. /bin/true
! ${PROOT} -i 123:456 chroot /tmp/.. /bin/true
[ $? -eq 0 ]
${PROOT} -0 / id -u | grep ^0$
${PROOT} -0 / id -g | grep ^0$
${PROOT} -0 / chown root.root /root
${PROOT} -0 / chroot / /bin/true
${PROOT} -0 / chroot /tmp/.. /bin/true
${PROOT} -0 id -u | grep ^0$
${PROOT} -0 id -g | grep ^0$
${PROOT} -0 chown root.root /root
${PROOT} -0 chroot / /bin/true
${PROOT} -0 chroot /tmp/.. /bin/true

View File

@ -12,32 +12,32 @@ mkdir -p ${ROOTFS}/tmp
ln -s /tmp/ced-host /tmp/${LINK_NAME1}
ln -s /tmp/ced-guest ${ROOTFS}/tmp/${LINK_NAME1}
${PROOT} ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /tmp ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-host$
${PROOT} -b /tmp:/foo ${ROOTFS} readlink /foo/${LINK_NAME1} | grep ^/foo/ced-host$
${PROOT} -b /tmp:/foo ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -r ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /tmp -r ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-host$
${PROOT} -b /tmp:/foo -r ${ROOTFS} readlink /foo/${LINK_NAME1} | grep ^/foo/ced-host$
${PROOT} -b /tmp:/foo -r ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /:/host-rootfs ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /:/host-rootfs -b /tmp:/foo ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /:/host-rootfs -r ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /:/host-rootfs -b /tmp:/foo -r ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
# Always use the deepest binding, deepest from the host point-of-view.
${PROOT} -b /:/host-rootfs ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /:/host-rootfs -b /tmp ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-host$
${PROOT} -b /:/host-rootfs -b /tmp:/foo ${ROOTFS} readlink /foo/${LINK_NAME1} | grep ^/foo/ced-host$
${PROOT} -b /:/host-rootfs -b /tmp ${ROOTFS} readlink /host-rootfs/tmp/${LINK_NAME1} | grep ^/tmp/ced-host$
${PROOT} -b /:/host-rootfs -b /tmp:/foo ${ROOTFS} readlink /host-rootfs/tmp/${LINK_NAME1} | grep ^/foo/ced-host$
${PROOT} -b /:/host-rootfs -r ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-guest$
${PROOT} -b /:/host-rootfs -b /tmp -r ${ROOTFS} readlink /tmp/${LINK_NAME1} | grep ^/tmp/ced-host$
${PROOT} -b /:/host-rootfs -b /tmp:/foo -r ${ROOTFS} readlink /foo/${LINK_NAME1} | grep ^/foo/ced-host$
${PROOT} -b /:/host-rootfs -b /tmp -r ${ROOTFS} readlink /host-rootfs/tmp/${LINK_NAME1} | grep ^/tmp/ced-host$
${PROOT} -b /:/host-rootfs -b /tmp:/foo -r ${ROOTFS} readlink /host-rootfs/tmp/${LINK_NAME1} | grep ^/foo/ced-host$
rm /tmp/${LINK_NAME1}
rm ${ROOTFS}/tmp/${LINK_NAME1}
${PROOT} -b /:/host-rootfs -b /tmp -w /bin ${ROOTFS} symlink /bin/bar /bin/${LINK_NAME1}
${PROOT} -b /:/host-rootfs -b /tmp -w /bin ${ROOTFS} readlink ${LINK_NAME1} | grep ^/bin/bar$
${PROOT} -b /:/host-rootfs -b /tmp -w /bin -r ${ROOTFS} symlink /bin/bar /bin/${LINK_NAME1}
${PROOT} -b /:/host-rootfs -b /tmp -w /bin -r ${ROOTFS} readlink ${LINK_NAME1} | grep ^/bin/bar$
rm ${ROOTFS}/bin/${LINK_NAME1}
${PROOT} -b /:/host-rootfs -b /tmp -w /tmp ${ROOTFS} symlink /bin/bar /tmp/${LINK_NAME1}
${PROOT} -b /:/host-rootfs -b /tmp -w /tmp ${ROOTFS} readlink ${LINK_NAME1} | grep ^/bin/bar$
${PROOT} -b /:/host-rootfs -b /tmp:/foo -w /foo ${ROOTFS} symlink /foo/bar /foo/${LINK_NAME2}
${PROOT} -b /:/host-rootfs -b /tmp:/foo -w /foo ${ROOTFS} readlink ${LINK_NAME2} | grep ^/foo/bar$
${PROOT} -b /:/host-rootfs -b /tmp -w /host-rootfs/tmp ${ROOTFS} readlink ${LINK_NAME2} | grep ^/foo/bar$
${PROOT} -b /:/host-rootfs -b /tmp -w /tmp -r ${ROOTFS} symlink /bin/bar /tmp/${LINK_NAME1}
${PROOT} -b /:/host-rootfs -b /tmp -w /tmp -r ${ROOTFS} readlink ${LINK_NAME1} | grep ^/bin/bar$
${PROOT} -b /:/host-rootfs -b /tmp:/foo -w /foo -r ${ROOTFS} symlink /foo/bar /foo/${LINK_NAME2}
${PROOT} -b /:/host-rootfs -b /tmp:/foo -w /foo -r ${ROOTFS} readlink ${LINK_NAME2} | grep ^/foo/bar$
${PROOT} -b /:/host-rootfs -b /tmp -w /host-rootfs/tmp -r ${ROOTFS} readlink ${LINK_NAME2} | grep ^/foo/bar$
rm /tmp/${LINK_NAME2}
rm /tmp/${LINK_NAME1}

View File

@ -4,49 +4,49 @@ fi
WHICH_READLINK=$(readlink -f $(which readlink))
${PROOT} / readlink /proc/self/exe | grep ^${WHICH_READLINK}$
${PROOT} / sh -c 'readlink /proc/self/exe' | grep ^${WHICH_READLINK}$
${PROOT} / bash -c 'readlink /proc/$$/exe' | grep ^${WHICH_READLINK}$
${PROOT} -b /proc ${ROOTFS} readlink /proc/self/exe | grep ^/bin/readlink$
${PROOT} readlink /proc/self/exe | grep ^${WHICH_READLINK}$
${PROOT} sh -c 'readlink /proc/self/exe' | grep ^${WHICH_READLINK}$
${PROOT} bash -c 'readlink /proc/$$/exe' | grep ^${WHICH_READLINK}$
${PROOT} -b /proc -r ${ROOTFS} readlink /proc/self/exe | grep ^/bin/readlink$
${PROOT} / readlink /proc/1/../self/exe | grep ^${WHICH_READLINK}$
${PROOT} / sh -c 'readlink /proc/1/../self/exe' | grep ^${WHICH_READLINK}$
${PROOT} / bash -c 'readlink /proc/1/../$$/exe' | grep ^${WHICH_READLINK}$
${PROOT} -b /proc ${ROOTFS} readlink /proc/1/../self/exe | grep ^/bin/readlink$
${PROOT} readlink /proc/1/../self/exe | grep ^${WHICH_READLINK}$
${PROOT} sh -c 'readlink /proc/1/../self/exe' | grep ^${WHICH_READLINK}$
${PROOT} bash -c 'readlink /proc/1/../$$/exe' | grep ^${WHICH_READLINK}$
${PROOT} -b /proc -r ${ROOTFS} readlink /proc/1/../self/exe | grep ^/bin/readlink$
! ${PROOT} / readlink /proc/self/exe/
! ${PROOT} readlink /proc/self/exe/
[ $? -eq 0 ]
! ${PROOT} / readlink /proc/self/exe/..
! ${PROOT} readlink /proc/self/exe/..
[ $? -eq 0 ]
! ${PROOT} / readlink /proc/self/exe/../exe
! ${PROOT} readlink /proc/self/exe/../exe
[ $? -eq 0 ]
! ${PROOT} -b /proc / readlink /proc/self/exe/
! ${PROOT} -b /proc readlink /proc/self/exe/
[ $? -eq 0 ]
! ${PROOT} -b /proc / readlink /proc/self/exe/..
! ${PROOT} -b /proc readlink /proc/self/exe/..
[ $? -eq 0 ]
! ${PROOT} -b /proc / readlink /proc/self/exe/../exe
! ${PROOT} -b /proc readlink /proc/self/exe/../exe
[ $? -eq 0 ]
TEST=$(${PROOT} / readlink /proc/self/fd/0 | grep -E "^/proc/[[:digit:]]+/fd/0$" | true)
TEST=$(${PROOT} readlink /proc/self/fd/0 | grep -E "^/proc/[[:digit:]]+/fd/0$" | true)
test -z $TEST
TEST=$(${PROOT} -b /proc ${ROOTFS} readlink /proc/self/fd/0 | grep -E "^/proc/[[:digit:]]+/fd/0$" | true)
TEST=$(${PROOT} -b /proc -r ${ROOTFS} readlink /proc/self/fd/0 | grep -E "^/proc/[[:digit:]]+/fd/0$" | true)
test -z $TEST
if [ ! -z $$ ]; then
TEST=$(readlink -f /proc/$$/exe)
${PROOT} / sh -c 'true; readlink /proc/$$/exe' | grep ${TEST}
${PROOT} sh -c 'true; readlink /proc/$$/exe' | grep ${TEST}
fi
MD5=$(md5sum $(which md5sum) | cut -f 1 -d ' ')
MD5_PROOT=$(${PROOT} / md5sum /proc/self/exe | cut -f 1 -d ' ')
MD5_PROOT=$(${PROOT} md5sum /proc/self/exe | cut -f 1 -d ' ')
test ${MD5_PROOT} = ${MD5}
MD5_PROOT=$(${PROOT} -b /proc / md5sum /proc/self/exe | cut -f 1 -d ' ')
MD5_PROOT=$(${PROOT} -b /proc md5sum /proc/self/exe | cut -f 1 -d ' ')
test ${MD5_PROOT} = ${MD5}

View File

@ -8,7 +8,7 @@ fi
DONT_EXIST=/$(mcookie)
${PROOT} ${ROOTFS} true
${PROOT} -r ${ROOTFS} true
! ${PROOT} ${DONT_EXIST} true
[ $? -eq 0 ]

View File

@ -2,5 +2,5 @@ if [ ! -x ${ROOTFS}/bin/true ]; then
exit 125;
fi
${PROOT} -w /bin ${ROOTFS} ./true
${PROOT} -w /bin -r ${ROOTFS} ./true

View File

@ -2,4 +2,4 @@ if [ -z `which make` ]; then
exit 125;
fi
${PROOT} / make -f ${PWD}/test-c6b77b77.mk
${PROOT} make -f ${PWD}/test-c6b77b77.mk

View File

@ -11,11 +11,11 @@ TMP=/tmp/${D1}/${D2}
mkdir -p ${TMP}
ln -s ${TMP}/./. ${TMP}/${LINK}
${PROOT} / \ls ${TMP}/${LINK} | grep ^${LINK}$
${PROOT} / \ls ${TMP}/${LINK}/ | grep ^${LINK}$
${PROOT} / \ls ${TMP}/${LINK}/. | grep ^${LINK}$
${PROOT} / \ls ${TMP}/${LINK}/.. | grep ^${D2}$
${PROOT} / \ls ${TMP}/${LINK}/./.. | grep ^${D2}$
${PROOT} \ls ${TMP}/${LINK} | grep ^${LINK}$
${PROOT} \ls ${TMP}/${LINK}/ | grep ^${LINK}$
${PROOT} \ls ${TMP}/${LINK}/. | grep ^${LINK}$
${PROOT} \ls ${TMP}/${LINK}/.. | grep ^${D2}$
${PROOT} \ls ${TMP}/${LINK}/./.. | grep ^${D2}$
rm ${TMP}/${LINK}
touch ${TMP}/${F}

View File

@ -17,10 +17,10 @@ echo 'binding 2' > ${TMP2}
mkdir -p ${TMP3}/a/b
BINDINGS="-b ${TMP1}:${TMP3}/a/b/c -b ${TMP3}/a/b -b ${TMP2}:${TMP3}/a/d -b ${TMP3}/a"
${PROOT} ${BINDINGS} / cat ${TMP3}/a/b/c | grep '^binding 1$'
${PROOT} ${BINDINGS} cat ${TMP3}/a/b/c | grep '^binding 1$'
BINDINGS="-b ${TMP3}/a -b ${TMP2}:${TMP3}/a/d -b ${TMP3}/a/b -b ${TMP1}:${TMP3}/a/b/c"
${PROOT} ${BINDINGS} / cat ${TMP3}/a/d | grep '^binding 2$'
${PROOT} ${BINDINGS} cat ${TMP3}/a/d | grep '^binding 2$'
mkdir -p ${TMP3}/c/b
@ -30,10 +30,10 @@ mkdir -p ${TMP3}/c/b
# /c
BINDINGS="-b ${TMP1}:${TMP3}/c/b/a -b ${TMP3}/c/b -b ${TMP2}:${TMP3}/c/d -b ${TMP3}/c"
${PROOT} ${BINDINGS} / cat ${TMP3}/c/b/a | grep '^binding 1$'
${PROOT} ${BINDINGS} cat ${TMP3}/c/b/a | grep '^binding 1$'
BINDINGS="-b ${TMP3}/c -b ${TMP2}:${TMP3}/c/d -b ${TMP3}/c/b -b ${TMP1}:${TMP3}/c/b/a"
${PROOT} ${BINDINGS} / cat ${TMP3}/c/d | grep '^binding 2$'
${PROOT} ${BINDINGS} cat ${TMP3}/c/d | grep '^binding 2$'
rm ${TMP1}
rm ${TMP2}

View File

@ -2,5 +2,5 @@ if [ ! -x ${ROOTFS}/bin/readlink ] || [ ! -e /proc/self/cwd ] || [ -z `which gr
exit 125;
fi
${PROOT} -m /proc -m /tmp:/asym -w /asym ${ROOTFS} /bin/readlink /proc/self/cwd | grep '^/asym$'
${PROOT} -m /proc -m /tmp:/asym -w /tmp ${ROOTFS} /bin/readlink /proc/self/cwd | grep '^/tmp$'
${PROOT} -m /proc -m /tmp:/asym -w /asym -r ${ROOTFS} /bin/readlink /proc/self/cwd | grep '^/asym$'
${PROOT} -m /proc -m /tmp:/asym -w /tmp -r ${ROOTFS} /bin/readlink /proc/self/cwd | grep '^/tmp$'

View File

@ -2,8 +2,8 @@ if [ ! -x ${ROOTFS}/bin/readlink ] || [ -z `which grep` ]; then
exit 125;
fi
${PROOT} ${ROOTFS} /bin/readlink /bin/abs-true | grep '^/bin/true$'
${PROOT} ${ROOTFS} /bin/readlink /bin/rel-true | grep '^\./true$'
${PROOT} -r ${ROOTFS} /bin/readlink /bin/abs-true | grep '^/bin/true$'
${PROOT} -r ${ROOTFS} /bin/readlink /bin/rel-true | grep '^\./true$'
${PROOT} -b /:/host-rootfs ${ROOTFS} /bin/readlink /bin/abs-true | grep '^/bin/true$'
${PROOT} -b /:/host-rootfs ${ROOTFS} /bin/readlink /bin/rel-true | grep '^./true$'
${PROOT} -b /:/host-rootfs -r ${ROOTFS} /bin/readlink /bin/abs-true | grep '^/bin/true$'
${PROOT} -b /:/host-rootfs -r ${ROOTFS} /bin/readlink /bin/rel-true | grep '^./true$'

View File

@ -2,26 +2,26 @@ if [ -z `which sh` ] || [ -z `which readlink` ] || [ -z `which grep` ] || [ -z `
exit 125;
fi
${PROOT} / readlink /proc/self | grep -E "^[[:digit:]]+$"
${PROOT} readlink /proc/self | grep -E "^[[:digit:]]+$"
! ${PROOT} / readlink /proc/self/..
! ${PROOT} readlink /proc/self/..
[ $? -eq 0 ]
${PROOT} / readlink /proc/self/../self | grep -E "^[[:digit:]]+$"
${PROOT} readlink /proc/self/../self | grep -E "^[[:digit:]]+$"
${PROOT} / sh -c 'echo "OK" | readlink /proc/self/fd/0' | grep -E "^pipe:\[[[:digit:]]+\]$"
${PROOT} sh -c 'echo "OK" | readlink /proc/self/fd/0' | grep -E "^pipe:\[[[:digit:]]+\]$"
! ${PROOT} / sh -c 'echo "OK" | readlink /proc/self/fd/0/'
! ${PROOT} sh -c 'echo "OK" | readlink /proc/self/fd/0/'
[ $? -eq 0 ]
! ${PROOT} / sh -c 'echo "OK" | readlink /proc/self/fd/0/..'
! ${PROOT} sh -c 'echo "OK" | readlink /proc/self/fd/0/..'
[ $? -eq 0 ]
! ${PROOT} / sh -c 'echo "OK" | readlink /proc/self/fd/0/../0'
! ${PROOT} sh -c 'echo "OK" | readlink /proc/self/fd/0/../0'
[ $? -eq 0 ]
${PROOT} / sh -c 'echo "echo OK" | sh /proc/self/fd/0' | grep ^OK$
${PROOT} sh -c 'echo "echo OK" | sh /proc/self/fd/0' | grep ^OK$
TMP=/tmp/$(mcookie)
${PROOT} / sh -c "exec 6<>${TMP}; readlink /proc/self/fd/6" | grep ^${TMP}
${PROOT} sh -c "exec 6<>${TMP}; readlink /proc/self/fd/6" | grep ^${TMP}
rm -f ${TMP}

View File

@ -2,4 +2,4 @@ if [ -z `which timeout` ] || [ -z `which msgmerge` ] || [ ! -e /dev/null ]; then
exit 125;
fi
timeout 5s ${PROOT} / msgmerge -q /dev/null /dev/null
timeout 5s ${PROOT} msgmerge -q /dev/null /dev/null

View File

@ -8,12 +8,12 @@ mkdir -p ${ROOTFS}/${TMP}
A=$(mcookie)
B=$(mcookie)
ln -s /bin/true ${ROOTFS}/${TMP}/${A}
ln -s ${TMP}/${A} ${ROOTFS}/${TMP}/${B}
ln -s /bin/true -r ${ROOTFS}/${TMP}/${A}
ln -s ${TMP}/${A} -r ${ROOTFS}/${TMP}/${B}
env PATH=${TMP} ${PROOT} ${ROOTFS} ${B}
env PATH=${TMP} ${PROOT} -r ${ROOTFS} ${B}
rm -f ${TMP}/${B} # just in case it also exists in the host env.
${PROOT} ${ROOTFS} /${TMP}/${B}
${PROOT} -r ${ROOTFS} /${TMP}/${B}
rm -fr ${ROOTFS}/${TMP}