commit:     dd7dd8b95652c8ec470ed69f04c109c7213989e1
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun 23 02:34:08 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 23 10:37:09 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=dd7dd8b9

emerge-webrsync: drop the obsolete post_sync feature

Presently, the sync_local() function attempts to execute
/etc/portage/bin/post_sync, provided that it is found to be an
executable path. This behaviour has been obsolete since the release of
portage-2.2.16 in Februrary 2015, which introduced support for native
/etc/portage/{repo.,}postsync.d/* hooks.

Given that emerge-webrsync can be executed directly by the user, I
briefly entertained the notion of it being able to execute the
aforementioned hooks without the aid of portage. However, I concluded
that it would be nothing short of dangerous to do so. The fact of the
matter is that emerge-webrsync cannot promise to provide the same
operating environment that portage itself does. As such, it's not
difficult to imagine a user having written a sloppy shell script that
depends on the existence of a particular portage variable in order to
act safely. In the course of discussing the matter with Sam, he agreed
with this assessment.

Thus, drop the code that attempts to execute "post_sync". Users that
wish for postsync hooks to be acted upon should refrain from executing
emerge-webrsync directly and, instead, have the program be executed by
portage by defining "sync-type = webrsync" for the gentoo repo.

Bug: https://bugs.gentoo.org/154220
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/emerge-webrsync | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 4ae1cb0c6a..2ea9dcaada 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -379,7 +379,7 @@ get_snapshot_timestamp() {
 
 sync_local() {
        local file=$1
-       local ownership snapshot_dir post_sync
+       local ownership snapshot_dir
        local -a tarsync_opts rsync_opts
 
        einfo "Syncing local repository ..."
@@ -434,9 +434,6 @@ sync_local() {
                "${emerge}" --metadata
        fi
 
-       post_sync=${PORTAGE_CONFIGROOT%/}/etc/portage/bin/post_sync
-       [[ -x "${post_sync}" ]] && "${post_sync}"
-
        # --quiet suppresses output if there are no relevant news items
        if contains_word news "${FEATURES}"; then
                "${emerge}" --check-news --quiet
@@ -626,7 +623,6 @@ portage_vars=(
        FETCHCOMMAND
        GENTOO_MIRRORS
        PORTAGE_BIN_PATH
-       PORTAGE_CONFIGROOT
        PORTAGE_GPG_DIR
        PORTAGE_GRPNAME
        PORTAGE_NICENESS

Reply via email to