Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jun 2004 10:24:20 +0200 (CEST)
From:      Roman Neuhauser <neuhauser@chello.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/68072: fix make search when $PORTSDIR contains ERE metacharacters
Message-ID:  <20040618082420.8DBDE2FDA01@isis.wad.cz>
Resent-Message-ID: <200406180830.i5I8UQcX070920@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         68072
>Category:       ports
>Synopsis:       fix make search when $PORTSDIR contains ERE metacharacters
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 18 08:30:26 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Roman Neuhauser
>Release:        FreeBSD 4.10-STABLE i386
>Organization:
>Environment:
System: FreeBSD isis.wad.cz 4.10-STABLE FreeBSD 4.10-STABLE #0: Thu Jun 10 23:39:22 CEST 2004 root@isis.wad.cz:/usr/obj/usr/src/sys/FREEPUPPY2_6 i386


	
>Description:
I broke the search target (ports/40699) in situations where ${PORTSDIR} is
a symlink to a directory with extended regular expression metacharacters.

the fix is to use string comparisons instead of regex matching.

the problem was reported here:
http://lists.freebsd.org/pipermail/freebsd-ports/2004-June/thread.html#13324

>How-To-Repeat:
mv /usr/ports /var/break+me
ln -s /var/break+me /usr/ports
cd /usr/ports
make search name=whatever

>Fix:

	

--- Mk::bsd.port.subdir.mk.search-PORTSDIR-metachars.patch begins here ---
Index: Mk/bsd.port.subdir.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.subdir.mk,v
retrieving revision 1.54
diff -u -r1.54 bsd.port.subdir.mk
--- Mk/bsd.port.subdir.mk	10 Jun 2004 07:30:19 -0000	1.54
+++ Mk/bsd.port.subdir.mk	15 Jun 2004 15:20:31 -0000
@@ -349,7 +349,9 @@
 	    -v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}"\
 	    -v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \
 	'BEGIN { \
-	    sub(top, "${PORTSDIR}", there); \
+	    if (substr(there, 1, length(top)) == top) \
+	      there = "${PORTSDIR}" substr(there, 1 + length(top)); \
+	    therelen = length(there); \
 	    IGNORECASE=icase; \
 	    keylen = length(key); keylim = keylim && keylen; \
 	    if (!keylim && keylen) \
@@ -377,7 +379,7 @@
 	    } \
 	  } \
 	  { \
-	    if ($$2 !~ there) \
+	    if (substr($$2, 1, therelen) != there) \
 	      next; \
 	    for (i in parms) \
 	      if ($$i !~ parms[i]) \
--- Mk::bsd.port.subdir.mk.search-PORTSDIR-metachars.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040618082420.8DBDE2FDA01>