chmod not done inside chroot

Issue #33 resolved
Aaron Bartell created an issue

Ran across an issue when a chmod is done on a directory in a chroot environment that is a symbolic link. In short, it will NOT chmod the desired chroot file or directory but will instead do it to the file or directory in the base IFS. Yikes.

Below is the tested fix.

##Looking for input to determine if this has any ramifications I am not thinking of.

diff --git a/lib/chroot_setup.sh b/lib/chroot_setup.sh
index ead3c89..aff5843 100644
--- a/lib/chroot_setup.sh
+++ b/lib/chroot_setup.sh
@@ -110,9 +110,9 @@ function chroot_tar_dir {
   fi
 }
 function chroot_chmod {
-  echo "chmod $1 $CHROOT_DIR$2"
+  echo "chroot $CHROOT_DIR /QOpenSys/usr/bin/bsh -c \"chmod $1 $2\""
   if (($CHROOT_DEBUG==0)); then
-    chmod $1 $CHROOT_DIR$2
+    chroot $CHROOT_DIR /QOpenSys/usr/bin/bsh -c "chmod $1 $2"
   fi
 }
 function chroot_chmod_dir {
@@ -121,9 +121,9 @@ function chroot_chmod_dir {
   else
     all="/*"
   fi
-  echo "chmod -R $1 $CHROOT_DIR$2$all"
+  echo "chroot $CHROOT_DIR /QOpenSys/usr/bin/bsh -c \"chmod -R $1 $2$all\""
   if (($CHROOT_DEBUG==0)); then
-    chmod -R $1 $CHROOT_DIR$2$all
+    chroot $CHROOT_DIR /QOpenSys/usr/bin/bsh -c "chmod -R $1 $2$all"
   fi
 }
 function chroot_chown {

Comments (2)

  1. Log in to comment