Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Oct 2005 11:28:50 -0700 (PDT)
From:      Bill Fenner <fenner@research.att.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/87396: Fix bsd.port.mk variable quoting issues
Message-ID:  <200510131828.j9DISoEw044963@mango.attlabs.att.com>
Resent-Message-ID: <200510131830.j9DIUHus037600@freefall.freebsd.org>

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

>Number:         87396
>Category:       ports
>Synopsis:       Fix bsd.port.mk variable quoting issues
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 13 18:30:16 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Bill Fenner
>Release:        FreeBSD 5.3-BETA2 i386
>Organization:
AT&T Labs - Research
>Environment:
System: FreeBSD rtg.ietf.org 5.3-BETA2 FreeBSD 5.3-BETA2 #0: Wed Sep 1 23:03:21 PDT 2004 root@newrtg.attlabs.att.com:/usr/obj/usr/src/sys/RTG i386


	
>Description:
	
When a variable like BROKEN or DEPRECATED has shell metacharacters,
it needs a certain amount of quoting.  That amount varies by
variable; e.g., BROKEN="hello (parenthesis)" but
DEPRECATED=""hello (parenthesis)"" or DEPRECATED=hello (parenthesis) .

>How-To-Repeat:
	

Run "make check-status" with a port Makefile with

BROKEN=()|[]<>

or

DEPRECATED="()|[]<>"

>Fix:

	

Use ${___:Q} to call ${ECHO_MSG} for IGNORE, DEPRECATED and NO_PACKAGE.
This means that make takes care of quoting, so no quoting is necessary
either in the Makefile or on the command line.  Affected variables
include:

BROKEN
FORBIDDEN
IGNORE
MANUAL_PACKAGE_BUILD
NO_CDROM
NO_PACKAGE
RESTRICTED

- Tested with "make check-sanity" on the whole ports tree.

- Also tested with a custom BROKEN=>/etc/passwd `rm -rf *`
  which echoed just as written, and BROKEN=(shell) |meta| [chars]

- Also happens to improve the behavior of java/jdk13 - when it set
  FORBIDDEN, since printf got multiple args it would say things like

fenestro% make WITH_PLUGIN=YES check-sanity
printf: missing format character
===>  jdk-1.3.1p9_5 is*** Error code 1

Stop in /big/bsd-port-mk-quoting/ports/java/jdk13.

  but with this patch it prints a message with no trailing eol:

fenestro% make WITH_PLUGIN=YES check-sanity
===>  jdk-1.3.1p9_5 is forbidden: Vulnerabilities in the browser plugin.fenestro% 

  which seems much better from a usability standpoint.


NOTE that with this patch, some ports will echo messages like
foo-1.2.3 is broken: "here is the reason"

However, this is just cosmetic - there is no combination of quoting
and metacharacters that will cause the build to fail, unlike the
existing delicate situation.

Index: bsd.autotools.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.autotools.mk,v
retrieving revision 1.14
diff -u -r1.14 bsd.autotools.mk
--- bsd.autotools.mk	2 Jul 2005 05:02:24 -0000	1.14
+++ bsd.autotools.mk	12 Oct 2005 21:14:29 -0000
@@ -76,7 +76,7 @@
 #
 .if ${USE_AUTOTOOLS_COMPAT}!=""
 . if defined(USE_AUTOTOOLS)
-BROKEN+=	"Mix and match of old and new autotools system prohibited"
+BROKEN+=	Mix and match of old and new autotools system prohibited
 . else
 USE_AUTOTOOLS=	${USE_AUTOTOOLS_COMPAT}
 . endif
@@ -156,7 +156,7 @@
 # Make sure we specified a legal version of automake
 #
 . if !exists(${PORTSDIR}/devel/automake${AUTOMAKE_VERSION}/Makefile)
-BROKEN+=	"Unknown AUTOMAKE version: ${AUTOMAKE_VERSION}"
+BROKEN+=	Unknown AUTOMAKE version: ${AUTOMAKE_VERSION}
 . endif
 
 # Set up the automake environment
