* [gentoo-portage-dev] [PATCH 07/13] Enable tentative EAPI6 failglob in global scope
@ 2014-08-18 17:56 99% ` Michał Górny
0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
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 be044e0..167ea4c 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -533,6 +533,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
@@ -549,6 +556,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 ]] && \
--
2.0.4
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
2014-08-18 17:56 99% ` [gentoo-portage-dev] [PATCH 07/13] Enable tentative EAPI6 failglob in global scope Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox