check-implicit-pointer-usage: safe cwd bug 469338
authorZac Medico <zmedico@gentoo.org>
Sun, 12 May 2013 20:21:38 +0000 (13:21 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 12 May 2013 20:21:38 +0000 (13:21 -0700)
bin/misc-functions.sh

index 725ba55dcead98dfe5546e8a0cc69073d7fd38d3..cebc67f75a65c885aa294cc9745e4d11dbedd2f1 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 #
 # Miscellaneous shell functions that make use of the ebuild env but don't need
@@ -747,7 +747,8 @@ install_qa_check() {
                local cat_cmd=cat
                [[ $PORTAGE_LOG_FILE = *.gz ]] && cat_cmd=zcat
                [[ $reset_debug = 1 ]] && set -x
-               f=$($cat_cmd "${PORTAGE_LOG_FILE}" | \
+               # Use safe cwd, avoiding unsafe import for bug #469338.
+               f=$(cd "${PORTAGE_PYM_PATH}" ; $cat_cmd "${PORTAGE_LOG_FILE}" | \
                        "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed")
                if [[ -n ${f} ]] ; then