<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>241763</bug_id>
          
          <creation_ts>2010-06-14 21:10:32 +0000</creation_ts>
          <short_desc>Given a PATH with /usr/local/bin before /usr/bin, krunner prefers /usr/bin/test.sh instead of /usr/local/bin/test.sh</short_desc>
          <delta_ts>2012-01-27 13:20:54 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>kio</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daniel Hahler">kde-bugzilla</reporter>
          <assigned_to name="David Faure">faure</assigned_to>
          <cc>faure</cc>
    
    <cc>israel.lugo</cc>
    
    <cc>jsatt22</cc>
    
    <cc>markg85</cc>
    
    <cc>mat69</cc>
    
    <cc>qmysjwxb8zhc25n</cc>
    
    <cc>smls75</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin>4.8.1</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>20</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>978581</commentid>
    <comment_count>0</comment_count>
    <who name="Daniel Hahler">kde-bugzilla</who>
    <bug_when>2010-06-14 21:10:32 +0000</bug_when>
    <thetext>Version:           unspecified (using Devel) 
OS:                Linux

Until recently I&apos;ve thought that KRunner would ignore /usr/local/bin from my PATH completely, but as it turns out, it just prefers programs in /usr/bin (apparently).

Reproducible: Always

Steps to Reproduce:
1. Set PATH to e.g. /home/USER/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games (e.g. via /etc/environment), but apparently my ~/.zshrc is used, too (adding the ~/bin part)
2. Add a test.sh file to /usr/local/bin and symlink it into /usr/bin. I have used (&quot;-f&quot; to not use any RCs files):
  #!/usr/bin/zsh -f
  echo $0 &gt; /tmp/testsh-path
  echo $SHELL &gt;&gt; /tmp/testsh-path
  echo $PATH &gt;&gt; /tmp/testsh-path
3. Run test.sh from krunner (Alt-F2, &quot;test.sh&quot;, Enter)

Actual Results:  
/tmp/testsh-path will contain:
/usr/bin/test.sh
/bin/zsh
/home/USER/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games


Expected Results:  
The first line ($0, script name) should be /usr/local/bin/test.sh instead.

When removing the symlink from /usr/bin, /usr/local/bin gets used - so it is not ignoring it completely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>978590</commentid>
    <comment_count>1</comment_count>
    <who name="Daniel Hahler">kde-bugzilla</who>
    <bug_when>2010-06-14 21:30:42 +0000</bug_when>
    <thetext>Even using the following construct, /usr/bin/test.sh is used:
  PATH=/usr/local/bin /usr/bin/krunner</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>985391</commentid>
    <comment_count>2</comment_count>
    <who name="Daniel Hahler">kde-bugzilla</who>
    <bug_when>2010-07-01 21:54:50 +0000</bug_when>
    <thetext>Another bug, but very much related:
when there&apos;s /usr/bin/eclipse and /usr/local/bin/eclipse, the former gets started for &quot;eclipse&quot;.
However, after purging the eclipse package and removing /usr/bin/eclipse, krunner won&apos;t start /u/l/b/eclipse, too!

Looks like the result has been cached and the cache does not get dismissed on cache miss.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1053796</commentid>
    <comment_count>3</comment_count>
    <who name="Matthias Fuchs">mat69</who>
    <bug_when>2010-12-05 13:50:41 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 203721 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1053835</commentid>
    <comment_count>4</comment_count>
    <who name="Matthias Fuchs">mat69</who>
    <bug_when>2010-12-05 15:01:24 +0000</bug_when>
    <thetext>Ok, I just tried the method you described.

/usr/local/bin/test.sh
/bin/bash
/home/mat-not/kde/bin:/usr/local/bin:/home/mat-not/kde/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/opt/java/bin:/opt/java/db/bin:/opt/java/jre/bin:/usr/lib/perl5/vendor_perl/bin:/usr/bin/perlbin/vendor:/usr/lib/perl5/core_perl/bin:/opt/qt/bin

Is what I get (yeah the path on my devel-account is a little crappy ;) ), I am using bash as shell and here it worked as it should.

Could you please retry with trunk -- that is the version I tried -- and see if you still have this problem? If you still have it, could you please retry with bash as default shell?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1053837</commentid>
    <comment_count>5</comment_count>
    <who name="Matthias Fuchs">mat69</who>
    <bug_when>2010-12-05 15:01:57 +0000</bug_when>
    <thetext>*** Bug 203721 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1056025</commentid>
    <comment_count>6</comment_count>
    <who name="Daniel Hahler">kde-bugzilla</who>
    <bug_when>2010-12-09 21:23:41 +0000</bug_when>
    <thetext>I am re-opening it:
It still happens for me with KDE 4.6b2 (not so easy to try with trunk for me).

I have tried it after &quot;chsh -s /bin/bash&quot; and re-login, which resulted in:
$0: /usr/bin/test.sh
$SHELL: /bin/bash
$PATH: /home/daniel/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games

Going back to zsh it looks like this:
$0: /usr/bin/test.sh
$SHELL: /bin/zsh
$PATH: /home/daniel/bin:/usr/local/bin:/FROM_ETC_ENVIRONMENT:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games

On a shell prompt (zsh) the PATH looks like the following btw:
/home/daniel/.dotfiles/bin:/home/daniel/bin:/usr/local/bin:/usr/local/sbin:/home/daniel/bin:/usr/local/bin:/FROM_ETC_ENVIRONMENT:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1056431</commentid>
    <comment_count>7</comment_count>
    <who name="Matthias Fuchs">mat69</who>
    <bug_when>2010-12-10 18:34:58 +0000</bug_when>
    <thetext>Interesting that I don&apos;t have that bug.
To me this looks like a bug in KRun.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1056438</commentid>
    <comment_count>8</comment_count>
    <who name="Matthias Fuchs">mat69</who>
    <bug_when>2010-12-10 18:53:41 +0000</bug_when>
    <thetext>Btw. could you compile a small test-program?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1056469</commentid>
    <comment_count>9</comment_count>
      <attachid>54401</attachid>
    <who name="Matthias Fuchs">mat69</who>
    <bug_when>2010-12-10 20:15:43 +0000</bug_when>
    <thetext>Created attachment 54401
test-program

Please run the program in the compressed file and post the output here.
If you need instructions on how to compile/run it just ask.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059916</commentid>
    <comment_count>10</comment_count>
    <who name="Daniel Hahler">kde-bugzilla</who>
    <bug_when>2010-12-16 14:19:34 +0000</bug_when>
    <thetext>Here is the output:

Used PATH:
/home/daniel/.dotfiles/bin
/home/daniel/bin
/usr/local/bin
/usr/local/sbin
/home/daniel/bin
/usr/local/bin
/FROM_ETC_ENVIRONMENT
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/bin/X11
/usr/games


Prefered exe:
/usr/bin/test.sh

All test.sh found in path:
/usr/local/bin/test.sh
/usr/local/bin/test.sh
/usr/local/bin/test.sh
/usr/bin/test.sh
/usr/bin/X11/test.sh</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1060569</commentid>
    <comment_count>11</comment_count>
    <who name="Matthias Fuchs">mat69</who>
    <bug_when>2010-12-17 19:25:53 +0000</bug_when>
    <thetext>Ok, thx. That did help a lot.

@dfaure
As it appears the bug is at kstandarddirs.cpp:1380.
Not sure why both the &quot;libexec&quot; and the &quot;exe&quot; calls are there anyway. Imo they should be after the system paths.

Btw. the reason why I could not reproduce this was that I was running trunk and installPath(&quot;exe&quot;) then points to the bin-dir of KDE of the local installation (e.g. /home/kde-devel/kde/bin). When using a normal installation it will lead to /usr/bin/test.sh in our example.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1060748</commentid>
    <comment_count>12</comment_count>
    <who name="David Faure">faure</who>
    <bug_when>2010-12-17 19:55:52 +0000</bug_when>
    <thetext>SVN commit 1207384 by dfaure:

findExe: do not look into the &quot;exe&quot; resource explicitely if KDE is installed into /usr. In that case
we know it will be part of the $PATH, and we better honour the ordering of $PATH.

I still want to keep the &quot;exe&quot;-lookup when KDE is in a custom prefix, so that it works [better]
even if $PATH doesn&apos;t have the custom prefix.
Kudos to Matthias Fuchs and Daniel Hahler for the complete investigation.
BUG: 241763
FIXED-IN: 4.6


 M  +7 -4      kstandarddirs.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&amp;revision=1207384</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1192890</commentid>
    <comment_count>13</comment_count>
    <who name="Israel G. Lugo">israel.lugo</who>
    <bug_when>2011-12-01 14:14:25 +0000</bug_when>
    <thetext>The implemented solution doesn&apos;t work for me. I am using KDE 4.6.5 on Gentoo, and the fix from r1207384 is present on my source. However, I still see the problem. A slightly modified version of pathtest shows why:

$ ./pathtest 
Used PATH:
/usr/local/bin
/usr/bin
/bin
/opt/bin
/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3
/usr/games/bin


Prefered exe:
/usr/bin/test.sh

All test.sh found in path:
/usr/local/bin/test.sh
/usr/bin/test.sh

installPath(libexec):
/usr/lib64/kde4/libexec/

installPath(exe):
/usr/bin/

My installPath is &quot;/usr/bin/&quot;, and the fix in r1207384 is checking (p != QLatin1String(&quot;/usr/&quot;)).

