Skip to content

fix(fleet-config): passwd-home fallback when HOME is unset/empty/relative (#5737) - #7425

Merged
developing-today[bot] merged 1 commit into
mainfrom
queue/12774-5737-home-anchor
Nov 8, 2026
Merged

developing-today[bot] merged 1 commit into
mainfrom
queue/12774-5737-home-anchor

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Closes #5737 (the remainder confirmed by triage task 12269; queue task 12774).

What

fleet-config's home_anchor fell back to "." when HOME is unset, empty, or relative, so the config file, state dir, and every broker socket resolved CWD-relative — and a planted ./.config/fleet/fleet.toml loaded for any fleet process started without HOME.

This implements the fallback decision issue #5737 tracked:

  • home_anchor now falls back to the account's real home from the passwd database (matched by the process uid from /proc/self/status, parsed from /etc/passwd — std-only, no new dependencies): the same home OpenSSH resolves ~ from.
  • If no passwd entry with an absolute home exists for the uid, resolution panics with an actionable message naming HOME — failing loudly instead of silently anchoring on the CWD.
  • Behaviour with an absolute HOME is unchanged; the landed relative-HOME (fix(fleet-config): never anchor resolution on a relative HOME (#6404) #6418) and relative-XDG (fleet-config: ignore relative XDG base directories #6558) work is untouched, as is the documented relative meaning of explicit overrides.

Tests

  • Updated relative_home_is_not_an_anchor: relative/unset/empty HOME now share the passwd-home anchor (absolute, never "."), and file_path/state_dir/broker_socket resolve under it.
  • New passwd_home_for_uid_reads_the_matching_entry: pins the passwd parser (matching entry, root, unknown uid, relative recorded home, empty database).
  • New unset_or_empty_home_never_anchors_on_the_cwd: pins HOME unset and empty for file_path, state_dir, and broker_socket — absolute, anchor-rooted, never the CWD-relative planted-config path.

cargo test -p fleet-config on the laptop: 19 passed, 0 failed.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 8, 2026 07:00
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3c118772-5660-4cf1-a7b9-fcefb4641728
Commits

Reviewing files that changed from the base of the PR and between 7d62834 and 18c949e.

Files selected for processing: 1

  • pkgs/fleet/crates/fleet-config/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T07:02:40.285950Z 18c949e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet-config: HOME unset/empty falls back to "." — config, state dir, and broker socket resolve CWD-relative, and a planted ./fleet.toml loads

1 participant