aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 22:21:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 22:21:02 +0000
commit43ca76277d33de90905e61e63dc91ad10aa4ff64 (patch)
treeaeff04b9999a37e2764b80bcbf1e76d00e556460
parentf105eb7e60880f2d7e5530f37eb984a8a728aa25 (diff)
downloadpaludis-43ca76277d33de90905e61e63dc91ad10aa4ff64.tar.gz
paludis-43ca76277d33de90905e61e63dc91ad10aa4ff64.tar.xz
Die if the user tries to tinker with internals in bashrc
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.sr1
-rw-r--r--paludis/repositories/e/eapis/0.conf14
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf17
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf14
-rw-r--r--paludis/repositories/e/ebuild.cc2
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash20
7 files changed, 60 insertions, 9 deletions
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index b3dda3a..65fb8d1 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -99,6 +99,7 @@ namespace paludis
.must_not_change_variables(k.get("must_not_change_variables"))
.save_variables(k.get("save_variables"))
.save_base_variables(k.get("save_base_variables"))
+ .save_unmodifiable_variables(k.get("save_unmodifiable_variables"))
.support_eclasses(destringify<bool>(k.get("support_eclasses")))
.support_exlibs(destringify<bool>(k.get("support_exlibs")))
.utility_path_suffixes(k.get("utility_path_suffixes"))
diff --git a/paludis/repositories/e/eapi.sr b/paludis/repositories/e/eapi.sr
index 170c400..32ae626 100644
--- a/paludis/repositories/e/eapi.sr
+++ b/paludis/repositories/e/eapi.sr
@@ -127,6 +127,7 @@ make_class_EAPIEbuildOptions()
key must_not_change_variables std::string
key save_variables std::string
key save_base_variables std::string
+ key save_unmodifiable_variables std::string
key vdb_from_env_variables std::string
key vdb_from_env_unless_empty_variables std::string
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 007fbb9..3dd5f0b 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -53,6 +53,20 @@ save_variables = \
save_base_variables = \
CONFIG_PROTECT CONFIG_PROTECT_MASK
+save_unmodifiable_variables = \
+ SLOT EAPI KEYWORDS ROOT \
+ PALUDIS_TMPDIR PALUDIS_CONFIG_DIR PALUDIS_BASHRC_FILES \
+ PALUDIS_HOOK_DIRS PALUDIS_FETCHERS_DIRS PALUDIS_SYNCERS_DIRS \
+ PALUDIS_COMMAND PALUDIS_REDUCED_UID PALUDIS_REDUCED_GID \
+ PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR PALUDIS_UTILITY_PATH_SUFFIXES \
+ PALUDIS_EBUILD_MODULE_SUFFIXES PALUDIS_NON_EMPTY_VARIABLES \
+ PALUDIS_DIRECTORY_VARIABLES PALUDIS_EBUILD_MUST_NOT_SET_VARIABLES \
+ PALUDIS_SAVE_VARIABLES PALUDIS_SAVE_BASE_VARIABLES \
+ PALUDIS_DIRECTORY_IF_EXISTS_VARIABLES PALUDIS_SOURCE_MERGED_VARIABLES \
+ PALUDIS_MUST_NOT_CHANGE_VARIABLES PALUDIS_RDEPEND_DEFAULTS_TO_DEPEND \
+ ECLASSDIR ECLASSDIRS EXLIBSDIRS PALUDIS_VARIABLE PALUDIS_PROFILE_DIR \
+ PALUDIS_PROFILE_DIRS PALUDIS_LOADSAVEENV_DIR
+
ebuild_install = \
: prepare ; \
userpriv sandbox : init saveenv ; \
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 5692e7e..550a213 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -47,15 +47,26 @@ ebuild_must_not_set_variables = \
source_merged_variables = \
OPTIONS MYOPTIONS PLATFORMS
-must_not_change_variables = \
- SLOT EAPI KEYWORDS
-
save_variables = \
OPTIONS SUBOPTIONS HIDDEN_SUBOPTIONS \$SUBOPTIONS
save_base_variables = \
CONFIG_PROTECT CONFIG_PROTECT_MASK
+save_unmodifiable_variables = \
+ SLOT EAPI KEYWORDS ROOT \
+ PALUDIS_TMPDIR PALUDIS_CONFIG_DIR PALUDIS_BASHRC_FILES \
+ PALUDIS_HOOK_DIRS PALUDIS_FETCHERS_DIRS PALUDIS_SYNCERS_DIRS \
+ PALUDIS_COMMAND PALUDIS_REDUCED_UID PALUDIS_REDUCED_GID \
+ PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR PALUDIS_UTILITY_PATH_SUFFIXES \
+ PALUDIS_EBUILD_MODULE_SUFFIXES PALUDIS_NON_EMPTY_VARIABLES \
+ PALUDIS_DIRECTORY_VARIABLES PALUDIS_EBUILD_MUST_NOT_SET_VARIABLES \
+ PALUDIS_SAVE_VARIABLES PALUDIS_SAVE_BASE_VARIABLES \
+ PALUDIS_DIRECTORY_IF_EXISTS_VARIABLES PALUDIS_SOURCE_MERGED_VARIABLES \
+ PALUDIS_MUST_NOT_CHANGE_VARIABLES PALUDIS_RDEPEND_DEFAULTS_TO_DEPEND \
+ ECLASSDIR ECLASSDIRS EXLIBSDIRS PALUDIS_VARIABLE PALUDIS_PROFILE_DIR \
+ PALUDIS_PROFILE_DIRS PALUDIS_LOADSAVEENV_DIR
+
ebuild_install = \
: prepare ; \
userpriv sandbox : init saveenv ; \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index e287b95..f43ba41 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -55,6 +55,20 @@ save_variables = \
save_base_variables = \
CONFIG_PROTECT CONFIG_PROTECT_MASK
+save_unmodifiable_variables = \
+ SLOT EAPI KEYWORDS ROOT \
+ PALUDIS_TMPDIR PALUDIS_CONFIG_DIR PALUDIS_BASHRC_FILES \
+ PALUDIS_HOOK_DIRS PALUDIS_FETCHERS_DIRS PALUDIS_SYNCERS_DIRS \
+ PALUDIS_COMMAND PALUDIS_REDUCED_UID PALUDIS_REDUCED_GID \
+ PALUDIS_EBUILD_LOG_LEVEL PALUDIS_EBUILD_DIR PALUDIS_UTILITY_PATH_SUFFIXES \
+ PALUDIS_EBUILD_MODULE_SUFFIXES PALUDIS_NON_EMPTY_VARIABLES \
+ PALUDIS_DIRECTORY_VARIABLES PALUDIS_EBUILD_MUST_NOT_SET_VARIABLES \
+ PALUDIS_SAVE_VARIABLES PALUDIS_SAVE_BASE_VARIABLES \
+ PALUDIS_DIRECTORY_IF_EXISTS_VARIABLES PALUDIS_SOURCE_MERGED_VARIABLES \
+ PALUDIS_MUST_NOT_CHANGE_VARIABLES PALUDIS_RDEPEND_DEFAULTS_TO_DEPEND \
+ ECLASSDIR ECLASSDIRS EXLIBSDIRS PALUDIS_VARIABLE PALUDIS_PROFILE_DIR \
+ PALUDIS_PROFILE_DIRS PALUDIS_LOADSAVEENV_DIR
+
ebuild_install = \
: prepare ; \
userpriv sandbox : init saveenv ; \
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 9339b7e..a574e5e 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -145,6 +145,8 @@ EbuildCommand::operator() ()
params.package_id->eapi()->supported->ebuild_options->save_variables)
.with_setenv("PALUDIS_SAVE_BASE_VARIABLES",
params.package_id->eapi()->supported->ebuild_options->save_base_variables)
+ .with_setenv("PALUDIS_SAVE_UNMODIFIABLE_VARIABLES",
+ params.package_id->eapi()->supported->ebuild_options->save_unmodifiable_variables)
.with_setenv("PALUDIS_DIRECTORY_IF_EXISTS_VARIABLES",
params.package_id->eapi()->supported->ebuild_options->directory_if_exists_variables)
.with_setenv("PALUDIS_SOURCE_MERGED_VARIABLES",
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index d9de76c..eb75950 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -131,8 +131,9 @@ export CONFIG_PROTECT="${PALUDIS_CONFIG_PROTECT}"
export CONFIG_PROTECT_MASK="${PALUDIS_CONFIG_PROTECT_MASK}"
save_vars="$(eval echo ${PALUDIS_SAVE_VARIABLES} )"
save_base_vars="$(eval echo ${PALUDIS_SAVE_BASE_VARIABLES} )"
+save_unmodifiable_vars="$(eval echo ${PALUDIS_SAVE_UNMODIFIABLE_VARIABLES} )"
-for var in ${save_vars} ${default_save_vars} ${save_base_vars} ; do
+for var in ${save_vars} ${default_save_vars} ${save_base_vars} ${save_unmodifiable_vars} ; do
ebuild_notice "debug" "Saving ${var}=${!var}"
eval "export save_var_${var}='${!var}'"
done
@@ -157,12 +158,19 @@ for f in ${PALUDIS_BASHRC_FILES} ; do
else
ebuild_notice "debug" "Skipping bashrc file ${f}"
fi
-done
-for var in ${save_vars} ; do
- if [[ -n ${!var} ]] ; then
- die "${var} should not be set in bashrc. Aborting."
- fi
+ for var in ${save_vars} ; do
+ if [[ -n ${!var} ]] ; then
+ die "${f} attempted to set \$${var}, which must not be set in bashrc."
+ fi
+ done
+
+ for var in ${save_unmodifiable_vars} ; do
+ s_var=save_var_${var}
+ if [[ "${!s_var}" != "${!var}" ]] ; then
+ die "${f} attempted to modify \$${var}, which must not be modified in bashrc."
+ fi
+ done
done
for var in ${save_vars} ; do