Subject: pkg/18541: parameters to 'env' are not properly quoted in www/mozilla/Makefile.common
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 10/05/2002 13:06:04
>Number:         18541
>Category:       pkg
>Synopsis:       parameters to 'env' are not properly quoted in www/mozilla/Makefile.common
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 05 10:07:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        pkgsrc-current 2002/10/04
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD 1.5W
Architecture: i386
Machine: i386
>Description:

	It's always a good idea to quote the command-line parameters to
	'env', and it's absolutely necessary when one of those
	parameters might contain a character in $IFS.

>How-To-Repeat:

	make the following correction to mk/defs.NetBSD.mk, which while
	not strictly necessary, it can help to avoid many weird bugs
	caused by strange environment settings, as well as identifying
	bugs caused by missing settings necessary for the invoked program
	
***************
*** 41,52 ****
  RM?=		/bin/rm
  RMDIR?=		/bin/rmdir
  SED?=		/usr/bin/sed
! SETENV?=	/usr/bin/env
  SH?=		/bin/sh
  SHLOCK=		/usr/bin/shlock
  SORT?=		/usr/bin/sort
--- 41,57 ----
  RM?=		/bin/rm
  RMDIR?=		/bin/rmdir
  SED?=		/usr/bin/sed
! SETENV?=	/usr/bin/env -i
  SH?=		/bin/sh
  SHLOCK=		/usr/bin/shlock
  SORT?=		/usr/bin/sort


	now try to install www/mozilla....

>Fix:

	There are probably lots of other places such quoting should be
	done, but this is the first major error-causing place I've
	encountered (I normally only install a few hundred packages at
	most).

	note the final change is "cosmetic" and helps prevent the user
	from thinking the install has hung on a "slow" machine....

Index: Makefile.common
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/www/mozilla/Makefile.common,v
retrieving revision 1.2
diff -c -c -r1.2 Makefile.common
*** Makefile.common	3 Oct 2002 16:08:13 -0000	1.2
--- Makefile.common	5 Oct 2002 16:03:25 -0000
***************
*** 62,81 ****
  .endif
  PLIST_SUBST+=	SO_SUFFIX=${SO_SUFFIX}
  
! SCRIPTS_ENV+=	OBJECT_FMT=${OBJECT_FMT}
! SCRIPTS_ENV+=	PLIST_SRC=${PLIST_SRC}
! SCRIPTS_ENV+=	SED=${SED}
! SCRIPTS_ENV+=	RM=${RM}
! SCRIPTS_ENV+=	EGREP=${EGREP}
! SCRIPTS_ENV+=	CHOWN=${CHOWN}
! SCRIPTS_ENV+=	CHGRP=${CHGRP}
! SCRIPTS_ENV+=	CHMOD=${CHMOD}
! SCRIPTS_ENV+=	BINOWN=${BINOWN}
! SCRIPTS_ENV+=	BINGRP=${BINGRP}
! SCRIPTS_ENV+=	BINMODE=${BINMODE}
! SCRIPTS_ENV+=	SETENV=${SETENV}
! SCRIPTS_ENV+=   MOZILLA=${MOZILLA}
! SCRIPTS_ENV+=	SO_SUFFIX=${SO_SUFFIX}
  
  PTHREAD_OPTS+=	native optional
  
--- 62,81 ----
  .endif
  PLIST_SUBST+=	SO_SUFFIX=${SO_SUFFIX}
  
! SCRIPTS_ENV+=	OBJECT_FMT="${OBJECT_FMT}"
! SCRIPTS_ENV+=	PLIST_SRC="${PLIST_SRC}"
! SCRIPTS_ENV+=	SED="${SED}"
! SCRIPTS_ENV+=	RM="${RM}"
! SCRIPTS_ENV+=	EGREP="${EGREP}"
! SCRIPTS_ENV+=	CHOWN="${CHOWN}"
! SCRIPTS_ENV+=	CHGRP="${CHGRP}"
! SCRIPTS_ENV+=	CHMOD="${CHMOD}"
! SCRIPTS_ENV+=	BINOWN="${BINOWN}"
! SCRIPTS_ENV+=	BINGRP="${BINGRP}"
! SCRIPTS_ENV+=	BINMODE="${BINMODE}"
! SCRIPTS_ENV+=	SETENV="${SETENV}"
! SCRIPTS_ENV+=   MOZILLA="${MOZILLA}"
! SCRIPTS_ENV+=	SO_SUFFIX="${SO_SUFFIX}"
  
  PTHREAD_OPTS+=	native optional
  
***************
*** 98,104 ****
  	${ECHO} locale,install,select,en-US >> ${WRKSRC}/dist/bin/chrome/installed-chrome.txt
  
  do-install:
! 	${SETENV} ${SCRIPTS_ENV} ${SH} ${FILESDIR}/moz-install
  
  .include "../../mk/pthread.buildlink2.mk"
  
--- 98,104 ----
  	${ECHO} locale,install,select,en-US >> ${WRKSRC}/dist/bin/chrome/installed-chrome.txt
  
  do-install:
! 	${SETENV} ${SCRIPTS_ENV} ${SH} -x ${FILESDIR}/moz-install
  
  .include "../../mk/pthread.buildlink2.mk"
  
>Release-Note:
>Audit-Trail:
>Unformatted: