`XDG_CONFIG_HOME` no longer allows a UID without a home directory to have config files
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Bug report form
- I have done a basic search of the issue tracker to find any existing issues that are similar.
- I have checked that my version is at least the latest stable release available via my installation method.
Describe the bug
In environments like rpm-ostree (Fedora Silverblue and family) and containerized setups, it is typical to run as a UID and GID without an actual user, and therefore without a home directory. In rpm-ostree in particular, a UID without a homedir is used when installing packages, because they install into a container image, not onto the local environment.
In the past, this has been fixed by setting XDG_CONFIG_HOME, which nushell respects.
But as of v0.115.0, this no longer works. It looks like nu fails to find the home directory, and fails to set the config home entirely. This prevents me from installing the current versions of nushell in my Fedora atomic setup.
Note that if I do set the HOME env var explicitly, it works fine, but still writes to the XDG_CONFIG_HOME dir. It also works if the user account has a home, and HOME is explicitly unset, while XDG_CONFIG_HOME is set.
How to reproduce
- Install nushell v0.114.1 and v0.115.0 (and the latest state of
main, to verify that it is still an issue) - As root, run
python3 -c 'import os; os.setgid(12345); os.setuid(12345); os.execl("/bin/bash", "/bin/bash", "-i");'to switch to an arbitrary uid and gid (one that doesn't exist as a user on the system). - Run different versions of nushell with
XDG_CONFIG_HOME=$(mktemp -d), likeenv "XDG_CONFIG_HOME=$(mktemp -d)" /path/to/nu
Expected behavior
I expect XDG_CONFIG_HOME to work even when HOME isn't set and the user doesn't have a usable home. It makes sense to error when none of these needed things is available, but an explicit XDG_CONFIG_HOME should work regardless.
Configuration
| key | value |
|---|---|
| version | 0.115.2 |
| major | 0 |
| minor | 115 |
| patch | 2 |
| branch | main |
| commit_hash | cf5390edc58b54397b2461b083f3fbe4cecb9c56 |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.95.0 (59807616e 2026-04-14) |
| rust_channel | 1.95.0-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.95.0 (f2d3ce0bd 2026-03-21) |
| build_time | 2026-08-25 16:32:49 +00:00 |
| build_rust_channel | debug |
| allocator | standard |
| features | default, lsp, mcp, network, plugin, rustls-tls, sqlite, trash-support |
| installed_plugins | |
| experimental_options | example=false, dc-glob=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=true, native-clip=false, cell-path-types=false, background-completions=true |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with an arbitrary UID and GID, comparing nushell v0.114.1, v0.115.0, and current main while setting XDG_CONFIG_HOME. Trace startup configuration handling for the HOME and XDG_CONFIG_HOME environment variables. Done means an explicit XDG_CONFIG_HOME is used even when HOME is unset and the UID has no usable home directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100