On Wed, Jul 30, 2025, 09:51 Michal Sojka <michal.sojka@cvut.cz> wrote:
> Configuration Information:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2
> uname output: Linux steelpick 6.12.37 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jul
> 10 14:05:15 UTC 2025 x86_64 GNU/$
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 5.3
> Patch Level: 0
> Release Status: release
>
> Description:
> When running "cd ''", bash 5.3 fails with "cd: null directory"
> while previous versions succeeded without an error and no
> directory was changed. I'm not sure whether this is considered a
> bug or not. The SUS[1] says "If directory is an empty string,
> the results are unspecified.". However, I didn't find anything
> related to this change in the NEWS file for bash-5.3. Other
> shells (zsh, dash, osh) seem to accept empty directory as cd
> argument.
>
> [1]:
>https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html
>
>
The current version[1] of the standard specifies:
If directory is an empty string, cd shall write a diagnostic message to
standard error and exit with non-zero status.
This standard change was due to interpretation 1047[2].
[1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html
[2] https://austingroupbugs.net/view.php?id=1047