Skip to content

Conversation

remicollet
Copy link
Member

With bash 5.3.0 cd "" (empty path) now outputs an error sh: cd: null directory and fails

@remicollet
Copy link
Member Author

For 8.4+, mostly the same (code has diverged)

--- ./build/php.m4	2025-09-04 09:04:47.251889450 +0200
+++ ./build/php.m4.ok	2025-09-04 09:05:04.550323046 +0200
@@ -63,7 +63,11 @@
     changequote({,})
     ep_dir=$(echo $1|$SED 's%/*[^/][^/]*/*$%%')
     changequote([,])
-    ep_realdir=$(cd "$ep_dir" && pwd)
+    if test -z $ep_dir ; then
+      ep_realdir=$(pwd)
+    else
+      ep_realdir=$(cd "$ep_dir" && pwd)
+    fi
     $2="$ep_realdir"/$(basename "$1")
   fi
 ])

@iluuu1994 iluuu1994 requested a review from petk September 4, 2025 07:34
Copy link
Member

@petk petk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds find with me. Nice catch. Recent POSIX seemed to changed this behavior so this sounds correct, yes.

@remicollet
Copy link
Member Author

Merged as 98d2b92 and abbf840

@remicollet remicollet closed this Sep 5, 2025
@remicollet remicollet deleted the issue-bash53 branch September 5, 2025 07:14
@remicollet
Copy link
Member Author

For 8.4, see 3a88977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants