Bug #203323 - Fix the FEATURES=sfperms code so that it doesn't chmod
authorZac Medico <zmedico@gentoo.org>
Fri, 28 Dec 2007 11:29:58 +0000 (11:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 28 Dec 2007 11:29:58 +0000 (11:29 -0000)
g-r on binaries that are both setuid and setgid. In that case, just
chmod o-r.

svn path=/main/trunk/; revision=9061

bin/misc-functions.sh

index d1b8c5eb3d5040c8ea30960a2d271c74932d3088..d293fd7694ae880e3240ce79270df3c719842e3d 100755 (executable)
@@ -429,15 +429,28 @@ preinst_sfperms() {
        fi
        # Smart FileSystem Permissions
        if hasq sfperms $FEATURES; then
+               local i
                for i in $(find "${D}" -type f -perm -4000); do
-                       ebegin ">>> SetUID: [chmod go-r] $i "
-                       chmod go-r "$i"
-                       eend $?
+                       if [ -n "$(find "$i" -perm -2000)" ] ; then
+                               ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${D}}"
+                               chmod o-r "$i"
+                               eend $?
+                       else
+                               ebegin ">>> SetUID: [chmod go-r] /${i#${D}}"
+                               chmod go-r "$i"
+                               eend $?
+                       fi
                done
                for i in $(find "${D}" -type f -perm -2000); do
-                       ebegin ">>> SetGID: [chmod o-r] $i "
-                       chmod o-r "$i"
-                       eend $?
+                       if [ -n "$(find "$i" -perm -4000)" ] ; then
+                               # This case is already handled
+                               # by the SetUID check above.
+                               true
+                       else
+                               ebegin ">>> SetGID: [chmod o-r] /${i#${D}}"
+                               chmod o-r "$i"
+                               eend $?
+                       fi
                done
        fi
 }