Make the FEATURES=sfperms loops safe for whitespace in paths
authorZac Medico <zmedico@gentoo.org>
Fri, 28 Dec 2007 21:10:25 +0000 (21:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 28 Dec 2007 21:10:25 +0000 (21:10 -0000)
by using find -print0 | while read -d $'\0'.

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

bin/misc-functions.sh

index d293fd7694ae880e3240ce79270df3c719842e3d..6c34fd044aef9fcaf6870ee830cecdb85e12999d 100755 (executable)
@@ -430,7 +430,8 @@ preinst_sfperms() {
        # Smart FileSystem Permissions
        if hasq sfperms $FEATURES; then
                local i
-               for i in $(find "${D}" -type f -perm -4000); do
+               find "${D}" -type f -perm -4000 -print0 | \
+               while read -d $'\0' i ; do
                        if [ -n "$(find "$i" -perm -2000)" ] ; then
                                ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${D}}"
                                chmod o-r "$i"
@@ -441,7 +442,8 @@ preinst_sfperms() {
                                eend $?
                        fi
                done
-               for i in $(find "${D}" -type f -perm -2000); do
+               find "${D}" -type f -perm -2000 -print0 | \
+               while read -d $'\0' i ; do
                        if [ -n "$(find "$i" -perm -4000)" ] ; then
                                # This case is already handled
                                # by the SetUID check above.