]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
test if TMPDIR is accessible before using
[apt.git] / test / integration / framework
index 9ce300d55a56591b943b6cfd63ade4b24ac78072..d576712e511f047443353db2101d347625ec396a 100644 (file)
@@ -176,6 +176,10 @@ addtrap() {
 }
 
 setupenvironment() {
+       # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir)
+       if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then
+               unset TMPDIR
+       fi
        TMPWORKINGDIRECTORY=$(mktemp -d)
        addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;"
        msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… "