From root@santropez.netel.rpi.edu  Wed Feb 25 16:41:31 2004
Return-Path: <root@santropez.netel.rpi.edu>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5A19216A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 25 Feb 2004 16:41:31 -0800 (PST)
Received: from santropez.netel.rpi.edu (santropez.netel.rpi.edu [128.113.24.162])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1014043D31
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 25 Feb 2004 16:41:31 -0800 (PST)
	(envelope-from root@santropez.netel.rpi.edu)
Received: from santropez.netel.rpi.edu (localhost [127.0.0.1])
	by santropez.netel.rpi.edu (8.12.11/8.12.11) with ESMTP id i1Q0fSdl025867
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 25 Feb 2004 19:41:28 -0500 (EST)
	(envelope-from root@santropez.netel.rpi.edu)
Received: (from root@localhost)
	by santropez.netel.rpi.edu (8.12.11/8.12.11/Submit) id i1Q0fRCC025866;
	Wed, 25 Feb 2004 19:41:27 -0500 (EST)
	(envelope-from root)
Message-Id: <200402260041.i1Q0fRCC025866@santropez.netel.rpi.edu>
Date: Wed, 25 Feb 2004 19:41:27 -0500 (EST)
From: Santropez & <root@santropez.netel.rpi.edu>
Reply-To: Santropez & <root@santropez.netel.rpi.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Fix for 'make search' when /usr/obj/usr/ports exists
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         63372
>Category:       ports
>Synopsis:       [PATCH] Fix for 'make search' when /usr/obj/usr/ports exists
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 25 16:50:19 PST 2004
>Closed-Date:    Thu Jun 10 07:40:29 GMT 2004
>Last-Modified:  Thu Jun 10 07:40:29 GMT 2004
>Originator:     Garance A Drosehn <gad@santropez.netel.rpi.edu>
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
RPI, Troy NY.
>Environment:
System: FreeBSD santropez.netel.rpi.edu 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Mon Feb 16 18:26:53 EST 2004 root@santropez.netel.rpi.edu:/usr/obj/usr/src/sys/Dual-Athlon2k i386


	The problem happens on multiple machines, multiple releases
	of FreeBSD.

>Description:
	This is a repeat of PR 31862 from Nov 2001 (where the fix was
	thought to have been committed in Apr 2002, but never really was).
	Given that few people seem to be bothered by this, it must be that
	I'm the only nut who creates /usr/obj/usr/ports/...

	Anyway, go into /usr/ports, and do a 'make search key=whatever'.
	It will probably work fine for you.  Now, do a command like:
		mkdir -p /usr/obj/`pwd`
	and repeat the exact same 'make search key=whatever'.  You will
	now get zero results.

>How-To-Repeat:
	The way I actually cause this problem is I have my own subdirectory
	of fake ports.  For some of those "ports", I do:  make obj
	That creates the /usr/obj/... directory for my fake port, and in
	the process it creates /usr/obj/usr/ports which screws up the
	'make search' target.

>Fix:

	Here is a fix that works for me.  I am not sure how well it would
	work if various directories are symlinks to other directories.

--- bsd.port.subdir.mk.orig	Tue Feb  3 23:27:04 2004
+++ bsd.port.subdir.mk	Wed Feb 25 19:06:20 2004
@@ -318,9 +318,9 @@
 .endif
 
 
-
+#  (avoid using `pwd` for 'here' due to the case where /usr/obj/`pwd` exists)
 search: ${PORTSDIR}/${INDEXFILE}
-	@here=`pwd`; \
+	@here=${.CURDIR}; \
 	cd ${PORTSDIR}; \
 	top=`pwd -P`; \
 	there=`echo "$$here/" | sed s%$$top%${PORTSDIR}%`; \


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: clement 
Responsible-Changed-When: Wed Feb 25 17:38:12 PST 2004 
Responsible-Changed-Why:  
portmgr's territory. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63372 
State-Changed-From-To: open->analyzed 
State-Changed-By: kris 
State-Changed-When: Sat Jun 5 21:31:47 PDT 2004 
State-Changed-Why:  
Testing on bento for subsequent commit 

http://www.freebsd.org/cgi/query-pr.cgi?pr=63372 
State-Changed-From-To: analyzed->closed 
State-Changed-By: kris 
State-Changed-When: Thu Jun 10 07:40:22 GMT 2004 
State-Changed-Why:  
Patch committed, thanks! 

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