getsolus / getsolus/packages

Bash does not inherit PATH from parent process (T10037)

Open
#112 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

State: Stale Topic: Platform Integration Topic: Plumbing
Dominant language
Python
Stars
141
Forks
146
Avg merge
11h 7m
Merged PRs (30d)
407

Description

Enrico Lusiani (#elusian), 2021-11-25 10:42:01 UTC

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.