Bug 263883

Summary: KDE should respect .profile $PATH, or provide a way for the user to set his own path.
Product: [Plasma] krunner Reporter: Dotan Cohen <kde-2011.08>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED INTENTIONAL    
Severity: wishlist CC: aseigo, kde-2011.08
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: krunner only shows (firefox is /usr/bin/firefox)

Description Dotan Cohen 2011-01-21 16:09:38 UTC
Version:           unspecified
OS:                Linux

If a user has a local bin directory configured in his .bash_profile $PATH that overrides an application in /usr/bin, then launching from Plasma Runner opens the application in /usr/bin

To reproduce:
1) Add this to .bash_profile: PATH=$HOME/.bin:$PATH
2) Create ~/.bin/firefox, chmod +x
3) In Konsole, launch "firefox". The ~/.bin/firefox application is correctly launched
4) In Plasma Runner, launch "firefox". The /usr/bin/firefox application is incorrectly launched


By the way, I believe that this should be assigned to the "runner" component but I cannot find it!

Reproducible: Always
Comment 1 Aaron J. Seigo 2011-01-21 17:04:13 UTC
bash_profile is specific to, well, bash. krunner does not reference any shell specifics such as that. the path will need to be modified somewhere else that isn't specific to a given shell, but which modifies the user log in env (e.g. .profile)

"By the way, I believe that this should be assigned to the "runner" component
but I cannot find it!"

the correct product is "krunner", not "plasma", in this case :)
Comment 2 Dotan Cohen 2011-01-21 17:10:08 UTC
Thanks, Aaron. The issue is valid for .profile as well, as I do have this in my ~/.profile file:
if [ -d "$HOME/.bin" ] ; then
    PATH="$HOME/.bin:$PATH"
fi

I am updating the title and product as needed.
Comment 3 Hans-Rudi Denzler 2011-01-21 17:38:47 UTC
> strace -o trace konsole
> kwrite trace

I don't see any opening of .bash_profile. Do you ?