@@ -202,7 +202,7 @@
 # Make sure we specified a legal version of autoconf
 #
 . if !exists(${PORTSDIR}/devel/autoconf${AUTOCONF_VERSION}/Makefile)
-BROKEN+=	"Unknown AUTOCONF version: ${AUTOCONF_VERSION}"
+BROKEN+=	Unknown AUTOCONF version: ${AUTOCONF_VERSION}
 . endif
 
 # Set up the autoconf/autoheader environment
@@ -250,7 +250,7 @@
 # Make sure we specified a legal version of libtool
 #
 . if !exists(${PORTSDIR}/devel/libtool${LIBTOOL_VERSION}/Makefile)
-BROKEN+=	"Unknown LIBTOOL version: ${LIBTOOL_VERSION}"
+BROKEN+=	Unknown LIBTOOL version: ${LIBTOOL_VERSION}
 . endif
 
 # Set up the libtool environment
Index: bsd.gcc.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.gcc.mk,v
retrieving revision 1.5
diff -u -r1.5 bsd.gcc.mk
--- bsd.gcc.mk	31 Jul 2005 17:07:23 -0000	1.5
+++ bsd.gcc.mk	12 Oct 2005 21:13:49 -0000
@@ -77,7 +77,7 @@
 .endfor
 
 .if !defined(_GCCVERSION_OKAY)
-BROKEN=	"Unknown version of GCC specified (USE_GCC=${USE_GCC})"
+BROKEN=	Unknown version of GCC specified (USE_GCC=${USE_GCC})
 .endif
 
 #
@@ -93,7 +93,7 @@
 . endif
 .endfor
 .if !defined(_GCCVERSION)
-BROKEN=		"Couldn't find your current GCCVERSION (OSVERSION=${OSVERSION})"
+BROKEN=		Couldn't find your current GCCVERSION (OSVERSION=${OSVERSION})
 .endif
 
 #
Index: bsd.gnome.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.gnome.mk,v
retrieving revision 1.96
diff -u -r1.96 bsd.gnome.mk
--- bsd.gnome.mk	21 May 2005 19:51:41 -0000	1.96
+++ bsd.gnome.mk	12 Oct 2005 21:13:49 -0000
@@ -596,7 +596,7 @@
 .         endif
 .      endif
 .  if ${_USE_GNOME_ALL:M${component}}==""
-BROKEN=	"Unknown component ${component}"
+BROKEN=	Unknown component ${component}
 .  endif
 _USE_GNOME+=	${${component}_USE_GNOME_IMPL} ${component}
 . endfor
Index: bsd.gstreamer.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.gstreamer.mk,v
retrieving revision 1.12
diff -u -r1.12 bsd.gstreamer.mk
--- bsd.gstreamer.mk	15 Sep 2005 20:22:08 -0000	1.12
+++ bsd.gstreamer.mk	12 Oct 2005 21:13:49 -0000
@@ -237,7 +237,7 @@
 RUN_DEPENDS+=   ${_GST_LIB_BASE}/libgst${ext}.so:${PORTSDIR}/${${ext}_DEPENDS}
 .  endif
 . else
-BROKEN=	"Unknown gstreamer-plugin -- ${ext}"
+BROKEN=	Unknown gstreamer-plugin -- ${ext}
 . endif
 .endfor
 
Index: bsd.kde.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.kde.mk,v
retrieving revision 1.51
diff -u -r1.51 bsd.kde.mk
--- bsd.kde.mk	31 Jul 2005 22:46:04 -0000	1.51
+++ bsd.kde.mk	12 Oct 2005 21:14:12 -0000
@@ -77,7 +77,7 @@
 USE_QT_VER=		3
 PREFIX=			${KDE_PREFIX}
 .else
-BROKEN=			"Unknown value in USE_KDELIBS_VER"
+BROKEN=			Unknown value in USE_KDELIBS_VER
 .endif # ${USE_KDELIBS_VER} == 3
 .endif # defined(USE_KDELIBS_VER)
 
@@ -142,7 +142,7 @@
 CONFIGURE_ENV+=	MOC="${MOC}" CPPFLAGS="${CPPFLAGS} ${QTCPPFLAGS}" LIBS="${QTCFGLIBS}"
 .endif # !defined(QT_NONSTANDARD)
 .else
