From nobody@FreeBSD.ORG Wed Apr 14 08:33:05 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 8A49E14EF0; Wed, 14 Apr 1999 08:33:04 -0700 (PDT)
Message-Id: <19990414153304.8A49E14EF0@hub.freebsd.org>
Date: Wed, 14 Apr 1999 08:33:04 -0700 (PDT)
From: dima@server.ru
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: existense of /usr/obj/usr/ports/shells/bash2 breakes the ports building scheme for the bash2 port
X-Send-Pr-Version: www-1.0

>Number:         11134
>Category:       ports
>Synopsis:       existense of /usr/obj/usr/ports/shells/bash2 breakes the ports building scheme for the bash2 port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 14 08:40:00 PDT 1999
>Closed-Date:    Sat Aug 31 21:03:43 PDT 2002
>Last-Modified:  Sat Aug 31 21:03:43 PDT 2002
>Originator:     Dmitry Kazarov
>Release:        RELENG_3
>Organization:
Server Inc
>Environment:
>Description:
If make (1) finds /usr/obj`pwd` dir it silently chdir there and sets MAKEFILE=`pwd`/Makefile instead of MAKEFILE=Makefile. This brakes normal behavior of 'do-build' and 'do-install' targets if the port's Makefile does not set MAKEFILE variable.

Setting WRKDIRPREFIX to /usr/obj leads to this problem too.
>How-To-Repeat:
cd /usr/ports/shells/bash2
mkdir -p /usr/obj`pwd`
make -n do-build

It will produce something like:

(cd /usr/ports/shells/bash2/work/bash-2.02.1; /usr/bin/env ...
make -f /usr/ports/shells/bash2/Makefile all)

