From owner-freebsd-ports Tue Apr 16 19:27:33 2002 Delivered-To: freebsd-ports@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 821) id 138CC37B405; Tue, 16 Apr 2002 19:27:28 -0700 (PDT) Date: Tue, 16 Apr 2002 19:27:28 -0700 From: John De Boskey To: Ports List Subject: protect 'make search' key from options processing Message-ID: <20020416192727.A59133@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, I just ran into a small quirk running some make search's in /usr/ports. Basically, we need to protect the key value from being option processed by grep. A simple patch to add '--': Index: bsd.port.subdir.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.subdir.mk,v retrieving revision 1.41 diff -u -r1.41 bsd.port.subdir.mk --- bsd.port.subdir.mk 23 Dec 2001 11:11:40 -0000 1.41 +++ bsd.port.subdir.mk 17 Apr 2002 02:12:43 -0000 @@ -255,7 +255,7 @@ top=`pwd`; \ there=`echo "$$here/" | sed s%$$top%${PORTSDIR}%`; \ if [ -n "$$key" ]; then \ - grep $$there ${PORTSDIR}/INDEX | grep -i "${key}" | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \ + grep $$there ${PORTSDIR}/INDEX | grep -i -- "${key}" | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \ elif [ $$name ]; then \ grep $$there ${PORTSDIR}/INDEX | grep -i "^[^|]*${name}[^|]*|" | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \ else \ I'd be happy to commit this, but I don't poke around in the usr ports infrastructure enough to know if this might break some assumed parsing in another script somewhere. Comments? Thanks, John ps: to replicate cd /usr/ports && make search key=-php_doc to find the different languages the doc has been translated to. something like key='[a-z]*-php' will work, but I don't expect the average user to understand all the in's and out's of regular expressions, thus the patch to simply protect the '-' character. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message