From schweikh@schweikhardt.net  Sun Aug 26 04:28:20 2001
Return-Path: <schweikh@schweikhardt.net>
Received: from bremen.shuttle.de (bremen.shuttle.de [194.95.249.251])
	by hub.freebsd.org (Postfix) with ESMTP id 400D737B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 26 Aug 2001 04:28:19 -0700 (PDT)
	(envelope-from schweikh@schweikhardt.net)
Received: by bremen.shuttle.de (Postfix, from userid 10)
	id ABEEE17EC5; Sun, 26 Aug 2001 13:17:23 +0200 (CEST)
Received: (from schweikh@localhost)
	by hal9000.schweikhardt.net (8.11.5/8.11.3) id f7QBHRK05259;
	Sun, 26 Aug 2001 13:17:27 +0200 (CEST)
	(envelope-from schweikh)
Message-Id: <200108261117.f7QBHRK05259@hal9000.schweikhardt.net>
Date: Sun, 26 Aug 2001 13:17:27 +0200 (CEST)
From: Jens Schweikhardt <schweikh@schweikhardt.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] Useless use of cat in /usr/ports/Makefile
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         30099
>Category:       ports
>Synopsis:       [PATCH] Useless use of cat in /usr/ports/Makefile
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 26 04:30:00 PDT 2001
>Closed-Date:    Sun Dec 23 02:58:45 PST 2001
>Last-Modified:  Sun Dec 23 02:58:58 PST 2001
>Originator:     Jens Schweikhardt
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Digital Details
>Environment:
System: FreeBSD hal9000.schweikhardt.net 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Aug 6 23:23:45 CEST 2001 toor@hal9000.schweikhardt.net:/usr/obj/usr/src/sys/HAL9000 i386


>Description:

/usr/ports/Makefile has a target, parallel: ${.CURDIR}/INDEX, which invokes

        @cat ${.CURDIR}/INDEX | awk -F '|' 'lots of commands'

The cat is useless (and makes everyone on comp.unix.shell chuckle and
suspect yet another shell newbie :-). Save a process today and make it

        @awk -F '|' 'lots of commands' < ${.CURDIR}/INDEX

or if you prefer the filename at the beginning you can use

        @${.CURDIR}/INDEX < awk -F '|' 'lots of commands'

because redirection can appear anywhere on a line, even between the
options. Yup, shell grammar has been like this ever since. This is good
to confuse the heck out of everybody else - nobody will ever touch your
Makefile again... Help promote reasonable shell programming.

>How-To-Repeat:
	N/A
>Fix:


Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/Makefile,v
retrieving revision 1.64
diff -u -r1.64 Makefile
--- Makefile	2001/04/22 16:47:52	1.64
+++ Makefile	2001/08/26 11:10:39
@@ -84,7 +84,7 @@
 .for dir in ${SUBDIR}
 	@echo "all: ${dir}-all"
 .endfor
-	@cat ${.CURDIR}/INDEX | awk -F '|' '{me=$$1; here=$$2; bdep=$$8; rdep=$$9; split(here, tmp, "/"); if (bdep != "") { gsub("$$", ".tgz", bdep); gsub(" ", ".tgz ", bdep); } if (rdep != "") { gsub("$$", ".tgz", rdep); gsub(" ", ".tgz ", rdep); } print tmp[4] "-all: " me ".tgz"; print me ": " me ".tgz"; print me ".tgz: " bdep " " rdep; printf("\t@/var/portbuild/scripts/pdispatch ${branch} /var/portbuild/scripts/portbuild %s.tgz %s", me, here); if (bdep != "") printf(" %s", bdep); if (rdep != "") printf(" %s", rdep); printf("\n")}'
+	@awk -F '|' '{me=$$1; here=$$2; bdep=$$8; rdep=$$9; split(here, tmp, "/"); if (bdep != "") { gsub("$$", ".tgz", bdep); gsub(" ", ".tgz ", bdep); } if (rdep != "") { gsub("$$", ".tgz", rdep); gsub(" ", ".tgz ", rdep); } print tmp[4] "-all: " me ".tgz"; print me ": " me ".tgz"; print me ".tgz: " bdep " " rdep; printf("\t@/var/portbuild/scripts/pdispatch ${branch} /var/portbuild/scripts/portbuild %s.tgz %s", me, here); if (bdep != "") printf(" %s", bdep); if (rdep != "") printf(" %s", rdep); printf("\n")}' < ${.CURDIR}/INDEX
 
 CVS?= cvs
 .if defined(SUPHOST)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->portmgr 
Responsible-Changed-By: trevor 
Responsible-Changed-When: Mon Aug 27 12:06:29 PDT 2001 
Responsible-Changed-Why:  
to maintainer 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30099 
State-Changed-From-To: open->closed 
State-Changed-By: will 
State-Changed-When: Sun Dec 23 02:58:45 PST 2001 
State-Changed-Why:  
Fixed, thanks. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30099 
>Unformatted:
