In dyn_clean, cd to $PORTAGE_BUILDDIR/.. before attempting to remove it since
authorZac Medico <zmedico@gentoo.org>
Sun, 5 Oct 2008 16:31:26 +0000 (16:31 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 5 Oct 2008 16:31:26 +0000 (16:31 -0000)
some kernels, such as Solaris, return EINVAL when an attempt is made to remove
the current working directory. Thanks to Fabian Groffen <grobian@g.o> for
reporting.

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

bin/ebuild.sh

index c274680f0b8153be580004eb9629b472ba336c87..8ee27fc9343d2debccbe4182123a48b5fef10885 100755 (executable)
@@ -751,9 +751,10 @@ dyn_clean() {
        # result in it wiping the users distfiles directory (bad).
        rm -rf "${PORTAGE_BUILDDIR}/distdir"
 
-       if [ -z "$(find "${PORTAGE_BUILDDIR}" -mindepth 1 -maxdepth 1)" ]; then
-               rmdir "${PORTAGE_BUILDDIR}"
-       fi
+       # Some kernels, such as Solaris, return EINVAL when an attempt
+       # is made to remove the current working directory.
+       cd "$PORTAGE_BUILDDIR"/..
+       rmdir "$PORTAGE_BUILDDIR" 2>/dev/null
 
        true
 }