And will exit with error in the best case.
>Fix:
There are 4 possible solutions to this problem:
 1. Change default behavior of make (1) to not to change curdir whitout special option specified.
 2. Use PORT_MAKEFILE variable in the ports Makefiles and /usr/ports/Mk/* instead of MAKEFILE var. 
 3. Explicitly set MAKEFILE=Makefile in all ports that use standard file name.
 4. Add this warning.
DIREXISTS!= test -d /usr/obj${.CURDIR} && echo YES
.if ${DIREXISTS} == "YES"
 @${ECHO_MSG} "You can not compile this port until /usr/obj${.CURDIR} directory exists"
 @${ECHO_MSG} "Delete it before building the port"
 @${FALSE}
.endif

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->billf 
Responsible-Changed-By: billf 
Responsible-Changed-When: Wed Apr 14 15:19:21 PDT 1999 
Responsible-Changed-Why:  
I was asked to look at this. 
Responsible-Changed-From-To: billf->hoek 
Responsible-Changed-By: billf 
Responsible-Changed-When: Tue Aug 3 07:29:11 PDT 1999 
Responsible-Changed-Why:  
Tim would like to look into this. No, really, he would. :> 

From: hoek@freebsd.org
To: freebsd-gnats-submit@freebsd.org, dima@server.ru
Cc:  
Subject: Re:ports/11134
Date: Wed, 4 Aug 1999 00:30:28 -0400 (EDT)

 >
 >   existense of /usr/obj/usr/ports/shells/bash2 breakes the ports
 >   building scheme for the bash2 port
 
 non-specific to bash2, of course...
 
 
 >If make (1) finds /usr/obj`pwd` dir it silently chdir there and sets MAKEFILE=`
 >pwd`/Makefile instead of MAKEFILE=Makefile. This brakes normal behavior of 'do-
 >build' and 'do-install' targets if the port's Makefile does not set MAKEFILE va
 >riable.
 
 One possible solution is two-part...
 
 One: Either perform #2 or #3 from the originators suggestions
 
 and
 
 Two: Add MAKEOBJDIRPREFIX=/nonexistent to the list of variables
      that are exported to the environment (see the end of bsd.port.mk,
      the .MAKEFLAGS: ... section).  This will prevent the chdir from
      occurring in any of the recursive invocations of make.  If a user
      attempts to call directly what is normally a target called only
      during recursion, then the results are unfortunately undefined.
      All supporting recursing targets need a preceeding cd ${.CURDIR}
 
 Three: think real hard before performing either of the above.
 
 Four: check my spelling of nonexistent
 
 Five: this still breaks if some bozo compiles make with -DWANT_ENV_PWD
 
 Six: maybe adding a flag to make(1) that would tell it to avoid the
      chdir to object dir magic is not a bad idea...  (very easy to write).
 
 There may be alternate superior solutions...
 
 > 1. Change default behavior of make (1) to not to change curdir whitout special
 > option specified.
 
 Or make the opposite option ... avoid change dir when given a certain
 option.  This could still allow ported-software to break internally,
 but I've not thought about that enough to worry about it (yet).
 
 > 4. Add this warning.
 >DIREXISTS!= test -d /usr/obj${.CURDIR} && echo YES
 >.if ${DIREXISTS} == "YES"
 > @${ECHO_MSG} "You can not compile this port until /usr/obj${.CURDIR} directory
 > exists"
 > @${ECHO_MSG} "Delete it before building the port"
 > @${FALSE}
 
 Maybe not a bad idea either.
 
 
 >Responsible-Changed-From-To: billf->hoek
 >Responsible-Changed-By: billf
 >Responsible-Changed-When: Tue Aug 3 07:29:11 PDT 1999
 >Responsible-Changed-Why:
 >Tim would like to look into this. No, really, he would. :>
 
 I think I have a couple PRs I can trade for...  <evil grin>
 

From: Peter Avalos <pavalos@theshell.com>
To: freebsd-gnats-submit@freebsd.org
Cc: Peter Avalos <pavalos@theshell.com>
Subject: Re: ports/11134: existense of /usr/obj/usr/ports/shells/bash2 breakes the ports building scheme for the bash2 port
Date: Sun, 21 Apr 2002 01:17:25 -0700

 This looks like the same thing as PR 30331 which includes a patch.
Responsible-Changed-From-To: hoek->portmgr 
Responsible-Changed-By: hoek 
Responsible-Changed-When: Sat Aug 31 16:58:37 PDT 2002 
Responsible-Changed-Why:  
This is clearly a portmgr issue.  I've stated my commentary 
in the PR history.  I'm not sure that I can anylonger remember 
why I wrote that which I wrote in this commentary... 

If in doubt, re-assign to Bill Fumerola.  :) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=11134 

From: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To: Kris Kennaway <kris@obsecurity.org>
Cc: portmgr@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org,
	jmallett@FreeBSD.org
Subject: Re: ports/11134: existense of /usr/obj/usr/ports/shells/bash2 breakes the ports building scheme for the bash2 port
Date: Sat, 31 Aug 2002 23:51:02 -0400

 On Sat, Aug 31, 2002 at 05:45:45PM -0700, Kris Kennaway wrote:
 > On Sat, Aug 31, 2002 at 05:03:49PM -0700, Tim Vanderhoek wrote:
 > > Synopsis: existense of /usr/obj/usr/ports/shells/bash2 breakes the ports building scheme for the bash2 port
 > > 
 > > Responsible-Changed-From-To: hoek->portmgr
 > > Responsible-Changed-By: hoek
 > > Responsible-Changed-When: Sat Aug 31 16:58:37 PDT 2002
 > > Responsible-Changed-Why: 
 > > This is clearly a portmgr issue.  I've stated my commentary
 > > in the PR history.  I'm not sure that I can anylonger remember
 > > why I wrote that which I wrote in this commentary...
 > 
 > I believe this is fixed; can you confirm?
 
 Hmm...  Revision 1.61 (cum 1.35.2.5) of usr.bin/make/main.c causes
 ${MAKEFILE} to be set to $(basename <input makefile>) instead
 of <input makefile>.
 
 I suspect that enough creativity will find cases where this can
 still break, but they seem to be sufficiently subtle as to require
 active foot-shooting rather than passive foot-shooting.
 
 I will close the PR and CC: Juli (author of rev 1.61) to ensure
 that she is aware of the importance of the rev 1.61 change.
 
 FWIW, even though I am closing this PR, I am in favour of the
 patches in 30331 that would change the ports system to use
 ${MAKE_FILE} instead of ${MAKEFILE} and I'm willing to do the
 legwork to change the 300-odd ports that define ${MAKEFILE}.
 
 
 -- 
 If I could think of a two-line witty aphorism for you to remember
 me by, this would definitely be it.
State-Changed-From-To: open->closed 
State-Changed-By: hoek 
State-Changed-When: Sat Aug 31 21:01:19 PDT 2002 
State-Changed-Why:  
Appears to be fixed by revisions 1.61 and 1.35.2.5 of 
src/usr.bin/make/main.c by jmallet.  Effectively, the 
make(1) will default to setting ${MAKEFILE} to "Makefile" 
when the /usr/obj/usr/ports/shells/bash2/ directory 
exists.  This is okay, since "Makefile" just so happens to 
coincidentally coincide with the default value assigned 
to ${MAKEFILE} by bsd.port.mk. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=11134 
>Unformatted:
