Bug #211949 - As suggested by vapier, tighten the variable filter to also
authorZac Medico <zmedico@gentoo.org>
Sun, 2 Mar 2008 23:28:12 +0000 (23:28 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 2 Mar 2008 23:28:12 +0000 (23:28 -0000)
exclude variable names that begin with a digit or that contain any
non-alphanumeric characters that are not be supported by bash. (trunk r9416)

svn path=/main/branches/2.1.2/; revision=9417

bin/ebuild.sh
bin/filter-bash-environment.py

index 9d0c42a5582bc85e2e241fd7b6edf3016e6cf18e..60442e2d604e17102501f7b8785a71ecf76f6065 100755 (executable)
@@ -1388,8 +1388,9 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
 # with names that are known to cause interference:
 #
 #   * some specific variables for which bash does not allow assignment
-#   * any variables with names containing a hyphen (not allowed by bash)
 #   * some specific variables that affect portage or sandbox behavior
+#   * variable names that begin with a digit or that contain any
+#     non-alphanumeric characters that are not be supported by bash
 #
 # --filter-sandbox causes all SANDBOX_* variables to be filtered, which
 # is only desired in certain cases, such as during preprocessing or when
@@ -1418,7 +1419,8 @@ filter_readonly_variables() {
                SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB
                SANDBOX_LOG SANDBOX_ON"
        filtered_vars="${readonly_bash_vars} ${READONLY_PORTAGE_VARS}
-               BASH_[_[:alnum:]]* PATH [-_[:alnum:]]*-[-_[:alnum:]]*"
+               BASH_[_[:alnum:]]* PATH
+               [[:digit:]][_[:alnum:]]* [_[:alnum:]]*[^_[:alnum:]][_[:alnum:]]*"
        if hasq --filter-sandbox $* ; then
                filtered_vars="${filtered_vars} SANDBOX_[_[:alnum:]]*"
        else
index 83b250b697fabe3e51d9892a12ab6bbd548c52df..691d406da7f06e8f32e4e948baaafd0e63ffcfa2 100755 (executable)
@@ -7,6 +7,7 @@ import os, re, sys
 
 egrep_compat_map = {
        "[:alnum:]" : r'\w',
+       "[:digit:]" : r'\d',
        "[:space:]" : r'\s',
 }