[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hash not restored after running command -p
From: |
Roger Morris |
Subject: |
Re: hash not restored after running command -p |
Date: |
Sun, 31 Oct 2021 12:06:10 -0400 |
Thanks for the reply. Though POSIX may allow this, still the last
line of the following example is rather unexpected behavior
$
$ echo echo MY LOCAL tmp/date SCRIPT > tmp/date
$ chmod +x tmp/date
$
$ PATH=.:/bin
$ date
Sun 31 Oct 2021 11:59:07 AM EDT
$ hash -l
builtin hash -p /bin/date date
$ cd tmp ; date ; cd ..
MY LOCAL tmp/date SCRIPT
$
$ PATH=.:/bin
$ command -p date
Sun 31 Oct 2021 11:59:50 AM EDT
$ hash -l
builtin hash -p /bin/date date
$ cd tmp ; date ; cd ..
Sun 31 Oct 2021 12:00:03 PM EDT
$
On Sat, Oct 30, 2021 at 1:53 PM Chet Ramey <chet.ramey@case.edu> wrote:
>
> On 10/29/21 6:06 PM, Roger Morris wrote:
>
> > Bash Version: 5.0
> > Patch Level: 17
> > Release Status: release
> >
> > Description:
> > I believe there's a bug in bash 4.4 (and still in 5.1) that wasn't
> > there in 4.3.30
> >
> > When 'command -p' runs, it no longer seems to restore the hash to its
> > previous value.
>
> This came in in mid-2015 as part of a set of fixes to `command -p'. I think
> the bash-4.4 and later behavior is correct: just because you're telling
> command to use a standard path it doesn't mean it should not act like it
> would in any other circumstance. There's nothing in POSIX that contradicts
> that.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- hash not restored after running command -p, Roger Morris, 2021/10/29
- Re: hash not restored after running command -p, Chet Ramey, 2021/10/30
- Re: hash not restored after running command -p, Mike Jonkmans, 2021/10/31
- Re: hash not restored after running command -p, Oğuz, 2021/10/31
- Re: hash not restored after running command -p, Mike Jonkmans, 2021/10/31
- Re: hash not restored after running command -p, Oğuz, 2021/10/31
- Re: hash not restored after running command -p, Mike Jonkmans, 2021/10/31
- Re: hash not restored after running command -p, Oğuz, 2021/10/31
- Re: hash not restored after running command -p, Mike Jonkmans, 2021/10/31
Re: hash not restored after running command -p,
Roger Morris <=