[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory
From: |
Chet Ramey |
Subject: |
Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory |
Date: |
Tue, 3 Oct 2017 16:23:38 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 10/3/17 4:14 PM, Mikulas Patocka wrote:
>
>
> On Sun, 1 Oct 2017, Chet Ramey wrote:
>
>> On 9/30/17 4:20 AM, Mikulas Patocka wrote:
>>
>>> Is there some reason why do we need to check if $OLDPWD is a real
>>> directory? dash and ksh accept the $OLDPWD variable, but don't poke it
>>> with the stat syscall. zsh clears $OLDPWD.
>>
>> It makes no sense to inherit it if it doesn't name a directory (or
>> "pathname" in the Posix standard), other than the sort of lazy evaluation
>> that will prevent your particular problem.
>
> Does something bad happen if we inherit $OLDPWD that points to a
> non-existing directory? Will some script malfunction because of it?
`cd -' will fail, of course. That's where $OLDPWD gets used. And who
knows whether some script will fail? It's impossible to say.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- Re: Bash should reset OLDPWD upon login, *only*., (continued)
- Re: Bash should reset OLDPWD upon login, *only*., Chet Ramey, 2017/10/02
- Re: Bash should reset OLDPWD upon login, *only*., Mikulas Patocka, 2017/10/03
- Re: Bash should reset OLDPWD upon login, *only*., Greg Wooledge, 2017/10/03
- Re: Bash should reset OLDPWD upon login, *only*., L A Walsh, 2017/10/03
- Re: Bash should reset OLDPWD upon login, *only*., Eduardo Bustamante, 2017/10/03
- Re: Bash should reset OLDPWD upon login, *only*., L A Walsh, 2017/10/03
Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory, Chet Ramey, 2017/10/01