-BROKEN="Unsupported value of USE_QT_VER"
+BROKEN=Unsupported value of USE_QT_VER
 .endif # defined(USE_QT_VER)
 
 # End of USE_QT_VER section
Index: bsd.php.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.php.mk,v
retrieving revision 1.17
diff -u -r1.17 bsd.php.mk
--- bsd.php.mk	8 Sep 2005 08:34:40 -0000	1.17
+++ bsd.php.mk	12 Oct 2005 21:13:49 -0000
@@ -68,7 +68,7 @@
 .if defined(BROKEN_WITH_PHP)
 .	for VER in ${BROKEN_WITH_PHP}
 .		if ${PHP_VER} == "${VER}"
-BROKEN=		"Doesn't work with PHP version : ${PHP_VER} (Doesn't support PHP ${BROKEN_WITH_PHP})"
+BROKEN=		Doesn't work with PHP version : ${PHP_VER} (Doesn't support PHP ${BROKEN_WITH_PHP})
 .		endif
 .	endfor
 .endif
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.517
diff -u -r1.517 bsd.port.mk
--- bsd.port.mk	15 Sep 2005 12:24:33 -0000	1.517
+++ bsd.port.mk	12 Oct 2005 21:13:49 -0000
@@ -1154,7 +1154,7 @@
 
 .if defined(PORTVERSION)
 .if ${PORTVERSION:M*[-_,]*}x != x
-BROKEN=			"PORTVERSION ${PORTVERSION} may not contain '-' '_' or ','"
+BROKEN=			PORTVERSION ${PORTVERSION} may not contain '-' '_' or ','
 .endif
 DISTVERSION?=	${PORTVERSION:S/:/::/g}
 .elif defined(DISTVERSION)
@@ -1484,7 +1484,7 @@
 .elif ${WANT_OPENLDAP_VER} == 23
 LIB_DEPENDS+=		ldap-2.3.1:${PORTSDIR}/net/openldap23${_OPENLDAP_FLAVOUR}-client
 .else
-BROKEN=				"unknown OpenLDAP version: ${WANT_OPENLDAP_VER}"
+BROKEN=				unknown OpenLDAP version: ${WANT_OPENLDAP_VER}
 .endif
 .endif
 
@@ -1494,7 +1494,7 @@
 .elif ${WANT_FAM_SYSTEM} == gamin
 LIB_DEPENDS+=	fam.0:${PORTSDIR}/devel/gamin
 .else
-BROKEN=			"unknown FAM system: ${WANT_FAM_SYSTEM}"
+BROKEN=			unknown FAM system: ${WANT_FAM_SYSTEM}
 .endif
 .endif
 
@@ -1770,7 +1770,7 @@
 .endif # BROKEN_WITH_MYSQL
 LIB_DEPENDS+=	mysqlclient.${MYSQL${MYSQL_VER}_LIBVER}:${PORTSDIR}/databases/mysql${MYSQL_VER}-client
 .else
-BROKEN=		"unknown MySQL version: ${MYSQL_VER}"
+BROKEN=		unknown MySQL version: ${MYSQL_VER}
 .endif # Check for correct libs
 .endif # USE_MYSQL
 
@@ -1786,7 +1786,7 @@
 .endif
 
 .if defined(WANT_PGSQL_VER) && defined(_PGSQL_VER) && ${WANT_PGSQL_VER} != ${_PGSQL_VER}
-IGNORE=		"The port wants postgresql${WANT_PGSQL_VER}-client but you have postgresql${_PGSQL_VER}-client installed"
+IGNORE=		The port wants postgresql${WANT_PGSQL_VER}-client but you have postgresql${_PGSQL_VER}-client installed
 .endif
 
 .if defined(_PGSQL_VER)
@@ -1802,13 +1802,13 @@
 .if defined(BROKEN_WITH_PGSQL)
 .	for VER in ${BROKEN_WITH_PGSQL}
 .		if (${PGSQL_VER} == "${VER}")
