From nobody@FreeBSD.org  Sun Dec 12 16:46:02 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 283EC106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 12 Dec 2010 16:46:02 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (unknown [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id F0B358FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 12 Dec 2010 16:46:01 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id oBCGk1jA056342
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 12 Dec 2010 16:46:01 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id oBCGk1dJ056341;
	Sun, 12 Dec 2010 16:46:01 GMT
	(envelope-from nobody)
Message-Id: <201012121646.oBCGk1dJ056341@red.freebsd.org>
Date: Sun, 12 Dec 2010 16:46:01 GMT
From: Pascal Stumpf <Pascal.Stumpf@cubes.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: PORTS_MODULES= seriously broken if port depends on an executable
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         153049
>Category:       misc
>Synopsis:       [build] PORTS_MODULES= seriously broken if port depends on an executable
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 12 16:50:04 UTC 2010
>Closed-Date:    
>Last-Modified:  Sat Jun  9 19:30:11 UTC 2012
>Originator:     Pascal Stumpf
>Release:        8-STABLE
>Organization:
>Environment:
>Description:
The PORTS_MODULES= variable in /etc/make.conf is supposed to automate
building and installing kernel modules from ports. However, it seems
there is a bug in the build system that breaks the build of any port
that depends on an executable (libraries are completely fine though).
Example:

cd ${PORTSDIR:-/usr/ports}/net/bwn-firmware-kmod; SYSDIR=/usr/src/sys make -B deinstall deinstall reinstall
===>  Deinstalling for net/bwn-firmware-kmod
===>   Deinstalling bwn-firmware-kmod-0.1.0
===>   bwn-firmware-kmod-0.1.0 depends on executable: b43-fwcutter - not found
===>    Verifying reinstall for b43-fwcutter in /usr/ports/sysutils/b43-fwcutter
===>  Installing for b43-fwcutter-012
===>   Generating temporary packing list
===>  Checking if sysutils/b43-fwcutter already installed
===>   b43-fwcutter-012 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of sysutils/b43-fwcutter
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop in /usr/ports/sysutils/b43-fwcutter.
*** Error code 1

Stop in /usr/ports/sysutils/b43-fwcutter.
*** Error code 1

Stop in /usr/ports/net/bwn-firmware-kmod.
*** Error code 1

Stop in /usr/ports/net/bwn-firmware-kmod.
*** Error code 1

Stop in /usr/obj/usr/src/sys/CUSTOM.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
/usr/src # which b43-fwcutter
/usr/local/bin/b43-fwcutter
/usr/src # 


Note how it fails to detect that b43-fwcutter even though it's present
on the system. This results in an attempted reinstall of
sysutils/b43-fwcutter, which fails because it is already installed.
Therefore, rebuilding net/bwn-firmware-kmod also fails.
>How-To-Repeat:

>Fix:
I'm not an expert in the build system of /usr/src, but to me it seems
that $PATH ist not picked up from the environment (which it should be
when building ports). 

>Release-Note:
>Audit-Trail:

From: Garrett Cooper <yanegomi@gmail.com>
To: bug-followup@FreeBSD.org, Pascal.Stumpf@cubes.de
Cc:  
Subject: Re: misc/153049: [build] PORTS_MODULES= seriously broken if port
 depends on an executable
Date: Sat, 9 Jun 2012 12:24:08 -0700

 Seems like a dupe of ports/161452 ; dougb has another patch out to
 improve this as well:
 http://lists.freebsd.org/pipermail/freebsd-current/2012-June/034526.html
 . What should be committed is an intersection of the two patches.
 -Garrett
>Unformatted:
