From 961aa57f1466dc2dcd28b8419deb4621865411a6 Mon Sep 17 00:00:00 2001 From: Takashi Yano Date: Thu, 20 Feb 2025 01:37:27 +0200 Subject: [PATCH] ltmain.in: Fix mistaking a directory as an executable find_executable() can return a directory of the same name as the target executable if the directory is found earlier in the PATH, which causes check_executable() to fail. Reported: https://savannah.gnu.org/support/?111191 * build-aux/ltmain.in: Check if directory is found before executable in the PATH. --- build-aux/ltmain.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index c59459d05..36a85b9e1 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -4241,7 +4241,7 @@ check_executable (const char *path) if ((!path) || (!*path)) return 0; - if ((stat (path, &st) >= 0) + if ((stat (path, &st) >= 0) && !S_ISDIR (st.st_mode) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else -- 2.47.3