On Tue, 19 Oct 2010 10:02:38 +1100, Daniel Pittman
<[email protected]> wrote:

> Nicholas Clark <[email protected]> writes:
> 
> > Dear bash,
> >
> > Why do you insist on hashing the paths to commands.
> > And never expiring the cache.
> > Or detecting that it has gone stale.
> > In this day and age, of more RAM and CPU than we know what to do with?
> >
> > How hard would it be to record the device, inode and mtime of each entry in
> > PATH, and automatically flush the cache if any change?
> >
> > Not hard, really.
> >
> > That's what I find hateful.
> 
> What I find hateful is the "Don't Be Stupid" switch.  Which, naturally, the
> developers of bash supplied because you wouldn't want to surprise people by
> changing this monumentally stupid ^W historic behaviour.
> 
> So, instead, we have 'set -o checkhash' to ask it to please work like sane
> people expect.
> 
> Which, of course, accompanies the other half dozen "Don't Be Stupid" options
> I have configured in my shell setup to ensure it doesn't suck quite as much.

Well, bash is not the only shell that does this stupidity. The most
recent update of tcsh (6.17.02) added a flag - also default off - to
rehash automatically

So you have to issue the command "rehash"

  rehash
     Causes  the internal hash table of the contents of the directo-
     ries in the path variable to be recomputed.  This is needed  if
     the  autorehash  shell variable is not set and new commands are
     added to directories in path while you  are  logged  in.   With
     autorehash,  a  new command will be found automatically, except
     in the special case where another  command  of  the  same  name
     which is located in a different directory already exists in the
     hash table.  Also flushes the cache of home  directories  built
     by tilde expansion.

Or set the shell variable autorehash

  autorehash (+)
     If set, the internal hash table of the contents of the directo-
     ries  in  the  path variable will be recomputed if a command is
     not found in the hash table.  In addition, the list  of  avail-
     able  commands  will  be rebuilt for each command completion or
     spelling correction attempt if set to `complete'  or  `correct'
     respectively;  if  set  to `always', this will be done for both
     cases.

It even has a choice of when to rehash!

I really do not see, as Nicholas, why that should not be true by default.

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.3 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Reply via email to