Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: Re: cd with empty argument does not conform to POSIX.1-2024 (Was: inherit OLDPWD from environment variable)



Haai,

On Tue, 23 Jul 2024 11:47:48 -0400, "Mark J. Reed" <markjreed@xxxxxxxxx> wrote:
> --000000000000218e21061dec1638
> Content-Type: text/plain; charset="UTF-8"
> Content-Transfer-Encoding: quoted-printable
>
>> The current behavior is to do nothing and exit with a zero status.
>
> For comparison purposes, note that this is also the current behavior of
> bash, even in POSIX mode.  Also dash. Whereas ksh does report an error
> ("bad directory") and exit with status 1.

For consistency: me's in favour of scrapping the lax behaviour; after
all--

 0% ls ''
 ls: : No such file or directory
 1% mkdir ''
 mkdir: : No such file or directory
 1% echo blaat >''
 zsh:1: no such file or directory: 
 1%

One could argue that UNIX should allow for empty file names (after all:
the only real technical restriction here is that a nul character cannot
appear within) but fact is that it doesn't, and the behaviour of `cd'
should reflect that prohibition.

Also per the above: instead of "bad directory", mefavours the standard 
error string, but that's less important.

Me's not sure how clever zsh is being here (don't have time to check the
code), but to me, just letting chdir(2) handle it all seems to be the
obvious solution.

        --zeurkous.

-- 
Friggin' Machines!




Messages sorted by: Reverse Date, Date, Thread, Author