public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michael Orlitzky" <mjo@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect-php:master commit in: src/
Date: Sun,  1 Mar 2020 12:59:26 +0000 (UTC)	[thread overview]
Message-ID: <1583067547.d5ad69d12994e69882830faae26ba565d8980a25.mjo@gentoo> (raw)

commit:     d5ad69d12994e69882830faae26ba565d8980a25
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  1 12:53:47 2020 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Sun Mar  1 12:59:07 2020 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=d5ad69d1

src/php.eselect.in.in: only create links to targets that exist.

To avoid replacing a working /usr/bin/phar with a broken symlink,
let's check to make sure that the targets of our symlinks exist before
creating them. This can leave "phar" pointing to an unexpected version
of that executable, but that's better than nothing if some working
version is installed.

Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 src/php.eselect.in.in | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 2a7e5a8..d243c64 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -180,10 +180,9 @@ parse_target_major_version() {
 # working.
 #
 # There is one potential caveat to that approach, for SAPIs with more
-# than one active symlink. What if "phpize" is broken but "php" is OK?
-# (Forget for the moment how that might happen...). Do we want to
-# update() the entire SAPI because one of the symlinks is dead?
-# Answer: I guess.
+# than one active symlink. What if "phar" is broken (after a rebuild)
+# but "php" is OK? Do we want to update() the entire SAPI because one
+# of the symlinks is dead? Answer: I guess.
 #
 # INPUT:
 #
@@ -467,9 +466,19 @@ set_sapi() {
 		local relative_target=$(relative_name \
 									"${link_tgt_dir}/${link_target}" \
 									"${link_dir}" )
-		# Use the short "-f" option for POSIX compatibility.
-		@LN_S@ -f "${relative_target}" "${link_dir}/${link_name}" || \
-			die -q "failed to create active ${link_name} symlink"
+
+		# Since the phar extension is optional, we check here to
+		# ensure that the target of our symlink exists before we
+		# create it.  Otherwise, we could wind up with a /usr/bin/phar
+		# symlink that points nowhere. This might leave /usr/bin/phar
+		# pointing to a different version than you'd expect (wherever
+		# it pointed before you just tried to change it), but I guess
+		# leaving some working version is not a terrible thing to do.
+		if [[ -e "${link_tgt_dir}/${link_target}" ]]; then
+			# Use the short "-f" option for POSIX compatibility.
+			@LN_S@ -f "${relative_target}" "${link_dir}/${link_name}" || \
+				die -q "failed to create active ${link_name} symlink"
+		fi
 	done
 
 	# The call to write_mod_php_conf() in particular needs to take


             reply	other threads:[~2020-03-01 12:59 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-01 12:59 Michael Orlitzky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-08  2:24 [gentoo-commits] proj/eselect-php:master commit in: src/ Brian Evans
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-12 22:30 Michael Orlitzky
2018-04-12  2:24 Michael Orlitzky
2016-01-22 20:53 Michael Orlitzky
2016-01-22 19:42 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-20 14:42 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-18  2:27 Brian Evans
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1583067547.d5ad69d12994e69882830faae26ba565d8980a25.mjo@gentoo \
    --to=mjo@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox