[Bug 260128] "make tags" fails with "gtags not found", src/Makefile undesirably rewrites PATH

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 30 Nov 2021 00:34:14 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260128

            Bug ID: 260128
           Summary: "make tags" fails with "gtags not found", src/Makefile
                    undesirably rewrites PATH
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: jfolker11@gmail.com

When running "make tags" to generate a TAGS table for the src tree, I
encountered the build failure shown at the bottom of this bug report. When I
put a symlink to gtags in /usr/bin/, "make tags" succeeds.

It seems that somewhere in Makefile Land, a sweaty fever dream of a place where
clean targets either clean only half your kitchen or burn it to the ground,
PATH isn't just being prepended or appended, but flat-out erased and rewritten.

Sadly, the cause is not obvious from a cursory recursion into every Makefile
from src/Makefile all the way down to src/lib/csu/tests/dso/Mekefile where the
build fails.

I'll keep digging until I find the skullduggery!

root@freebsd:/home/jfolker/freebsd/src # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
root@freebsd:/home/jfolker/freebsd/src # which gtags
/usr/local/bin/gtags
root@freebsd:/home/jfolker/freebsd/src # pwd
/usr/home/jfolker/freebsd/src
root@freebsd:/home/jfolker/freebsd/src # make tags
===> lib (tags)
===> lib/csu (tags)
===> lib/csu/amd64 (tags)
===> lib/csu/tests (tags)
===> lib/csu/tests/dso (tags)
/bin/sh: gtags: not found
*** Error code 127

Stop.
make[5]: stopped in /usr/home/jfolker/freebsd/src/lib/csu/tests/dso
*** Error code 1

Stop.
make[4]: stopped in /usr/home/jfolker/freebsd/src/lib/csu/tests
*** Error code 1

Stop.
make[3]: stopped in /usr/home/jfolker/freebsd/src/lib/csu
*** Error code 1

Stop.
make[2]: stopped in /usr/home/jfolker/freebsd/src/lib
*** Error code 1

Stop.
make[1]: stopped in /usr/home/jfolker/freebsd/src
*** Error code 1

Stop.
make: stopped in /usr/home/jfolker/freebsd/src
root@freebsd:/home/jfolker/freebsd/src #

-- 
You are receiving this mail because:
You are the assignee for the bug.