On 5/3/17 6:40 PM, Nikolay Aleksandrovich Pavlov (ZyX) wrote:
> Bash Version: 4.3
> Patch Level: 48
> Release Status: release
>
> Description:
> If $PATH in bash contains ~ (e.g. `PATH='~/bin'`) it is incorrectly
> treated
> as if $HOME is present.
Yes. This is one of the oldest features in bash; it was present in the
first version of bash that performed tilde expansion. This was almost 30
years ago, but I believe part of the rationale was that the C library on
the GNU system would perform the same tilde expansion wherever it needed
to inspect $PATH (e.g., execlp and execvp). For whatever reason, glibc
did not end up moving that feature forward.
I agree that it's not a great idea to have tildes in $PATH, but I doubt
this is a real problem.
Your contrived example demonstrates that while negative effects are
theoretically possible, you have to work pretty hard to make them happen.
While it's come up a couple of times in 28 years, it's not been a huge
problem.
Changing it isn't really a high priority right now, but if I were to do
it, I would probably add an option to avoid breaking backwards compatibility.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/