debug-print: permission fixes
authorZac Medico <zmedico@gentoo.org>
Wed, 27 Oct 2010 15:27:30 +0000 (08:27 -0700)
committerZac Medico <zmedico@gentoo.org>
Wed, 27 Oct 2010 15:30:47 +0000 (08:30 -0700)
bin/ebuild.sh

index e67dd6366db40a0cbb11620877f026c5f116a3a4..c56d892b97b8b1afb80d800126cd6afafc8eedb1 100755 (executable)
@@ -1275,10 +1275,13 @@ debug-print() {
                printf 'debug: %s\n' "${@}" >> "${ECLASS_DEBUG_OUTPUT}"
        fi
 
-       # default target
-       printf '%s\n' "${@}" >> "${T}/eclass-debug.log"
-       # let the portage user own/write to this file
-       chmod g+w "${T}/eclass-debug.log" &>/dev/null
+       if [[ -w $T ]] ; then
+               # default target
+               printf '%s\n' "${@}" >> "${T}/eclass-debug.log"
+               # let the portage user own/write to this file
+               chgrp portage "${T}/eclass-debug.log" &>/dev/null
+               chmod g+w "${T}/eclass-debug.log" &>/dev/null
+       fi
 }
 
 # The following 2 functions are debug-print() wrappers