bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cd: null directory


From: Chet Ramey
Subject: Re: cd: null directory
Date: Wed, 30 Jul 2025 10:04:39 -0400
User-agent: Mozilla Thunderbird

On 7/30/25 4:52 AM, Michal Sojka wrote:

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.

It's not.

The SUS[1] says "If directory is an empty string,
         the results are unspecified.".

https://austingroupbugs.net/view.php?id=1047

The interpretation declaring this to be an error was resolved in 2017.
The current version of the standard

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html

says "If directory is an empty string, cd shall write a diagnostic message
to standard error and exit with non-zero status." (That text is directly
from the interpretation.)

 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.

The CHANGES file says:

1. Changes to Bash

a. Per POSIX, a null pathname argument to `cd' is now an error.

when listing the changes that came in bash-5.3-beta.

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html

That is out of date, and has been superseded by Issue 8.

Chet
--
``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/



reply via email to

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