The installation was done as per default behavior and the install path seems quite normal to me. For example:

$ which krunner
/usr/bin/krunner

I would suggest at the very least changing KStandardDirs::findExe() to check if p *begins* with &quot;/usr/&quot;, instead of being *equal* to &quot;/usr/&quot;. Even better, I would suggest checking the system paths *first*, and only *then* checking the KDE-specific bin directory.

As it is now, the bug is still very much there on 4.6.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1192893</commentid>
    <comment_count>14</comment_count>
      <attachid>66264</attachid>
    <who name="Israel G. Lugo">israel.lugo</who>
    <bug_when>2011-12-01 14:17:38 +0000</bug_when>
    <thetext>Created attachment 66264
modified pathtest that reports installPath(exe) and installPath(libexec)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1207375</commentid>
    <comment_count>15</comment_count>
    <who name="Sam S.">smls75</who>
    <bug_when>2012-01-01 10:05:05 +0000</bug_when>
    <thetext>The bug still exists for me in KDE 4.8 RC1 on Arch Linux:

Preference of /usr/local/bin over /usr/bin in defined through the PATH variable in /etc/profile, and typing test.sh in a shell (in my case bash, not zsh) indeed runs the correct one.
But KDE (both KRunner and the pathtest program from this thread) choose to run /usr/bin/test.sh</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1210006</commentid>
    <comment_count>16</comment_count>
    <who name="Mark">markg85</who>
    <bug_when>2012-01-05 18:25:48 +0000</bug_when>
    <thetext>*** Bug 242834 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1210014</commentid>
    <comment_count>17</comment_count>
    <who name="David Faure">faure</who>
    <bug_when>2012-01-05 18:40:12 +0000</bug_when>
    <thetext>Git commit a18253a36aa1d5a77c844ce0e5d5699697e58e2c by David Faure.
Committed on 05/01/2012 at 19:36.
Pushed by dfaure into branch &apos;KDE/4.8&apos;.

Honour $PATH when looking for executables.

The very old idea of not requiring PATH to be set, when compiling KDE
into a custom prefix, doesn&apos;t make that much sense (we require tons
of other env vars anyway), and doesn&apos;t allow users to control PATH.
FIXED-IN: 4.8.1

M  +9    -12   kdecore/kernel/kstandarddirs.cpp

