[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cd"": Shouldn't it fail?
From: |
Kerin Millar |
Subject: |
Re: cd"": Shouldn't it fail? |
Date: |
Sun, 28 Jan 2024 15:34:59 +0000 |
On Sun, 28 Jan 2024 18:09:24 +0300
Oğuz <oguzismailuysal@gmail.com> wrote:
> On Sun, Jan 28, 2024 at 5:10 PM <jwo@jwo.cz> wrote:
> > POSIX Programmer's Manual (cd(1p) manpage) says this:
> >
> > [9 unrelated special cases]
> >
> > 10. The cd utility shall then perform actions equivalent to the
> > chdir() function called with curpath as the path argument. If
> > these actions fail for any reason, the cd utility shall
> > display an appropriate error message and the remainder of
> > this step shall not be executed. [...]
>
> Right before that, it says in 8.c:
> > If, as a result of this canonicalization, the curpath variable is null, no
> > further steps shall be taken.
>
> which is what happens in bash, busybox sh, dash, mksh, pdksh, oksh,
> yash, zsh, and NetBSD sh.
>
I'm not sure that this is accurate. In my testing, bash does not even perform
this canonicalization step, which is optional to begin with. That is, it states
that "an implementation may" canonicalize in the manner described, and
prescribes a course of action to take if - and only if - such canonicalization
is performed.
I think that step #5 is the relevant one: given a null CDPATH value, the
concatenation of <dot>, <slash> and the empty operand (usually) names an
existing directory. This matter is also mentioned by
https://austingroupbugs.net/view.php?id=1047.
To summarise, the behaviour of bash appears to conform with the wording of
Issue 7 but it may have to change for Issue 8 or a later revision.
--
Kerin Millar
- cd"": Shouldn't it fail?, jwo, 2024/01/28
- Re: cd"": Shouldn't it fail?, Kerin Millar, 2024/01/28
- Re: cd"": Shouldn't it fail?, Oğuz, 2024/01/28
- Re: cd"": Shouldn't it fail?,
Kerin Millar <=
- Re: cd"": Shouldn't it fail?, Oğuz, 2024/01/28
- Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30
- Re: cd"": Shouldn't it fail?, Kerin Millar, 2024/01/30
- Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30
- Re: cd"": Shouldn't it fail?, Kerin Millar, 2024/01/30
- Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30
Re: cd"": Shouldn't it fail?, Chet Ramey, 2024/01/30