Fix __owner_group for non-setgid setups#2571
Conversation
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 ethstaker#2570 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes a regression in ethd startup ownership handling by selecting the correct __owner_group depending on whether the project directory has the setgid bit enabled (multi-admin setup) or not (single-user setup), preventing repeated “Fixing ownership” noise.
Changes:
- Detect setgid on the eth-docker directory and use the directory’s group only when setgid is set.
- Fall back to the owner’s primary group when setgid is not set.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| __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}') |
There was a problem hiding this comment.
ls -ld . | awk ... is now executed twice (once for __owner, again for __owner_group when setgid is set). Consider capturing the ls -ld . output once and extracting both fields from that single value (or using stat) to reduce duplication and keep owner/group derived from the same source.
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 <noreply@anthropic.com>
|
I appreciate the thought, Florian, I do. But this does not express the intent. For example, if the directory is I am currently iterating on this multi-user code in #2575 , and just handling the check for whether Give me a bit of time to test that thoroughly, and for pietjepuk to review it when it's ready. In the meanwhile, please I'll close this PR once I have something that works in a multi-user setup and doesn't break the typical user:user setup |
Summary
__owner_groupalways uses the directory's group, causing spurious "Fixing ownership" messages on every start when the directory group differs from the owner's primary groupTest plan
__owner_groupequals the owner's primary group and no spurious "Fixing ownership" messages appear__owner_groupequals the directory's group, preserving multi-admin behaviorFixes #2570
🤖 Generated with Claude Code