commit: 3e485f7c051955295dc4cc4792a984a9879b489d
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 18 07:47:10 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Dec 4 14:01:35 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3e485f7c
Enable tentative EAPI6 failglob in global scope
Enable failglob in global scope to catch unintended globbing attempts
including unescaped special uses of '*'.
---
bin/eapi.sh | 4 ++++
bin/ebuild.sh | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/bin/eapi.sh b/bin/eapi.sh
index 6e78750..fa57999 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -160,6 +160,10 @@ ___eapi_unpack_is_case_sensitive() {
# OTHERS
+___eapi_enables_failglob_in_global_scope() {
+ [[ ! ${1-${EAPI}} =~
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
___eapi_enables_globstar() {
[[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]]
}
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 9c60a41..e6f9cb9 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -565,6 +565,13 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
# we make a backup copy for QA checks.
__INHERITED_QA_CACHE=$INHERITED
+ # Catch failed globbing attempts in case ebuild writer forgot to
+ # escape '*' or likes.
+ # Note: this needs to be done before unsetting EAPI.
+ if ___eapi_enables_failglob_in_global_scope; then
+ shopt -s failglob
+ fi
+
# *DEPEND and IUSE will be set during the sourcing of the
ebuild.
# In order to ensure correct interaction between ebuilds and
# eclasses, they need to be unset before this process of
@@ -581,6 +588,10 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
set +x
fi
+ if ___eapi_enables_failglob_in_global_scope; then
+ shopt -u failglob
+ fi
+
if [[ "${EBUILD_PHASE}" != "depend" ]] ; then
RESTRICT=${PORTAGE_RESTRICT}
[[ -e $PORTAGE_BUILDDIR/.ebuild_changed ]] && \