[Bug 1399948] Re: Commands on found if both ./bin and ~/bin in PATH

rdks nospaceleftondevice11one at gmail.com
Mon Dec 8 08:18:50 UTC 2014


> I suspect that it is some cache which is not properly getting reset.

Your assumption is somewhat correct. Bash does cache the locations of
executables it located. The keyword to look for would be hashing.

At first sight that behaviour doesn't seem to have changed for quite a
long time, it can be influenced via a configuration option though.

Could you please try to set the 'checkhash' option, and check if it still behaves the way you described?
The command to do this would be:
shopt -s checkhash

you can check if the option was  set successfully as follows:
shopt checkhash
wich sould return:
checkhash       on

The effect of enabling this option should be that when a command is
processed not just the hashed file is executed, but beforehand it will
be checked if the file does actually exists and otherwise the executable
will be rehashed.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1399948

Title:
  Commands on found if both ./bin and ~/bin in PATH

Status in bash package in Ubuntu:
  New

Bug description:
  I use (and have been using for 20 years or so) a path variable that looks like
  PATH=".;./bin;~/bin;$PATH"; export PATH

  This PATH should execute in priority:  project specific commands (in the working directory, or the bin
  subdirectory of the working directory), my personal commands (in my $HOME/bin folder) and then system commands.

  The problem seems to be that when I start a shell in my home directory, it will cache the location of commands in ~/bin
  as if they were in ./bin and then will be unable to find them if I cd out of my home directory.

  For example, I have a personal command called SlideShow:

  Here is a short example:
  ralmond at Limu:~$ file ~/bin/SlideShow
  /home/ralmond/bin/SlideShow: POSIX shell script, ASCII text executable
  ralmond at Limu:~$ # Works fine if I execute it from home directory
  ralmond at Limu:~$ SlideShow Pictures/
  ^C [Working as expected]
  ralmond at Limu:~$ cd Pictures/
  ralmond at Limu:~/Pictures$ #But if I change directory it does not work.
  ralmond at Limu:~/Pictures$ SlideShow Pics
  bash: ./bin/SlideShow: No such file or directory
  ralmond at Limu:~/Pictures$ #If I start the shell in a directory other than home it works
  ralmond at Limu:~/Pictures$ bash
  ralmond at Limu:~/Pictures$ SlideShow Pics
  ^C [Working as expected]

  I suspect that it is some cache which is not properly getting reset.

  Here are my system details:
  ralmond at Limu:~/Pictures$ lsb_release -rd
  Description:	Ubuntu 14.04.1 LTS
  Release:	14.04
  ralmond at Limu:~/Pictures$ apt-cache policy bash
  bash:
    Installed: 4.3-7ubuntu1.5
    Candidate: 4.3-7ubuntu1.5
    Version table:
   *** 4.3-7ubuntu1.5 0
          500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
          500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
          100 /var/lib/dpkg/status
       4.3-6ubuntu1 0
          500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
  ralmond at Limu:~/Pictures$ ^C
  ralmond at Limu:~/Pictures$

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1399948/+subscriptions



More information about the foundations-bugs mailing list