Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
cd with empty argument does not conform to POSIX.1-2024 (Was: inherit OLDPWD from environment variable)
- X-seq: zsh-workers 53000
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: cd with empty argument does not conform to POSIX.1-2024 (Was: inherit OLDPWD from environment variable)
- Date: Mon, 22 Jul 2024 23:07:49 -0400
- Archived-at: <https://zsh.org/workers/53000>
- Feedback-id: iaa214773:Fastmail
- List-id: <zsh-workers.zsh.org>
On Fri, Jul 19, 2024, at 10:46 PM, Lawrence Velázquez wrote:
> If we're going to begin importing OLDPWD from the environment, we
> might as well align with other shells for consistency, which means
> accepting a zero-length value as is.
Speaking of zero-length values vis-à-vis cd:
% cd ""
The current behavior is to do nothing and exit with a zero status.
This is allowed by POSIX.1-2018 [1]:
If _directory_ is an empty string, the results are unspecified.
However, it is not allowed by the newly released POSIX.1-2024 [2]:
If _directory_ is an empty string, _cd_ shall write a
diagnostic message to standard error and exit with non-zero
status.
I don't have strong feelings about changing the default behavior,
but it would be useful to update POSIX_CD at least (and thus ksh/sh
emulation).
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html
[2]: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author