|
From: | Chet Ramey |
Subject: | Re: cd"": Shouldn't it fail? |
Date: | Tue, 30 Jan 2024 10:22:18 -0500 |
User-agent: | Mozilla Thunderbird |
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. -- ``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/
OpenPGP_signature.asc
Description: OpenPGP digital signature
[Prev in Thread] | Current Thread | [Next in Thread] |