> echo $PATH (didn't change anything)
...:/home/user/bin:...
> dir bin/
...SimpleLabeler -> /opt/lightscribeApplications/SimpleLabeler/SimpleLabeler

SimpleLabeler works with Alt + F2 and konsole.
Comment 4 Aaron J. Seigo 2011-01-21 17:42:05 UTC
krunner is not going to open up any files itself to modify the environment. the environment must be set up when the session (and krunner) starts.
Comment 5 Dotan Cohen 2011-01-21 18:02:32 UTC
> krunner is not going to open up any files itself to modify
> the environment.

Then maybe the problem is not in Krunner. What component is responsible for either reading from .profile or where should one configure the path for KDE? I find nothing relevant in System Settings, am I missing it? Googling the issue I only see how GDM users can change their configurations system wide. I use KDM (it's even set to autologin) and this should be a per-user setting.


> the environment must be set up when the
> session (and krunner) starts.
>

No problem, Aaron, then where does one specify the path if not in .profile?
Comment 6 Hans-Rudi Denzler 2011-01-21 18:12:36 UTC
> strace -f -o trace2 -e open konsole
> kwrite trace2
Find: bashrc ?
Comment 7 Aaron J. Seigo 2011-01-21 18:19:05 UTC
@Hans-Rudi Denzle: konsole is a terminal emulator. it launches a _shell_, e.g. bash. which sources things like bashrc, bash_profile, etc. your example just proves the point: shells open shell specific env files.

@Dotan: it is system specific, though KDE does support putting scripts in the env/ directory. this is covered in the sysadmin area on techbase.
Comment 8 Dotan Cohen 2011-01-21 18:26:56 UTC
> it is system specific, though KDE does support putting scripts in the
> env/ directory. this is covered in the sysadmin area on techbase.

Thanks, I just found the page:
http://techbase.kde.org/KDE_System_Administration/KDE_Filesystem_Hierarchy

This is a problem that a user cannot set his own path in KDE. Any other environment provides this most basic of features (bash, Gnome, Windows, etc). Therefore I am updating the title and changing this to an RFE. I will leave it WONTFIX because I don't want to step on your toes, Aaron, but if this could be considered for a feature then please reopen.

Thank you!
Comment 9 Hans-Rudi Denzler 2011-01-21 21:27:17 UTC
In openSUSE 11.2

> echo $PATH

can be verified in

> kwrite /etc/profile
Find: PATH

> rpm -qf /etc/profile
(which belongs to aaa_base-11.2-43.46.1.i586)

If one studies the shell script, there are lines with '$HOME/.' which gives you access to your $HOME directory.

In openSUSE 11.2 there is no need for such tricks because 'dir ~/bin/' is already in the 'PATH' and any executable can be linked to 'bin'. Konsole and krunner behave properly.
Comment 10 Dotan Cohen 2011-01-21 23:51:25 UTC
Hans, that does seem to be an OpenSuse feature, whereas a real KDE feature is needed for users of other distros. It is ridiculous to think that a user cannot configure his PATH.

In any case, I keep my scripts in ~/.bin instead of ~/bin because I don't want to see the directory in Dolphin. So why shouldn't KDE let me open those scripts from Krunner? Actually, Krunner _will_ open scripts from that directory, but only if there is no application with the same name in /usr/bin. And no, I did not order the PATH incorrectly: when typing the script name into Konsole it does in fact use the script from ~/.bin instead of /usr/bin. See the OP.
Comment 11 Hans-Rudi Denzler 2011-01-22 10:00:26 UTC
> grep '. $HOME' /etc/bash.bashrc
...
test -s $HOME/.alias && . $HOME/.alias
...

Try this:
> dir .alias (does not exit)
>

> cat .alias (create one)
echo $PATH>/home/user/gaga123

Close konsole and restart Linux.
Open dolphin: in 'gaga123' I see my 'PATH'.

In a standard config I would assume that krunner and konsole behave similar in a plausible way. So it might be a door for your wish.
Comment 12 Dotan Cohen 2011-01-22 10:20:48 UTC
Exactly, I mentioned in the OP that Konsole behaves as expected. The strange thing is that the path specified in .profile _is_ honoured, but in the wrong order. That is, if I have ~/.bin/randomScript it will open ~/.bin/randomScript, but if I have ~/.bin/firefox it will open /usr/bin/firefox
Comment 13 Hans-Rudi Denzler 2011-01-22 15:28:25 UTC
Created attachment 56324 [details]
krunner only shows (firefox is /usr/bin/firefox)

You are just ridiculously right !
Comment 14 Hans-Rudi Denzler 2011-01-23 11:28:40 UTC
Dirty commands in hidden directory '.bin' in the name of firefox and started with 'krunner' would be a security issue:

- it's reasonable for krunner to check for multiple commands ('type -a command')
- konsole users can check 'PATH' and all locations of an executable

WONTFIX isn't ridiculous.
Comment 15 Dotan Cohen 2011-01-26 21:05:28 UTC
This was resolved as WONTFIX when it was incorrectly marked as a bug (as opposed to Wishlist) and had other incorrect information (such as being applicable to .bash_profile). As all that has changed I'm reopening as a Wishlist instead of filing a separate RFE.
Comment 16 Aaron J. Seigo 2011-01-26 21:21:21 UTC
comment #4 still stands. there are ways to set the environment, e.g. putting scripts in ~/.kde/env/ or finding out how your particular OS sets session paths that aren't shell specific.


since i'm wasting my time here, i may as well waste everyone else's too ;) (that was tongue-in-cheek, laugh. ;)

this is why the feature request (aka "wishlist") is such a wasteland. it's easier to just let things fester here rather than struggle with the user who feels that they know better and can tell use what to do or somehow expect user support from a development tool.

who knows how many great ideas are in the plasma wishlist. i don't because i can't be bothered to wade through the dreck that gets filed as "wishlist" just so people don't have to struggle with the sane realities that are imposed on actual bug reports. :/ very unfortunate, and i don't see a fix for it coming any time soon.
Comment 17 Dotan Cohen 2011-01-26 21:38:41 UTC
> comment #4 still stands. there are ways to set the environment, e.g. putting
> scripts in ~/.kde/env/ or finding out how your particular OS sets session paths
> that aren't shell specific.

Then Comment #5 still stands as well. What component is responsible for
either reading from .profile or where should one configure the path for KDE? I
find nothing relevant in System Settings, am I missing it? Googling the issue I
only see how GDM users can change their configurations system wide. I use KDM
(it's even set to autologin) and this should be a per-user setting.
Comment 18 Aaron J. Seigo 2011-01-26 22:09:47 UTC
this is not a user support forum. forum.kde.org is, however.

in the spirit of helpfulness, however:

* executable script in $KDEHOME/env
* ~/.xinitrc
Comment 19 Dotan Cohen 2011-01-27 09:14:43 UTC
> this is not a user support forum. forum.kde.org
> is, however.

You are 100% correct, I apologise for presenting the question here. At least the information is here should other people stumble upon this issue. I appreciate your helpfulness and wish you a terrific day!