guix/gnu/packages/patches/proot-test-fhs.patch

99 lines
4.2 KiB
Diff
Raw Normal View History

The test suite of PRoot makes many FHS assumptions, such as assuming
that /bin, /bin/true, and /usr exist. This patch fixes these assumptions.
--- source/tests/GNUmakefile 2017-05-11 15:26:36.899115484 +0200
+++ source/tests/GNUmakefile 2017-05-11 15:26:46.143063166 +0200
@@ -121,7 +121,7 @@ $(ROOTFS_DIR):
setup: $(ROOTFS_BIN)
$(ROOTFS)/bin/abs-true:
- @ln -fs /bin/true $@
+ @ln -fs `which true` $@
$(ROOTFS)/bin/rel-true:
@ln -fs ./true $@
--- source/tests/test-d2175fc3.sh 2017-05-11 15:36:53.727617010 +0200
+++ source/tests/test-d2175fc3.sh 2017-05-11 15:37:10.155523637 +0200
@@ -2,8 +2,8 @@ if [ ! -x ${ROOTFS}/bin/readlink ] || [
exit 125;
fi
-${PROOT} -r ${ROOTFS} /bin/readlink /bin/abs-true | grep '^/bin/true$'
+${PROOT} -r ${ROOTFS} /bin/readlink /bin/abs-true | grep "`which true`"
${PROOT} -r ${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/abs-true | grep "`which true`"
${PROOT} -b /:/host-rootfs -r ${ROOTFS} /bin/readlink /bin/rel-true | grep '^./true$'
--- source/tests/test-d1be631a.sh 2017-05-11 15:41:36.458008715 +0200
+++ source/tests/test-d1be631a.sh 2017-05-11 15:41:38.921994686 +0200
@@ -1,4 +1,4 @@
-if [ -z `which mknod`] || [ `id -u` -eq 0 ]; then
+if [ -z `which mknod` ] || [ `id -u` -eq 0 ]; then
exit 125;
fi
--- source/tests/test-5bed7141.c 2017-05-11 15:34:23.088472743 +0200
+++ source/tests/test-5bed7141.c 2017-05-11 15:34:27.052450235 +0200
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
case 0: /* child */
- status = chdir("/usr");
+ status = chdir("/gnu");
if (status < 0) {
perror("chdir");
exit(EXIT_FAILURE);
--- a/tests/test-092c5e26.sh
+++ b/tests/test-092c5e26.sh
@@ -24,7 +24,7 @@ fi
unset LD_LIBRARY_PATH
-env PROOT_FORCE_FOREIGN_BINARY=1 PATH=/tmp:/bin:/usr/bin ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH ${EXTRA}-0 /bin/argv0 /bin/argv0 ${TMP_ABS}$"
+env PROOT_FORCE_FOREIGN_BINARY=1 PATH=/tmp:/bin:/usr/bin:$(dirname $(which echo)) ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH ${EXTRA}-0 /bin/argv0 /bin/argv0 ${TMP_ABS}$"
env PROOT_FORCE_FOREIGN_BINARY=1 ${PROOT} -r ${ROOTFS} -q echo ${TMP_ABS} | grep "^-U LD_LIBRARY_PATH ${EXTRA}-0 /bin/argv0 /bin/argv0 ${TMP_ABS}$"
cat > ${ROOTFS}/${TMP_ABS} <<EOF
@@ -34,7 +34,7 @@ chmod +x ${ROOTFS}/${TMP_ABS}
# Valgrind prepends "/bin/sh" in front of foreign binaries.
if ! $(echo ${PROOT} | grep -q valgrind); then
- env PATH=/tmp:/bin:/usr/bin ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH -0 ${TMP} ${TMP_ABS}$"
+ env PATH=/tmp:/bin:/usr/bin:$(dirname $(which echo)) ${PROOT} -r ${ROOTFS} -q echo ${TMP} | grep "^-U LD_LIBRARY_PATH -0 ${TMP} ${TMP_ABS}$"
${PROOT} -r ${ROOTFS} -q echo ${TMP_ABS} | grep "^-U LD_LIBRARY_PATH -0 ${TMP_ABS} ${TMP_ABS}$"
fi
diff --git a/tests/test-5467b986.sh b/tests/test-5467b986.sh
index c6ac71a..f616f1e 100644
--- a/tests/test-5467b986.sh
+++ b/tests/test-5467b986.sh
@@ -30,8 +30,8 @@ ${PROOT} -v -1 -b /tmp:/b -b /tmp:/a -r ${ROOTFS} fchdir_getcwd /b | grep '^/[ab
! ${PROOT} -w /bin -r ${ROOTFS} fchdir_getcwd true
[ $? -eq 0 ]
-${PROOT} -v -1 -w /usr -r / ${ROOTFS}/bin/chdir_getcwd share | grep '^/usr/share$'
-${PROOT} -v -1 -w /usr -r / ${ROOTFS}/bin/fchdir_getcwd share | grep '^/usr/share$'
+${PROOT} -v -1 -w /gnu -r / ${ROOTFS}/bin/chdir_getcwd store | grep '^/gnu/store$'
+${PROOT} -v -1 -w /gnu -r / ${ROOTFS}/bin/fchdir_getcwd store | grep '^/gnu/store$'
-(cd /; ${PROOT} -v -1 -w usr -r / ${ROOTFS}/bin/chdir_getcwd share | grep '^/usr/share$')
-(cd /; ${PROOT} -v -1 -w usr -r / ${ROOTFS}/bin/fchdir_getcwd share | grep '^/usr/share$')
+(cd /; ${PROOT} -v -1 -w gnu -r / ${ROOTFS}/bin/chdir_getcwd store | grep '^/gnu/store$')
+(cd /; ${PROOT} -v -1 -w gnu -r / ${ROOTFS}/bin/fchdir_getcwd store | grep '^/gnu/store$')
--- a/tests/test-c15999f9.sh
+++ b/tests/test-c15999f9.sh
@@ -5,7 +5,7 @@ fi
TMP=/tmp/$(mcookie)
mkdir ${TMP}
-${PROOT} -b /bin/true:${TMP}/true /bin/true
+${PROOT} -b `which true`:${TMP}/true `which true`
! test -e ${TMP}/true
[ $? -eq 0 ]