Bash does not inherit PATH from parent process (T10037)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 141
- Forks
- 146
- Avg merge
- 11h 7m
- Merged PRs (30d)
- 407
Description
I'm not sure if this counts as a bug, but it was for sure an unexpected behaviour.
Due to the configuration in the default bashrc, currently the PATH is reset every time bash starts.
For example if I do
export PATH=/stuff:$PATH
bash
echo $PATH
PATH will not contain /stuff anymore.
This is caused by the file in /usr/share/defaults/etc/profile.d/10-path.sh, which is sourced at the start of bashrc.
As far as I could tell this behaviour has been like this since the first commits in bash and baselayout (where I believe the default bashrc resides), so I can't find a real motivation for why Solus does this.
I would expect the PATH variable to behave like the rest of the environment and propagate to the child processes.
I'm not sure how other distros do it (I verified it works in Ubuntu and Manjaro), possibly they reset the PATH only on login shells
Contributor guide
No contributing guide indexed for this repository
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 with /usr/share/defaults/etc/profile.d/10-path.sh and the default bashrc configuration that sources it. Run the PATH reproducer from the issue and compare login and non-login bash startup behavior. Done means the intended startup mode preserves an inherited PATH while retaining the expected default PATH setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100