Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check existance of $HOME/bin before adding to PATH #5294

Open
1 task done
bohni opened this issue Dec 2, 2024 · 3 comments
Open
1 task done

Check existance of $HOME/bin before adding to PATH #5294

bohni opened this issue Dec 2, 2024 · 3 comments
Labels
Help Wanted help is requested from collaborators, please!

Comments

@bohni
Copy link

bohni commented Dec 2, 2024

  • I was not able to find an open or closed issue matching what I'm seeing

It's just an optimization for a *nix shell script. The behaviour is still present in current main branch.

https://github.com/git-for-windows/build-extra/blob/6735402549b1776f65723e129b9208fa0ee5056b/git-extra/env.sh#L2

export PATH="$HOME/bin:$PATH"

the PATH should only be extended, if the directory exists and is not already included in PATH

if [ -d ${HOME}/bin ]
then
  if [[ ! $PATH = *${HOME}/bin* ]]
  then
    export PATH="$HOME/bin:$PATH"
  fi
fi

Maybe the second test (that PATH already includes the directory) must be omitted because not every shell supports this check.

@dscho
Copy link
Member

dscho commented Dec 2, 2024

I would consider this a feature rather than a bug, as non-existing components should be ignored, but you can always create the ~/bin folder later and it would be picked up automatically.

What is the exact problem you are trying to solve?

@dscho dscho added the unclear label Dec 2, 2024
@bohni
Copy link
Author

bohni commented Dec 3, 2024

Yes, it's a feature request, not a bug. But github only has "new issue"...

The reason is, that I spend quite a while searching my own startup scripts (not only bash, because I'm in this case on windows), looking for the place, why this directory is in my PATH variable and I didn't find it there, because in these scripts that check is used...

I based my bash scripts on the debian .profile (https://sources.debian.org/src/bash/5.2.32-1/debian/skel.profile/) and expanded it with this second check.

@dscho dscho added Help Wanted help is requested from collaborators, please! and removed unclear labels Dec 3, 2024
@dscho
Copy link
Member

dscho commented Dec 3, 2024

Okay, I understand the intention now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted help is requested from collaborators, please!
Projects
None yet
Development

No branches or pull requests

2 participants