aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-25 15:34:44 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-25 15:34:44 +0000
commit140e7004f8b667b086f35596238f13711afa8b0b (patch)
tree7f81f1062f04c638db17aa084f183064d849824a
parent6ffa276d1809b939830283d739986f18a5d51fdf (diff)
downloadpaludis-140e7004f8b667b086f35596238f13711afa8b0b.tar.gz
paludis-140e7004f8b667b086f35596238f13711afa8b0b.tar.xz
Get the warning messages for userpriv right. Make the elog hook work under userpriv. Fixes: ticket:157
-rw-r--r--hooks/demos/elog.bash.in4
-rw-r--r--paludis/environments/paludis/paludis_environment.cc15
-rw-r--r--paludis/repositories/gentoo/ebuild_entries.cc13
3 files changed, 23 insertions, 9 deletions
diff --git a/hooks/demos/elog.bash.in b/hooks/demos/elog.bash.in
index c02e44a..ad37e9b 100644
--- a/hooks/demos/elog.bash.in
+++ b/hooks/demos/elog.bash.in
@@ -46,6 +46,10 @@ case "${HOOK}" in
install_all_pre|uninstall_all_pre)
rm -f "${logfile}"
touch "${logfile}" || die "Couldn't create '${logfile}' for elog hooks"
+ if [[ -n "${PALUDIS_REDUCED_GID}" ]] ; then
+ chgrp "${PALUDIS_REDUCED_GID}" "${logfile}" || die "Couldn't chgrp '${logfile}' for elog hooks"
+ chmod g+rw "${logfile}" || die "Couldn't chmod '${logfile}' for elog hooks"
+ fi
;;
install_all_post|uninstall_all_post|install_fail|uninstall_fail|clean_fail)
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index 25ec3c4..a7d9c7d 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -590,11 +590,16 @@ namespace
Hook hook;
std::string paludis_command;
std::string root;
+ std::string reduced_gid;
+ std::string reduced_uid;
- Hooker(const Hook & h, const std::string & p, const std::string & r) :
+ Hooker(const Hook & h, const std::string & p, const std::string & r,
+ const std::string & g, const std::string & u) :
hook(h),
paludis_command(p),
- root(r)
+ root(r),
+ reduced_gid(g),
+ reduced_uid(u)
{
}
@@ -614,6 +619,8 @@ namespace
.with_setenv("HOOK", hook.name())
.with_setenv("HOOK_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
.with_setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
+ .with_setenv("PALUDIS_REDUCED_GID", reduced_gid)
+ .with_setenv("PALUDIS_REDUCED_UID", reduced_uid)
.with_setenv("PALUDIS_COMMAND", paludis_command));
for (Hook::Iterator h(hook.begin()), h_end(hook.end()) ; h != h_end ; ++h)
@@ -661,8 +668,8 @@ PaludisEnvironment::perform_hook(const Hook & hook) const
for (std::list<FSEntry>::const_iterator hk(hooks.begin()),
hk_end(hooks.end()) ; hk != hk_end ; ++hk)
- max_exit_status = std::max(max_exit_status, Hooker(hook, paludis_command(),
- stringify(root()))(*hk));
+ max_exit_status = std::max(max_exit_status, Hooker(hook, paludis_command(),
+ stringify(root()), stringify(reduced_gid()), stringify(reduced_uid()))(*hk));
}
if (_imp->hook_cache.end() == cache_entry)
diff --git a/paludis/repositories/gentoo/ebuild_entries.cc b/paludis/repositories/gentoo/ebuild_entries.cc
index 978b883..95f663e 100644
--- a/paludis/repositories/gentoo/ebuild_entries.cc
+++ b/paludis/repositories/gentoo/ebuild_entries.cc
@@ -476,14 +476,16 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
if (f.group() != _imp->environment->reduced_gid())
{
Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
- stringify(_imp->params.buildroot) + "' not owned by group '" +
- stringify(getgrgid(_imp->environment->reduced_gid())->gr_name) + "', cannot enable userpriv");
+ stringify(f) + "' owned by group '" +
+ stringify(getgrgid(f.group())->gr_name) + "', not '" +
+ stringify(getgrgid(_imp->environment->reduced_gid())->gr_name) +
+ "', so cannot enable userpriv");
fetch_userpriv_ok = false;
}
else if (! f.has_permission(fs_ug_group, fs_perm_write))
{
Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
- stringify(_imp->params.buildroot) + "' does not group write permission," +
+ stringify(f) + "' does not group write permission," +
"cannot enable userpriv");
fetch_userpriv_ok = false;
}
@@ -524,14 +526,15 @@ EbuildEntries::install(const QualifiedPackageName & q, const VersionSpec & v,
if (f.group() != _imp->environment->reduced_gid())
{
Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
- stringify(_imp->params.buildroot) + "' not owned by group '" +
+ stringify(f) + "' owned by group '" +
+ stringify(getgrgid(f.group())->gr_name) + "', not '" +
stringify(getgrgid(_imp->environment->reduced_gid())->gr_name) + "', cannot enable userpriv");
userpriv_ok = false;
}
else if (! f.has_permission(fs_ug_group, fs_perm_write))
{
Log::get_instance()->message(ll_warning, lc_context, "Directory '" +
- stringify(_imp->params.buildroot) + "' does not group write permission," +
+ stringify(f) + "' does not group write permission," +
"cannot enable userpriv");
userpriv_ok = false;
}