From matthias.andree@gmx.de  Mon May  2 08:05:41 2005
Return-Path: <matthias.andree@gmx.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 65C7C16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  2 May 2005 08:05:41 +0000 (GMT)
Received: from unimail.uni-dortmund.de (mx1.HRZ.Uni-Dortmund.DE [129.217.128.51])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4D59543D45
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  2 May 2005 08:05:40 +0000 (GMT)
	(envelope-from matthias.andree@gmx.de)
Received: from m2a2.myip.org (u3qlglfhwsi28yjc@p50913BB6.dip.t-dialin.net [80.145.59.182])
	(authenticated bits=0)
	by unimail.uni-dortmund.de (8.13.3/8.13.3) with ESMTP id j4285Owh009308
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 2 May 2005 10:05:29 +0200 (CEST)
Received: by merlin.emma.line.org (Postfix, from userid 1001)
	id C97571B205; Mon,  2 May 2005 10:05:22 +0200 (CEST)
Message-Id: <20050502080522.C97571B205@merlin.emma.line.org>
Date: Mon,  2 May 2005 10:05:22 +0200 (CEST)
From: Matthias Andree <matthias.andree@gmx.de>
Reply-To: Matthias Andree <matthias.andree@gmx.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: PORTDOCS: shell glob "*" causes test command error
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         80528
>Category:       ports
>Synopsis:       PORTDOCS: shell glob "*" causes test command error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 02 08:10:03 GMT 2005
>Closed-Date:    Thu Jun 02 04:16:51 GMT 2005
>Last-Modified:  Thu Jun 02 04:16:51 GMT 2005
>Originator:     Matthias Andree
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD merlin.emma.line.org 5.4-STABLE FreeBSD 5.4-STABLE #28: Sun Apr 24 10:56:21 CEST 2005 toor@merlin.emma.line.org:/usr/src/sys/i386/compile/MA5 i386


	
>Description:
Using a shell glob in PORTDOCS in a port's Makefile (for instance
PORTDOCS=*) causes an error, example:

[: /usr/local/share/doc/leafnode/ADD-ONS: unexpected operator

The context is, for news/leafnode, using "make -dl install":

if /usr/bin/egrep -qe '^@cw?d' /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp &&  [ "`/usr/bin/sed -En -e '/^@cw?d[     ]*/s,,,p' /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp | /usr/bin/tail -n 1`" != "/usr/local" ]; then
 echo "@cwd /usr/local" >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp;  fi
if [ ! -e /usr/local/share/doc/leafnode/* ]; then  @echo /usr/local/share/doc/leafnode/* |  /usr/bin/sed -e 's,^/usr/local/,,' >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp;  fi
[: /usr/local/share/doc/leafnode/ADD-ONS: unexpected operator
/usr/bin/find -P /usr/local/share/doc/leafnode/* ! -type d 2>/dev/null |  /usr/bin/sed -ne 's,^/usr/local/,,p' >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp
/usr/bin/find -P -d /usr/local/share/doc/leafnode/* -type d 2>/dev/null |  /usr/bin/sed -ne 's,^/usr/local/,@dirrm ,p' >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp

Replacing the wildcard by an explicit file lists makes this error disappear,
but /usr/ports/Mk/bsd.ports.mk is documented as

"# PORTDOCS      - A list of files and directories relative to DOCSDIR.
 #                 Shell glob patterns can be used, directories include
 #                 the entire subtree of contained files and directories. ..."

allowing globs.

	
>How-To-Repeat:
cd /usr/ports/news/leafnode
make install

Note: leafnode uses PORTDOCS= *
	
>Fix:
change /usr/ports/Mk/bsd.port.mk so it Does The Right Thing[tm] :-)
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: tobez 
Responsible-Changed-When: Mon May 2 10:34:45 CEST 2005 
Responsible-Changed-Why:  
Portmgr territory. 

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

From: Anton Berezin <tobez@tobez.org>
To: Matthias Andree <matthias.andree@gmx.de>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/80528: PORTDOCS: shell glob "*" causes test command error
Date: Mon, 2 May 2005 10:34:33 +0200

 On Mon, May 02, 2005 at 10:05:22AM +0200, Matthias Andree wrote:
 
 > Using a shell glob in PORTDOCS in a port's Makefile (for instance
 > PORTDOCS=*) causes an error, example:
 > 
 > [: /usr/local/share/doc/leafnode/ADD-ONS: unexpected operator
 > 
 > The context is, for news/leafnode, using "make -dl install":
 > 
 > if /usr/bin/egrep -qe '^@cw?d' /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp &&  [ "`/usr/bin/sed -En -e '/^@cw?d[     ]*/s,,,p' /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp | /usr/bin/tail -n 1`" != "/usr/local" ]; then
 >  echo "@cwd /usr/local" >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp;  fi
 > if [ ! -e /usr/local/share/doc/leafnode/* ]; then  @echo /usr/local/share/doc/leafnode/* |  /usr/bin/sed -e 's,^/usr/local/,,' >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp;  fi
 > [: /usr/local/share/doc/leafnode/ADD-ONS: unexpected operator
 > /usr/bin/find -P /usr/local/share/doc/leafnode/* ! -type d 2>/dev/null |  /usr/bin/sed -ne 's,^/usr/local/,,p' >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp
 > /usr/bin/find -P -d /usr/local/share/doc/leafnode/* -type d 2>/dev/null |  /usr/bin/sed -ne 's,^/usr/local/,@dirrm ,p' >> /var/tmp/usr/ports/news/leafnode/work/.PLIST.mktmp
 > 
 > Replacing the wildcard by an explicit file lists makes this error disappear,
 > but /usr/ports/Mk/bsd.ports.mk is documented as
 > 
 > "# PORTDOCS      - A list of files and directories relative to DOCSDIR.
 >  #                 Shell glob patterns can be used, directories include
 >  #                 the entire subtree of contained files and directories. ..."
 > 
 > allowing globs.
 
 This patch should fix the problem (replacing make's .for with shell's
 for):
 
 Index: bsd.port.mk
 ===================================================================
 RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
 retrieving revision 1.511
 diff -u -r1.511 bsd.port.mk
 --- bsd.port.mk	17 Mar 2005 23:22:07 -0000	1.511
 +++ bsd.port.mk	2 May 2005 08:33:16 -0000
 @@ -4803,12 +4803,12 @@
  		[ "`${SED} -En -e '/^@cw?d[ 	]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \
  		${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \
  	fi
 -.for x in ${PORTDOCS}
 -	@if [ ! -e ${DOCSDIR}/${x} ]; then \
 -		@${ECHO_CMD} ${DOCSDIR}/${x} | \
 -			${SED} -e 's,^${PREFIX}/,,' >> ${TMPPLIST}; \
 -	fi
 -.endfor
 +	@for x in ${PORTDOCS}; do \
 +		if [ ! -e ${DOCSDIR}/${x} ]; then \
 +			${ECHO_CMD} ${DOCSDIR}/${x} | \
 +				${SED} -e 's,^${PREFIX}/,,' >> ${TMPPLIST}; \
 +		fi; \
 +	done
  	@${FIND} -P ${PORTDOCS:S/^/${DOCSDIR}\//} ! -type d 2>/dev/null | \
  		${SED} -ne 's,^${PREFIX}/,,p' >> ${TMPPLIST}
  	@${FIND} -P -d ${PORTDOCS:S/^/${DOCSDIR}\//} -type d 2>/dev/null | \
 
 Cheers,
 \Anton.
 -- 
 The moronity of the universe is a monotonically increasing function. --
 Jarkko Hietaniemi

From: Matthias Andree <matthias.andree@gmx.de>
To: Anton Berezin <tobez@tobez.org>,
	Matthias Andree <matthias.andree@gmx.de>,
	FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/80528: PORTDOCS: shell glob "*" causes test command error
Date: Mon, 2 May 2005 12:08:46 +0200

 Anton Berezin schrieb am 2005-05-02:
 
 > Index: bsd.port.mk
 > ===================================================================
 > RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
 > retrieving revision 1.511
 > diff -u -r1.511 bsd.port.mk
 > --- bsd.port.mk	17 Mar 2005 23:22:07 -0000	1.511
 > +++ bsd.port.mk	2 May 2005 08:33:16 -0000
 > @@ -4803,12 +4803,12 @@
 >  		[ "`${SED} -En -e '/^@cw?d[ 	]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \
 >  		${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \
 >  	fi
 > -.for x in ${PORTDOCS}
 > -	@if [ ! -e ${DOCSDIR}/${x} ]; then \
 > -		@${ECHO_CMD} ${DOCSDIR}/${x} | \
 > -			${SED} -e 's,^${PREFIX}/,,' >> ${TMPPLIST}; \
 > -	fi
 > -.endfor
 > +	@for x in ${PORTDOCS}; do \
 > +		if [ ! -e ${DOCSDIR}/${x} ]; then \
 
 Besides that, the glob is expanded in the port's directory, not DOCSDIR,
 so PORTDOCS=* would AFAICT without testing on FreeBSD now (not near a
 FreeBSD machine) add the wrong files after it's been patched like this,
 such as Makefile, pkg-plist, pkg-message, pkg-descr and so on.
 
 > +			${ECHO_CMD} ${DOCSDIR}/${x} | \
 > +				${SED} -e 's,^${PREFIX}/,,' >> ${TMPPLIST}; \
 > +		fi; \
 > +	done
 
 -- 
 Matthias Andree
State-Changed-From-To: open->analyzed 
State-Changed-By: kris 
State-Changed-When: Wed Jun 1 19:39:04 GMT 2005 
State-Changed-Why:  
This seems to duplicate ports/77820 and ports/80023.  Can you look at 
those ports and suggest whether yours provides a better fix, or should 
be closed? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80528 
State-Changed-From-To: analyzed->closed 
State-Changed-By: kris 
State-Changed-When: Thu Jun 2 04:16:31 GMT 2005 
State-Changed-Why:  
Duplicate of 77820 

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