From: "Aaron Swenson" <titanofold@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/postgresql/eselect:master commit in: /
Date: Fri, 21 Jul 2017 18:36:18 +0000 (UTC) [thread overview]
Message-ID: <1500661889.1ce72c8f890d9effe502d6d103bca10c6e4b56c4.titanofold@gentoo> (raw)
commit: 1ce72c8f890d9effe502d6d103bca10c6e4b56c4
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 21 18:31:29 2017 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Fri Jul 21 18:31:29 2017 +0000
URL: https://gitweb.gentoo.org/proj/postgresql/eselect.git/commit/?id=1ce72c8f
Canonicalise even if nonexistent
canoncalise() returns the absolute path a symbolic link points to,
except when the path no longer exists. Adding the -m option – which is
the same for both realpath and readlink – makes it ignore nonexistent
portions of the path.
Bug: https://bugs.gentoo.org/625368
postgresql.eselect | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/postgresql.eselect b/postgresql.eselect
index 9203a97..84d08af 100644
--- a/postgresql.eselect
+++ b/postgresql.eselect
@@ -30,7 +30,7 @@ active_slot() {
# ${USR_PATH}/share/postgresql is a symlink to the active
# slot. See if it's there, then find out where it links to.
if [[ -h "${USR_PATH}/share/postgresql" ]] ; then
- canonicalise "${USR_PATH}/share/postgresql" | \
+ canonicalise -m "${USR_PATH}/share/postgresql" | \
sed -re 's#.*([1-9][0-9.]+)$#\1#'
else
echo "(none)"
@@ -283,6 +283,17 @@ do_unset() {
return 0
fi
+ # Get the file path that the link is pointing to. If it has the string
+ # "postgresql-${slot}" somewhere in it, then it's a link that this module is
+ # handling.
+ is_slot_link() {
+ if [[ $(canonicalise -m "$1") == *postgresql-${slot}* ]] ; then
+ return 0 # yes
+ else
+ return 1 # no
+ fi
+ }
+
# Start with some known locations that are, or will contain, symlinks.
local paths=(
"${INCLUDE_TARGETS[@]}"
@@ -307,10 +318,9 @@ do_unset() {
local l path
for path in "${paths[@]}" ; do
- # If path is a link that belongs to the slot in question, it can be
- # removed without invoking find.
- if [[ -h "${path}" && \
- $(canonicalise "${path}") == *postgresql-${slot}* ]] ; then
+ # If $path is a link that belongs to the active slot, it can be removed
+ # without invoking find.
+ if [[ -h "${path}" ]] && is_slot_link "${path}" ; then
rm "${path}" || write_warning_msg "Couldn't remove: ${path}"
continue
fi
@@ -322,10 +332,7 @@ do_unset() {
[[ ${l} == ${USR_PATH}/bin/*${slot/.} ]] && continue
[[ ${l} == ${USR_PATH}/share/man/man?/*${slot/.}* ]] && continue
- # Get the file path that the link is pointing to. If it has the
- # string "postgresql-${slot}" somewhere in it, then it's a link that
- # needs to be removed.
- if [[ $(canonicalise "${l}") == *postgresql-${slot}* ]] ; then
+ if is_slot_link "${l}" ; then
rm "${l}" || write_warning_msg "Couldn't remove: ${l}"
fi
done
next reply other threads:[~2017-07-21 18:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 18:36 Aaron Swenson [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-10-21 11:00 [gentoo-commits] proj/postgresql/eselect:master commit in: / Aaron Swenson
2018-10-21 11:00 Aaron Swenson
2018-01-14 16:43 Aaron Swenson
2018-01-14 16:39 Aaron Swenson
2018-01-14 16:38 Aaron Swenson
2018-01-14 16:28 Aaron Swenson
2018-01-14 16:19 Aaron Swenson
2018-01-14 16:19 Aaron Swenson
2018-01-14 16:19 Aaron Swenson
2017-07-21 18:49 Aaron Swenson
2017-05-19 14:24 Aaron Swenson
2017-05-19 14:20 Aaron Swenson
2017-05-19 14:20 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 Aaron Swenson
2017-04-18 19:43 [gentoo-commits] proj/postgresql/eselect:stateless " Aaron Swenson
2017-04-18 19:43 ` [gentoo-commits] proj/postgresql/eselect:master " Aaron Swenson
2017-02-06 13:19 [gentoo-commits] proj/postgresql/eselect:stateless " Aaron Swenson
2017-04-18 19:43 ` [gentoo-commits] proj/postgresql/eselect:master " Aaron Swenson
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=1500661889.1ce72c8f890d9effe502d6d103bca10c6e4b56c4.titanofold@gentoo \
--to=titanofold@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