http://commits.kde.org/kdelibs/a18253a36aa1d5a77c844ce0e5d5699697e58e2c</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1210022</commentid>
    <comment_count>18</comment_count>
    <who name="Israel G. Lugo">israel.lugo</who>
    <bug_when>2012-01-05 18:48:47 +0000</bug_when>
    <thetext>(In reply to comment #17)
&gt; 
&gt; Honour $PATH when looking for executables.
&gt; 
&gt; The very old idea of not requiring PATH to be set, when compiling KDE
&gt; into a custom prefix, doesn&apos;t make that much sense (we require tons
&gt; of other env vars anyway), and doesn&apos;t allow users to control PATH.
&gt; FIXED-IN: 4.8.1
&gt; 

Thank you for the fix! That sounds like the best possible solution, and is consistent with expected behavior in general on a *nix system.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1219362</commentid>
    <comment_count>19</comment_count>
    <who name="Sebastian Trueg">trueg</who>
    <bug_when>2012-01-27 13:20:54 +0000</bug_when>
    <thetext>Git commit d6d81ceb4a176f7c709edb8b5223ad2aaf7269f6 by Sebastian Trueg, on behalf of David Faure.
Committed on 05/01/2012 at 19:36.
Pushed by trueg into branch &apos;KDE/4.8&apos;.

Honour $PATH when looking for executables.

The very old idea of not requiring PATH to be set, when compiling KDE
into a custom prefix, doesn&apos;t make that much sense (we require tons
of other env vars anyway), and doesn&apos;t allow users to control PATH.
FIXED-IN: 4.8.1

M  +9    -12   kdecore/kernel/kstandarddirs.cpp

http://commits.kde.org/kdelibs/d6d81ceb4a176f7c709edb8b5223ad2aaf7269f6</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>54401</attachid>
            <date>2010-12-10 20:15:43 +0000</date>
            <delta_ts>2010-12-10 20:15:43 +0000</delta_ts>
            <desc>test-program</desc>
            <filename>pathtest.tar.gz</filename>
            <type>application/x-gzip</type>
            <size>642</size>
            <attacher name="Matthias Fuchs">mat69</attacher>
            
              <data encoding="base64">H4sIANR7Ak0AA+2WbWvbMBDH+9qf4sjGsKFkchrHkHaFrAkspOtDsg4GAaNaSqvVllNJho6S7z7J
bptm6+jGSPfQ+72IEt/p/qez75y99/SC7wttdNNcmY21QAjptNtg1zCOiFtJWP+uabcIhGFkv3Ti
MA6BhC0Skg0g60lnlVIbqmwqvxunPgrcrf8Ic1V85qnx59ScG65N4KW5fSKSXEiRl3mi+GUpFGf+
x8F4Mjw8gFazE3jeTEiWzGl6Qc+4P+oP2jAeHJ8Mx4N+4AmZZiXjUF3v8xktM6PtnpvrCbPxUlMo
wbUPL6+dVzI82Ns/6Q8mC7COmi/zSSbjvQnkVMhmOp9bI2Us4Vc8LQ09zfidnw20smURePa+nnGT
ZEJe2I9TRSvFexsq5dHwMNkfvh33xp+c+J++H0/NbWXXqfFI/9tuX/Y/6bRs/5NO3Mb+fwpe3Hbr
zmhiqGRUsb5QetdbGkShjeI03/VcD5uqGf3Au/bAkhbS9tLxxCghz9x7BFyDaXgDK/G6Xf1FG54f
OaMfbFd7tWHdblqUBnZ2oHGiOYOj3od33als1A6zwuqm5+CvqMArJ7FZCwVQ5wHfBXTmpil6OhXC
D5pViD411A+ctXLlkmW10sJ7IKOpnMojxWfczj+wM2eZ2IrfNwd1o3Fwxf2GmzJNfd4IfiqLKu79
OlpBXas9INDLMqfhfDZhqfRQXafSOsONiy1pKRkIWZXn8Upbgc0qk/t1Xolvjb9aZcVNqSSQbW/x
7Obt38ZpKTL2er0adh7GUfTj/3/kbv7HURxW838r2tqAaL1p1Tzz+Y8gCIIgCIIgCIIgCIIgCIIg
CIIgyP/DV9JFVJYAKAAA
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>66264</attachid>
            <date>2011-12-01 14:17:38 +0000</date>
            <delta_ts>2011-12-01 14:17:38 +0000</delta_ts>
            <desc>modified pathtest that reports installPath(exe) and installPath(libexec)</desc>
            <filename>pathtest.tar.gz</filename>
            <type>application/octet-stream</type>
            <size>720</size>
            <attacher name="Israel G. Lugo">israel.lugo</attacher>
            
              <data encoding="base64">H4sIAECM104AA+2XbWvbMBDH81qfQmRj2FAy20lsSLtC1hgWmvUhWQaDgFFspdVqy6klQ0fJd59k
N09NQlNYusHu9yJ2rPP9T3fS2Z4SeSupkB8rh8NSeE1LH+1nxzkV23bdpme5luOq655bdyu4ecCY
FuRCkgzjt5D6F5nO658QxmvhdHoADV1gt7Gz/rbnOSv1r1cs23a8egVbB4hlg/+8/u8YD+M8ovjk
fCAJj0gWdVgmTtFygKVCZpQkpwghxiXWK8Uw0SPCijDlQuLrgcwYv+kxda5XlMCf8Jq/Vkv8EpIm
V3rQMI+Le4WMWq0wzSU+OcHVoaARvmp/+9Ia8WppMEmVbniLjTUV/EFLHJVCJi7jwBsO9XBNpm0R
MmaYtcJFh0himHq0MKU8ikulGdoS0YiP+FVGJzRTkdEHugxsze7ZRCeMR/4DNap6W9XEbdXcK4rC
72oelaAo1bYItONYa2ibI7xU2pbXEVfG+MlEpTTnEWa8SM/LmVYCR0Ukq3le868GX5vldQ2m/pA4
1iujx8bKXbi5eFZsjGpcWu2a7artk6m5o3Kb0vuXauckVF1emIAS2id4ZbZH4P6e+S+cZFTmGcfW
MZqhcv8v+v/ZV3JH9cITNfkg/2iPeaH/Ww1HP/+b6sT1bM9W/d+puw3o/2/BNEt/0lAa83VgojBR
CyFIGGdJngQZvc+Z6n/Gd78/6F5eYKfmmgjpHhRMSXhHbqhx3vEbuO9fD7t9v2Oi+YOjuN6hE5LH
Uphofj2IlL9QphmjwsDvH7VV0L046w07/mCGlaGgy3iCQf9sgOcvJ2qQRFGgd2ouyTimCzvlaO2W
mYlUXW+oDGLG79TPOCOF4soNhfJ59zLodT/32/0fWvxv1+OtWez/cc7i6DBfAfu9/+v97zU921H7
3/IceP8HAAAAAAAAAAAAAAAAAAAAAAAAgFfzG8uQX8cAKAAA
</data>

          </attachment>
      

    </bug>

</bugzilla>