bug-make
[Top][All Lists]
Advanced

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

[bug #57962] apparent regression involving PATH resolution


From: Dmitry Goncharov
Subject: [bug #57962] apparent regression involving PATH resolution
Date: Fri, 6 Mar 2020 22:42:09 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #4, bug #57962 (project make):

The bug is in gnulib in function find_in_given_path.
This is a patch which fixes the bug.
The fix is likely needed for the windows specific piece of code in
find_in_given_path as well.

regards, Dmitry

diff --git a/lib/findprog-in.c b/lib/findprog-in.c
index c254f2f..d89ec00 100644
--- a/lib/findprog-in.c
+++ b/lib/findprog-in.c
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/stat.h>
 
 #include "filename.h"
 #include "concat-filename.h"
@@ -190,6 +191,7 @@ find_in_given_path (const char *progname, const char
*path,
           dir = ".";
 
         /* Try all platform-dependent suffixes.  */
+        struct stat st;
         for (i = 0; i < sizeof (suffixes) / sizeof (suffixes[0]); i++)
           {
             const char *suffix = suffixes[i];
@@ -208,7 +210,8 @@ find_in_given_path (const char *progname, const char
*path,
                    use it.  On other systems, let's hope that this program
                    is not installed setuid or setgid, so that it is ok to
                    call access() despite its design flaw.  */
-                if (eaccess (progpathname, X_OK) == 0)
+                if (eaccess (progpathname, X_OK) == 0 &&
+                        stat(progpathname, &st) == 0 && S_ISREG(st.st_mode))
                   {
                     /* Found!  */
                     if (strcmp (progpathname, progname) == 0)







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57962>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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