svn commit: r452153 - head/Mk

Jilles Tjoelker jilles at FreeBSD.org
Sun Oct 15 15:30:21 UTC 2017


Author: jilles (src committer)
Date: Sun Oct 15 15:30:20 2017
New Revision: 452153
URL: https://svnweb.freebsd.org/changeset/ports/452153

Log:
  Make COPYTREE_* work with POSIX-compliant sh -c
  
  The COPYTREE_BIN and COPYTREE_SHARE macros use constructs like
  
  sh -c 'command' -- arg0 arg1
  
  and assume that $0 will expand to arg0 and $1 will expand to arg1.
  
  Our current sh implements it that way. However, POSIX specifies that $0 will
  expand to -- and $1 will expand to arg0, since the command string is an
  operand and not an option-argument. Bug #220587 requests making sh
  POSIX-compliant in this regard.
  
  If the argument after the command string does not start with '-', the
  current sh behaves as required by POSIX. Therefore, adjust the macros so
  this is always the case.
  
  PR:		222870
  Approved by:	portmgr (antoine)

Modified:
  head/Mk/bsd.port.mk

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Sun Oct 15 15:22:41 2017	(r452152)
+++ head/Mk/bsd.port.mk	Sun Oct 15 15:30:20 2017	(r452153)
@@ -2150,12 +2150,12 @@ SCRIPTS_ENV+=	${INSTALL_MACROS}
 # In the -exec shell commands, we add add a . as the first argument, it would
 # end up being $0 aka the script name, which is not part of $@, so we force it
 # to be able to use $@ directly.
-COPYTREE_BIN=	${SH} -c '(${FIND} -Ed $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null 2>&1) && \
-						   ${FIND} -Ed $$0 $$2 \(   -type d -exec ${SH} -c '\''cd '\''$$1'\'' && chmod 755 "$$@"'\'' -- . {} + \
-												 -o -type f -exec ${SH} -c '\''cd '\''$$1'\'' && chmod ${BINMODE} "$$@"'\'' -- . {} + \)' --
-COPYTREE_SHARE=	${SH} -c '(${FIND} -Ed $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null 2>&1) && \
-						   ${FIND} -Ed $$0 $$2 \(   -type d -exec ${SH} -c '\''cd '\''$$1'\'' && chmod 755 "$$@"'\'' -- . {} + \
-												 -o -type f -exec ${SH} -c '\''cd '\''$$1'\'' && chmod ${_SHAREMODE} "$$@"'\'' -- . {} + \)' --
+COPYTREE_BIN=	${SH} -c '(${FIND} -Ed $$1 $$3 | ${CPIO} -dumpl $$2 >/dev/null 2>&1) && \
+						   ${FIND} -Ed $$1 $$3 \(   -type d -exec ${SH} -c '\''cd '\''$$2'\'' && chmod 755 "$$@"'\'' . {} + \
+												 -o -type f -exec ${SH} -c '\''cd '\''$$2'\'' && chmod ${BINMODE} "$$@"'\'' . {} + \)' COPYTREE_BIN
+COPYTREE_SHARE=	${SH} -c '(${FIND} -Ed $$1 $$3 | ${CPIO} -dumpl $$2 >/dev/null 2>&1) && \
+						   ${FIND} -Ed $$1 $$3 \(   -type d -exec ${SH} -c '\''cd '\''$$2'\'' && chmod 755 "$$@"'\'' . {} + \
+												 -o -type f -exec ${SH} -c '\''cd '\''$$2'\'' && chmod ${_SHAREMODE} "$$@"'\'' . {} + \)' COPYTREE_SHARE
 
 # The user can override the NO_PACKAGE by specifying this from
 # the make command line


More information about the svn-ports-all mailing list