-IGNORE=		"Does not work with postgresql${PGSQL_VER}-client PostgresSQL \(${BROKEN_WITH_PGSQL} not supported\)"
+IGNORE=		Does not work with postgresql${PGSQL_VER}-client PostgresSQL \(${BROKEN_WITH_PGSQL} not supported\)
 .		endif
 .	endfor
 .endif # BROKEN_WITH_PGSQL
 LIB_DEPENDS+=	pq.${PGSQL${PGSQL_VER}_LIBVER}:${PORTSDIR}/databases/postgresql${PGSQL_VER}-client
 .else
-BROKEN=		"unknown PostgreSQL version: ${PGSQL_VER}"
+BROKEN=		unknown PostgreSQL version: ${PGSQL_VER}
 .endif # Check for correct version
 CPPFLAGS+=		-I${LOCALBASE}/include
 LDFLAGS+=		-L${LOCALBASE}/lib
@@ -2825,7 +2825,7 @@
 
 .if ${OSVERSION} < 420000
 # You need an upgrade kit or make world newer than this
-IGNORE=	": Your system is too old to use this bsd.port.mk.  You need a fresh make world or an upgrade kit.  Please go to http://www.FreeBSD.org/ports/ or a mirror site and follow the instructions"
+IGNORE=	: Your system is too old to use this bsd.port.mk.  You need a fresh make world or an upgrade kit.  Please go to http://www.FreeBSD.org/ports/ or a mirror site and follow the instructions
 .endif
 
 .if defined(ONLY_FOR_ARCHS)
@@ -2848,32 +2848,32 @@
 
 .if !defined(__ARCH_OK)
 .if defined(ONLY_FOR_ARCHS)
-IGNORE=		"is only for ${ONLY_FOR_ARCHS},"
+IGNORE=		is only for ${ONLY_FOR_ARCHS},
 .else # defined(NOT_FOR_ARCHS)
-IGNORE=		"does not run on ${NOT_FOR_ARCHS},"
+IGNORE=		does not run on ${NOT_FOR_ARCHS},
 .endif
-IGNORE+=	"and you are running ${ARCH}"
+IGNORE+=	and you are running ${ARCH}
 .endif
 
 .if !defined(NO_IGNORE)
 .if (defined(IS_INTERACTIVE) && defined(BATCH))
-IGNORE=	"is an interactive port"
+IGNORE=	is an interactive port
 .elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
-IGNORE=	"is not an interactive port"
+IGNORE=	is not an interactive port
 .elif (defined(NO_CDROM) && defined(FOR_CDROM))
-IGNORE=	"may not be placed on a CDROM: ${NO_CDROM}"
+IGNORE=	may not be placed on a CDROM: ${NO_CDROM}
 .elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
-IGNORE=	"is restricted: ${RESTRICTED}"
+IGNORE=	is restricted: ${RESTRICTED}
 .elif defined(BROKEN)
 .if !defined(TRYBROKEN)
-IGNORE=	"is marked as broken: ${BROKEN}"
+IGNORE=	is marked as broken: ${BROKEN}
 .endif
 .elif defined(FORBIDDEN)
-IGNORE=	"is forbidden: ${FORBIDDEN}"
+IGNORE=	is forbidden: ${FORBIDDEN}
 .endif
 
 .if (defined(MANUAL_PACKAGE_BUILD) && defined(PACKAGE_BUILDING) && !defined(PARALLEL_PACKAGE_BUILD))
-IGNORE=	"has to be built manually: ${MANUAL_PACKAGE_BUILD}"
+IGNORE=	has to be built manually: ${MANUAL_PACKAGE_BUILD}
 clean:
 	@${IGNORECMD}
 .endif
@@ -2882,7 +2882,7 @@
 .if defined(IGNORE_SILENT)
 IGNORECMD=	${DO_NADA}
 .else
-IGNORECMD=	${ECHO_MSG} "===>  ${PKGNAME} ${IGNORE}."
+IGNORECMD=	${ECHO_MSG} "===>  ${PKGNAME} "${IGNORE:Q}.
 .endif
 
 .for target in check-sanity fetch checksum extract patch configure all build install reinstall package
@@ -3005,7 +3005,7 @@
 .if defined(IGNORE_SILENT)
 	@${DO_NADA}
 .else
-	@${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
+	@${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: "${NO_PACKAGE:Q}.
 .endif
 .endif
 
@@ -3062,7 +3062,7 @@
 	@${ECHO_MSG}
 	@${ECHO_MSG} "This port is deprecated; you may wish to reconsider installing it:"
 	@${ECHO_MSG}
-	@${ECHO_MSG} "${DEPRECATED}."
+	@${ECHO_MSG} ${DEPRECATED:Q}.
 	@${ECHO_MSG}
 .if defined(EXPIRATION_DATE)
 	@${ECHO_MSG} "It is scheduled to be removed on or after ${EXPIRATION_DATE}."
Index: bsd.port.subdir.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.subdir.mk,v
retrieving revision 1.60
diff -u -r1.60 bsd.port.subdir.mk
--- bsd.port.subdir.mk	28 Feb 2005 21:09:04 -0000	1.60
+++ bsd.port.subdir.mk	12 Oct 2005 21:13:49 -0000
@@ -89,6 +89,7 @@
 
 TARGETS+=	all
 TARGETS+=	build
+TARGETS+=	check-sanity
 TARGETS+=	checksum
 TARGETS+=	clean
 TARGETS+=	clean-for-cdrom
Index: bsd.ruby.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.ruby.mk,v
retrieving revision 1.144
diff -u -r1.144 bsd.ruby.mk
--- bsd.ruby.mk	5 Jun 2005 23:29:11 -0000	1.144
+++ bsd.ruby.mk	12 Oct 2005 21:14:53 -0000
@@ -114,12 +114,12 @@
 
 .if defined(RUBY)
 .if !exists(${RUBY})
-BROKEN=	"You set the variable RUBY to \"${RUBY}\", but it does not seem to exist.  Please specify an already installed ruby executable."
+BROKEN=	You set the variable RUBY to "${RUBY}", but it does not seem to exist.  Please specify an already installed ruby executable.
 .endif
 
 _RUBY_TEST!=		${RUBY} -e 'begin; require "rbconfig"; rescue LoadError; puts "error"; end'
 .if !empty(_RUBY_TEST)
-BROKEN=	"You set the variable RUBY to \"${RUBY}\", but it failed to include rbconfig.  Please specify a properly installed ruby executable."
+BROKEN=	You set the variable RUBY to "${RUBY}", but it failed to include rbconfig.  Please specify a properly installed ruby executable.
 .endif
 
 _RUBY_CONFIG=		${RUBY} -r rbconfig -e 'C = Config::CONFIG' -e
@@ -143,7 +143,7 @@
 RUBY_WRKSRC=		${WRKDIR}/ruby-${RUBY_VERSION}
 #MASTER_SITE_SUBDIR_RUBY=	snapshots
 .elif defined(RUBY_VER) && ${RUBY_VER} == 1.7
-BROKEN=	"Ruby 1.7 is obsolete; set RUBY_VER to 1.8 instead."
+BROKEN=	Ruby 1.7 is obsolete; set RUBY_VER to 1.8 instead.
 .else
 RUBY_VERSION?=		1.6.8
 RUBY_DISTVERSION?=	${RUBY_VERSION}-2004.07.28
Index: bsd.sdl.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.sdl.mk,v
retrieving revision 1.8
diff -u -r1.8 bsd.sdl.mk
--- bsd.sdl.mk	9 Jan 2005 10:12:07 -0000	1.8
+++ bsd.sdl.mk	12 Oct 2005 21:13:49 -0000
@@ -145,7 +145,7 @@
 _USE_SDL=
 .for component in ${USE_SDL}
 . if ${_USE_SDL_ALL:M${component}}==""
-BROKEN=	"Unknown SDL component ${component}"
+BROKEN=	Unknown SDL component ${component}
 . endif
 _USE_SDL+=	${_REQUIRES_${component}} ${component}
 .endfor
>Release-Note:
>Audit-Trail:
>Unformatted:



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