Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Sep 2018 22:15:13 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338738 - head/share/mk
Message-ID:  <201809172215.w8HMFDMs052226@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Mon Sep 17 22:15:12 2018
New Revision: 338738
URL: https://svnweb.freebsd.org/changeset/base/338738

Log:
  DIRS: Rework how duplicated dirs are installed.
  
  - Warn if multiple DIRS have conflicting metadata
  - This fixes META_MODE writing to a very long .meta file that contained
    the full DESTDIR path.
  
  Reported by:	sjg, jonathan
  Sponsored by:	Dell EMC
  Approved by:	re (gjb)

Modified:
  head/share/mk/bsd.dirs.mk

Modified: head/share/mk/bsd.dirs.mk
==============================================================================
--- head/share/mk/bsd.dirs.mk	Mon Sep 17 22:15:09 2018	(r338737)
+++ head/share/mk/bsd.dirs.mk	Mon Sep 17 22:15:12 2018	(r338738)
@@ -27,18 +27,29 @@ ${dir}TAG_ARGS=	-T ${${dir}TAGS:[*]:S/ /,/g}
 .      endif
 
 installdirs: installdirs-${dir}
-
-installdirs-${dir}: installdirs-${DESTDIR}${${dir}}
-
-.      if !target(installdirs-${DESTDIR}${${dir}})
-installdirs-${DESTDIR}${${dir}}:
-	@${ECHO} installing DIRS ${dir}
+# Coalesce duplicate destdirs
+.      if !defined(_uniquedirs_${${dir}})
+_uniquedirs_${${dir}}=	${dir}
+_alldirs_${dir}=	${dir}
+installdirs-${dir}: .PHONY
+	@${ECHO} installing DIRS ${_alldirs_${dir}}
 	${INSTALL} ${${dir}TAG_ARGS} -d -m ${${dir}_MODE} -o ${${dir}_OWN} \
 		-g ${${dir}_GRP} ${${dir}_FLAG} ${DESTDIR}${${dir}}
-.      endif
-.    endif
-
-realinstall: installdirs-${dir}
+.      else
+_uniquedir:=		${_uniquedirs_${${dir}}}
+_alldirs_${_uniquedir}+=${dir}
+# Connect to the single target
+installdirs-${dir}: installdirs-${_uniquedir}
+# Validate that duplicate dirs have the same metadata.
+.        for v in TAG_ARGS _MODE _OWN _GRP _FLAG
+.          if ${${dir}${v}:Uunset} != ${${_uniquedir}${v}:Uunset}
+.            warning ${RELDIR}: ${dir}${v} (${${dir}${v}:U}) does not match ${_uniquedir}${v} (${${_uniquedir}${v}:U}) but both install to ${${dir}}
+.          endif
+.        endfor
+.      endif	# !defined(_uniquedirs_${${dir}})
+.    endif	# defined(${dir}) && !empty(${dir})
 .  endfor
+
+realinstall: installdirs
 
 .endif



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