Skip to content

Fix user support for LOCAL domain - #86

Merged
ericbsd merged 1 commit into
masterfrom
fix-gershwin-user-support
Feb 22, 2026
Merged

ericbsd merged 1 commit into
masterfrom
fix-gershwin-user-support

Conversation

@pkgdemon

@pkgdemon pkgdemon commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Bug Fixes:

  • Correct home directory base path detection from /Users to /Local/Users on systems using LOCAL domain user directories.

@pkgdemon
pkgdemon requested review from a team as code owners February 22, 2026 17:58
@sourcery-ai

sourcery-ai Bot commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Update admin user creation to use the correct /Local/Users home directory and shell-detection path when that directory exists, instead of /Users.

Flow diagram for admin home directory and shell selection

flowchart TD
  A[start save_selection] --> B[Get uname, name, password, shell]
  B --> C{Directory /Local/Users exists?}
  C -- Yes --> D[Set home_folder to /Local/Users/uname]
  C -- No --> E[Set home_folder to /home/uname]
  D --> F[Continue user creation]
  E --> F[Continue user creation]

  %% Shell selection logic in __init__
  G[start __init__] --> H{Directory /Local/Users exists?}
  H -- Yes --> I[Set sh to /usr/local/bin/zsh]
  H -- No --> J[Set sh to /usr/local/bin/fish]
  I --> K[Finish initialization]
  J --> K[Finish initialization]
Loading

File-Level Changes

Change Details Files
Adjust home-directory base path selection to prefer /Local/Users when present.
  • Change directory existence check from /Users to /Local/Users when determining the home directory base.
  • Update constructed home-folder path to use /Local/Users/{username} when that directory exists, falling back to /home/{username} otherwise.
src/add_admin.py
Update shell-selection logic to detect /Local/Users instead of /Users when choosing the default shell.
  • Change directory existence check from /Users to /Local/Users when choosing between zsh and fish.
  • Keep behavior of selecting /usr/local/bin/zsh when /Local/Users exists and /usr/local/bin/fish otherwise.
src/add_admin.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The logic for deciding the home directory and default shell is duplicated; consider extracting this into a small helper function so that the path and shell decision is defined in exactly one place.
  • Hardcoding /Local/Users and /home makes the code less portable; consider deriving the home directory from system information (e.g., pwd.getpwnam or pathlib.Path.home() for the current user) or checking both possible base paths instead of assuming a single convention.
  • The conditional that sets the default shell based on the existence of /Local/Users may not reflect the actual shell configured for the user; if possible, consider reading the user’s default shell from the system (e.g., via pwd or configuration) rather than inferring it from the directory layout.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The logic for deciding the home directory and default shell is duplicated; consider extracting this into a small helper function so that the path and shell decision is defined in exactly one place.
- Hardcoding `/Local/Users` and `/home` makes the code less portable; consider deriving the home directory from system information (e.g., `pwd.getpwnam` or `pathlib.Path.home()` for the current user) or checking both possible base paths instead of assuming a single convention.
- The conditional that sets the default shell based on the existence of `/Local/Users` may not reflect the actual shell configured for the user; if possible, consider reading the user’s default shell from the system (e.g., via `pwd` or configuration) rather than inferring it from the directory layout.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericbsd ericbsd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ericbsd
ericbsd merged commit 626b003 into master Feb 22, 2026
3 checks passed
@ericbsd
ericbsd deleted the fix-gershwin-user-support branch February 22, 2026 21:02
@github-project-automation github-project-automation Bot moved this from In Review to Done in Development Tracker Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants