Description
Commit 7c07d3a ("Make it easier to run eth-docker with an app user", PR #2545) changed __owner_group from id -gn "${__owner}" (owner's primary group) to ls -ld . | awk '{print $4}' (directory's group).
The PR's intent was to support a multi-admin setup: an app user node owns eth-docker, a group like node-admins has directory ownership with setgid set, and multiple admins can manage the node. With setgid, new files inherit the directory's group, so using the directory group is correct.
However, in the common single-user setup without setgid, new files inherit the creator's primary group, not the directory group. When these differ (e.g., directory is cthulhu:docker but primary group is cthulhu), the ownership check in __prep_conffiles sees a perpetual mismatch and "fixes" .env on every start, producing spurious "Fixing ownership" messages.
Steps to Reproduce
- Have a user whose primary group differs from the directory's group (e.g., directory owned by
cthulhu:docker, user's primary group is cthulhu)
- Run
./ethd up or any command that triggers __prep_conffiles
- Observe "Fixing ownership" messages on every invocation, even though ownership is correct
Expected Behavior
No "Fixing ownership" message when the files already have the correct owner and group.
Proposed Fix
Check whether the setgid bit is set on the directory:
Description
Commit 7c07d3a ("Make it easier to run eth-docker with an app user", PR #2545) changed
__owner_groupfromid -gn "${__owner}"(owner's primary group) tols -ld . | awk '{print $4}'(directory's group).The PR's intent was to support a multi-admin setup: an app user
nodeowns eth-docker, a group likenode-adminshas directory ownership with setgid set, and multiple admins can manage the node. With setgid, new files inherit the directory's group, so using the directory group is correct.However, in the common single-user setup without setgid, new files inherit the creator's primary group, not the directory group. When these differ (e.g., directory is
cthulhu:dockerbut primary group iscthulhu), the ownership check in__prep_conffilessees a perpetual mismatch and "fixes".envon every start, producing spurious "Fixing ownership" messages.Steps to Reproduce
cthulhu:docker, user's primary group iscthulhu)./ethd upor any command that triggers__prep_conffilesExpected Behavior
No "Fixing ownership" message when the files already have the correct owner and group.
Proposed Fix
Check whether the setgid bit is set on the directory: