Skip to content

Conversation

@chrisroberts
Copy link
Member

Description

This makes a couple small changes to the findHomeDir helper function to properly match the described behavior. It will attempt to use os.UserHomeDir first, and if no path can be discovered, it will return /dev/null.

Testing & Reproduction steps

Links

Contributor Checklist

  • Changelog Entry If this PR changes user-facing behavior, please generate and add a
    changelog entry using the make cl command.
  • Testing Please add tests to cover any new functionality or to demonstrate bug fixes and
    ensure regressions will be caught.
  • Documentation If the change impacts user-facing functionality such as the CLI, API, UI,
    and job configuration, please update the Nomad product documentation, which is stored in the
    web-unified-docs repo. Refer to the web-unified-docs contributor guide for docs guidelines.
    Please also consider whether the change requires notes within the upgrade
    guide
    . If you would like help with the docs, tag the nomad-docs team in this PR.

Reviewer Checklist

  • Backport Labels Please add the correct backport labels as described by the internal
    backporting document.
  • Commit Type Ensure the correct merge method is selected which should be "squash and merge"
    in the majority of situations. The main exceptions are long-lived feature branches or merges where
    history should be preserved.
  • Enterprise PRs If this is an enterprise only PR, please add any required changelog entry
    within the public repository.
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Comment on lines 31 to 33
if home, err := os.UserHomeDir(); err == nil {
return home
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want this: the os.UserHomeDir function only looks at the environment, whereas homedir.Dir looks at the environment and then has some platform-specific fallback behavior. We're calling homedir.Dir() anyways, so I don't think this gets us anything and it's the docstring of the function that should be fixed instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's fair! I've updated the docstring and kept the path change.

This makes a couple small changes to the findHomeDir helper function
to properly match the described behavior. It will attempt to use
os.UserHomeDir first, and if no path can be discovered, it will return
/dev/null.
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM!

@chrisroberts chrisroberts added the backport/1.11.x backport to 1.11.x release line label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.11.x backport to 1.11.x release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants