configure: Use -ef to compare paths
PATCH 1/1 configure: Use -ef to compare paths
configure checks if it is executed in the source directory by comparing the literal paths, but there may be multiple representations of a directory due to symbolic links. Use the -ef operator to tell if they point to the same directory.
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -13,7 +13,7 @@ export CCACHE_RECACHE=yes # make source path absolute source_path=$(cd "$(dirname -- "$0")"; pwd) -if test "$PWD" = "$source_path" +if test "$PWD" -ef "$source_path" then echo "Using './build' as the directory for build output"
---
base-commit: 7e3b6d8063f245d27eecce5aabe624b5785f2a77
change-id: 20241111-p-c8a0d3e7fc82
Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 15 lines · Akihiko Odaki
configure checks if it is executed in the source directory by comparing the literal paths, but there may be multiple representations of a directory due to symbolic links. Use the -ef operator to tell if they point to the same directory.
Signed-off-by Akihiko Odaki <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0
configure export CCACHE_RECACHE=yes · line 18
Quoted 7 lines
configure +1
-1@@ -13,7 +13,7 @@ export CCACHE_RECACHE=yes # make source path absolute source_path=$(cd "$(dirname -- "$0")"; pwd) -if test "$PWD" = "$source_path" +if test "$PWD" -ef "$source_path" then echo "Using './build' as the directory for build output"
Looking at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html it sounds like "-ef" is not part of all posix compliant shells? Did you check whether it is working with all of our destination host types?
Thomas
Quoted 11 lines · Thomas Huth
Quoted 10 lines · Akihiko Odaki
configure checks if it is executed in the source directory by comparing the literal paths, but there may be multiple representations of a directory due to symbolic links. Use the -ef operator to tell if they point to the same directory.
Signed-off-by Akihiko Odaki <[email protected]>---
configure | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
Quoted 11 lines
configure +1
-1@@ -13,7 +13,7 @@ export CCACHE_RECACHE=yes # make source path absolute source_path=$(cd "$(dirname -- "$0")"; pwd) -if test "$PWD" = "$source_path" +if test "$PWD" -ef "$source_path"then
echo "Using './build' as the directory for build output"Looking at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ test.html it sounds like "-ef" is not part of all posix compliant shells? Did you check whether it is working with all of our destination host types?
dash has it (https://www.man7.org/linux/man-pages/man1/dash.1.html), and it looks like it's only really ancient Solaris shells that do not.
OpenBSD has it in ksh (https://cvsweb.openbsd.org/src/bin/ksh/c_test.c?rev=1.28).
NetBSD has it in test(1) and seems to use the same sources for the shell (https://github.com/NetBSD/src/blob/trunk/bin/sh/Makefile#L53).
So I'm queuing the patch.
Paolo