Skip to content

Conversation

wentasah
Copy link

When running make test with bash 5.3, it fails with:

minimal/do: line 358: cd: null directory
./do: minimal/do test failed
make: *** [Makefile:10: test] Error 42

The simplest way to reproduce the problem seems to be by running bash ./minimal/do test.

The reason is that bash 5.3 implements the latest version of the POSIX standard, which requires that "cd" with an empty string should fail. Specifically, "If directory is an empty string, cd shall write a diagnostic message to standard error and exit with non-zero status." 1. This is documented at 2.

Fix that by substituting an empty string with ".", which is already being done at other places in the that script.

When running "make test" with bash 5.3, it fails with:

    minimal/do: line 358: cd: null directory
    ./do: minimal/do test failed
    make: *** [Makefile:10: test] Error 42

The reason is that bash 5.3 implements the latest version of the POSIX
standard, which requires that "cd" with an empty string should fail.
Specifically, "If directory is an empty string, cd shall write a
diagnostic message to standard error and exit with non-zero status."
[1]. This is documented at [2].

Fix that by substituting an empty string with ".", which is already
being done at other places in the that script.

[1]: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cd.html
[2]: https://cgit.git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?h=bash-5.3#n119.
wentasah added a commit to wentasah/nixpkgs that referenced this pull request Jul 30, 2025
The failure manifests as:

    minimal/do: line 358: cd: null directory

In bash 5.3, command "cd ''" fails, while in the previous bash version
it succeeds and no directory is changed. In the fix, we replace empty
"$dodir" with ".".

Context:
- apenwarr/redo#47
- https://cgit.git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?h=bash-5.3#n119.
- https://lists.gnu.org/archive/html/bug-bash/2025-07/msg00152.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant