summaryrefslogtreecommitdiff
path: root/test/integration/test-failing-maintainer-scripts
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-11-17 15:06:35 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-18 02:41:20 +0100
commit0c78757010a17173bdc79b818133697e7dcbf6a4 (patch)
tree666aa7d48511f0f3c8d31a0bf8a3f5f0f06e83d8 /test/integration/test-failing-maintainer-scripts
parent4bb006d1ddcf1807474067dcbef9fb0bb5def0ac (diff)
close leaking slave fd after setting up pty magic
The fd moves out of scope here anyway, so we should close it properly instead of leaking it which will tickle down to dpkg maintainer scripts. Closes: 767774
Diffstat (limited to 'test/integration/test-failing-maintainer-scripts')
-rwxr-xr-xtest/integration/test-failing-maintainer-scripts46
1 files changed, 1 insertions, 45 deletions
diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts
index 3dd7d643e..953506aa5 100755
--- a/test/integration/test-failing-maintainer-scripts
+++ b/test/integration/test-failing-maintainer-scripts
@@ -6,6 +6,7 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture 'native'
+configdpkgnoopchroot
# create a bunch of failures
createfailure() {
@@ -25,51 +26,6 @@ createfailure 'postrm'
setupaptarchive
-# create a library to noop chroot() and rewrite maintainer script executions
-# via execvp() as used by dpkg as we don't want our rootdir to be a fullblown
-# chroot directory dpkg could chroot into to execute the maintainer scripts
-cat << EOF > noopchroot.c
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-
-static char * chrootdir = NULL;
-
-int chroot(const char *path) {
- printf("WARNING: CHROOTing to %s was ignored!\n", path);
- free(chrootdir);
- chrootdir = strdup(path);
- return 0;
-}
-int execvp(const char *file, char *const argv[]) {
- static int (*func_execvp) (const char *, char * const []) = NULL;
- if (func_execvp == NULL)
- func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp");
- if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0)
- return func_execvp(file, argv);
- printf("REWRITE execvp call %s into %s\n", file, chrootdir);
- char newfile[strlen(chrootdir) + strlen(file)];
- strcpy(newfile, chrootdir);
- strcat(newfile, file);
- return func_execvp(newfile, argv);
-}
-EOF
-testsuccess gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl
-
-mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/"
-DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
-echo "#!/bin/sh
-if [ -n \"\$LD_PRELOAD\" ]; then
- export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\"
-else
- export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\"
-fi
-dpkg \"\$@\"" > $DPKG
-chmod +x $DPKG
-sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf
-
# setup some pre- and post- invokes to check the output isn't garbled later
APTHOOK="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apthook"
echo '#!/bin/sh