summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <mjo@gentoo.org>2020-02-29 16:53:38 -0500
committerMichael Orlitzky <mjo@gentoo.org>2020-02-29 17:00:28 -0500
commiteccdef0c3d501060838c803ffa81ed79ca614dc0 (patch)
treea27f178ba7fef6c84478896e8528ef8953fd5064
parentsrc/php.eselect.in.in: enable nullglob during find_targets(). (diff)
downloadeselect-php-eccdef0c3d501060838c803ffa81ed79ca614dc0.tar.gz
eselect-php-eccdef0c3d501060838c803ffa81ed79ca614dc0.tar.bz2
eselect-php-eccdef0c3d501060838c803ffa81ed79ca614dc0.zip
src/php.eselect.in.in: create symlinks relatively.
As part of our $ROOT support, we need symlinks within $ROOT to point to stuff within $ROOT. The problem with that is that, if we create those symlinks with absolute paths, then you can't later chroot() into $ROOT and use them, because they'll point to the wrong place -- an absolute path that was only correct before you chrooted. Using relative symlinks seems to fix the problem, and shouldn't hurt anything in the common case where ROOT is unset or contains only a trailing slash. Thanks are due to Stefan Langenmaier for reporting the problem and helping us test the solution. Bug: https://bugs.gentoo.org/709422 Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
-rw-r--r--src/php.eselect.in.in23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 12ef1e1..f78bf3d 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -85,7 +85,7 @@ sapi_active_link_target_dir() {
local sapi="${1}"
local target="${2}"
- local link_target_dir="@LIBDIR@/${target}/bin"
+ local link_target_dir="${ROOT%/}@LIBDIR@/${target}/bin"
if [[ "${sapi}" == "apache2" ]] ; then
link_target_dir+="/../apache2"
fi
@@ -459,9 +459,16 @@ set_sapi() {
for link_name in $(sapi_active_link_names "${sapi}"); do
local link_target=$(sapi_link_name_target "${sapi}" "${target_name}" "${link_name}")
+ # We need these links to be relative: when setting a target
+ # with ROOT nonempty, the symlink needs to point within
+ # ROOT. But if you later chroot() into ROOT, that link will
+ # point... nowhere, most likely. We need it to still point
+ # at the right target in that case!
+ local relative_target=$(relative_name \
+ "${link_tgt_dir}/${link_target}" \
+ "${link_dir}" )
# Use the short "-f" option for POSIX compatibility.
- @LN_S@ -f "${link_tgt_dir}/${link_target}" \
- "${link_dir}/${link_name}" || \
+ @LN_S@ -f "${relative_target}" "${link_dir}/${link_name}" || \
die -q "failed to create active ${link_name} symlink"
done
@@ -518,11 +525,6 @@ describe_list_options() {
}
do_list() {
- if [ "${ROOT%/}" != "" ] ; then
- local msg
- write_warning_msg "ROOT only supported in setting the configuration"
- echo
- fi
local sapi="${1}"
check_module "${sapi}"
list_sapi "${sapi}"
@@ -543,11 +545,6 @@ describe_show_options() {
}
do_show() {
- if [ "${ROOT%/}" != "" ] ; then
- local msg
- write_warning_msg "ROOT only supported in setting the configuration"
- echo
- fi
local sapi="${1}"
check_module "${sapi}"
get_sapi_active_target "${sapi}"