]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
tests/run_some: make sure unshared root user can descend build dir
authorSerge Hallyn <serge@hallyn.com>
Fri, 28 Jun 2024 15:37:39 +0000 (10:37 -0500)
committerAlejandro Colomar <alx@kernel.org>
Fri, 28 Jun 2024 21:41:23 +0000 (23:41 +0200)
This was causing errors in my local testing in vms.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Cherry-picked-from: 2457fc7c6bc9 ("tests/run_some: make sure unshared root user can descend build dir")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
tests/run_some

index 91f5626b19ee61876294eebdbfa20ef6e75f4806..c58f59b0a29573e5e09a678430be70cb4840a268 100755 (executable)
@@ -7,6 +7,22 @@ unset LANG
 unset LANGUAGE
 . common/config.sh
 
+# When we unshare -Ur, we must be able to descend the build path.
+# But $HOME might not be world x.  Fix that.
+fixup_home_perms() {
+       p="${build_path}"
+       d=""
+       echo "$p" | tr '/' '\n' | while read f; do
+               if [ -z "$f" ]; then
+                       continue
+               fi
+               d="$d/$f"
+               chmod ugo+x "$d"
+       done
+}
+
+fixup_home_perms
+
 USE_PAM="yes"
 FAILURE_TESTS="yes"