From e01365382cd25c14b869492d5d4a8235094db761 Mon Sep 17 00:00:00 2001 From: f-barth <2833600+f-barth@users.noreply.github.com> Date: Sat, 25 Apr 2026 10:18:54 +0200 Subject: [PATCH 1/2] Fix __owner_group regression for non-setgid setups Commit 7c07d3a changed __owner_group to always use the directory's group. This is correct when setgid is set (multi-admin setup), but causes spurious "Fixing ownership" on every start when the directory group differs from the owner's primary group (the common single-user case). Check the setgid bit: use directory group when set, owner's primary group otherwise. Fixes #2570 Co-Authored-By: Claude Opus 4.6 --- ethd | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ethd b/ethd index 528585bb..7eccb083 100755 --- a/ethd +++ b/ethd @@ -6061,8 +6061,14 @@ cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" # Use this to make sure root doesn't end up owning files # shellcheck disable=SC2012 __owner=$(ls -ld . | awk '{print $3}') -# shellcheck disable=SC2012 -__owner_group=$(ls -ld . | awk '{print $4}') +if [[ -g . ]]; then + # setgid: new files inherit directory group + # shellcheck disable=SC2012 + __owner_group=$(ls -ld . | awk '{print $4}') +else + # no setgid: new files inherit owner's primary group + __owner_group=$(id -gn "${__owner}") +fi if [[ "${__owner}" = "root" ]]; then echo "Please install ${__project_name} as a non-root user." From ea8ab24a9b26ebdd09ad476390b8d16d5d03322b Mon Sep 17 00:00:00 2001 From: f-barth <2833600+f-barth@users.noreply.github.com> Date: Sat, 25 Apr 2026 10:41:29 +0200 Subject: [PATCH 2/2] Capture ls -ld output once for owner and group Avoid calling ls -ld twice by storing the output and extracting both __owner and __owner_group from the same listing. Co-Authored-By: Claude Opus 4.6 --- ethd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethd b/ethd index 7eccb083..3c982a26 100755 --- a/ethd +++ b/ethd @@ -6060,11 +6060,11 @@ fi cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" # Use this to make sure root doesn't end up owning files # shellcheck disable=SC2012 -__owner=$(ls -ld . | awk '{print $3}') +__dir_listing=$(ls -ld .) +__owner=$(awk '{print $3}' <<< "${__dir_listing}") if [[ -g . ]]; then # setgid: new files inherit directory group - # shellcheck disable=SC2012 - __owner_group=$(ls -ld . | awk '{print $4}') + __owner_group=$(awk '{print $4}' <<< "${__dir_listing}") else # no setgid: new files inherit owner's primary group __owner_group=$(id -gn "${__owner}")