bug-bash
[Top][All Lists]
Advanced

[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: Tue, 30 Jan 2024 15:29:11 +0000

On Tue, 30 Jan 2024 10:22:18 -0500
Chet Ramey <chet.ramey@case.edu> wrote:

> On 1/28/24 10:34 AM, Kerin Millar wrote:
> > 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.
> 
> It does. Try `cd /usr/////////bin' and see what ends up in $PWD.

Thanks. I doubted myself on this point upon reading your response to my last 
bug report (in which you spoke of canonicalization). I was certain that it was 
not material to the behaviour under discussion in this thread, though.

-- 
Kerin Millar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]