Web lists-archives.com

Re: Why debian put ~/bin beginning of $PATH




2017-08-09 4:04 GMT+08:00 Michael Lange <klappnase@xxxxxxxxxx>:
> Hi,
>
> On Wed, 9 Aug 2017 03:11:48 +0800
> spp mg <sm.sppmg@xxxxxxxxx> wrote:
>
>> Hi all
>>
>> In the ~/.profile has below default setting:
>>
>> --------------
>> # set PATH so it includes user's private bin if it exists
>> if [ -d "$HOME/bin" ] ; then
>>     PATH="$HOME/bin:$PATH"
>> fi
>> --------------
>>
>> Why put ~/bin beginning ? Is that dangerous ?
>
> like other people already pointed out there shouldn't be anything
> dangerous about this.
> One possible use case is for example that you could put there a
> minimal script that temporarily overrides some environment variable, like
> one I have here which reads:
>
> #!/bin/bash
> GTK_IM_MODULE=gtk /usr/bin/poedit $@
> exit $?
>
> This way I can conveniently call "poedit <filename>" with the desired
> setting of GTK_IM_MODULE without either having to type the whole thing
> each time or else having to permanently change GTK_IM_MODULE's setting
> (the default value of which I modified for other reasons).
>
> Best regards
>
> Michael
>
> .-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.
>
> Fascinating, a totally parochial attitude.
>                 -- Spock, "Metamorphosis", stardate 3219.8
>

Thinks to reply (very fast :D)

I think it's may dangerous because generally system command should be
highter older then user's command.

For example , some guy put a "rm" but named "ls" to ~/bin . This "ls"
can be virus or ransomware , user may not know it's not which he
want("ls").

So I think put ~/bin to tail of $PATH has better security for normal user.

For me, I will avoid use same name with exist command, and for user
who want use same name , I believe he know or will learn how to modify
$PATH.


I mean , put ~/bin in tail of $PATH will batter for default setting,
so does developer has another reason to put to beginning ?