bug-make
[Top][All Lists]
Advanced

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

Re: [bug #60281] Directory in directory in $PATH shadows binaries in $PA


From: Philip Guenther
Subject: Re: [bug #60281] Directory in directory in $PATH shadows binaries in $PATH
Date: Tue, 23 Mar 2021 13:01:23 -0900

For the record, POSIX specifies that only normal files are considered when searching $PATH, so even though the directory is executable (heh), ignoring it is absolutely the correct thing.

Philip Guenther

On Tue, Mar 23, 2021 at 12:50 PM anonymous <INVALID.NOREPLY@gnu.org> wrote:
URL:
  <https://savannah.gnu.org/bugs/?60281>

                 Summary: Directory in directory in $PATH shadows binaries in
$PATH
                 Project: make
            Submitted by: None
            Submitted on: Tue 23 Mar 2021 09:50:35 PM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.3
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

= What's happening =

If you have a directory in a directory specified in the PATH environment
variable which shares a name with a command you want to run, that directory
will shadow the actual binary and you will get a permission denied error.

Example setup:

# prepend /home/user/bin to path
export PATH=/home/user/bin:/usr/bin
# create directory /home/user/bin/cat
mkdir /home/user/bin/cat
# create our testfile for cat
touch ./temp.txt


In Makefile

.PHONY: myrule
myrule:
        cat temp.txt


Make now attempts to exec the directory /home/user/bin/cat instead of
/usr/bin/cat:

user@host:~$ make
cat temp.txt
make: cat: Permission denied
make: *** [Makefile:2: myrule] Error 127



= What should be happening =

Make should exec /usr/bin/cat





    _______________________________________________________

Reply to this item at:

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

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



reply via email to

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