pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk mk/bsd.pkg.mk: prevent the WRKDIR path from contain...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/873fd2df3a41
branches:  trunk
changeset: 399922:873fd2df3a41
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Aug 18 21:58:51 2019 +0000

description:
mk/bsd.pkg.mk: prevent the WRKDIR path from containing symlinks

This is the same underlying issue as in bootstrap/bootstrap from
2019-05-01.

See https://mail-index.netbsd.org/pkgsrc-users/2019/08/18/msg029207.html

diffstat:

 mk/bsd.pkg.mk |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r 8e683b7f6b41 -r 873fd2df3a41 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Sun Aug 18 21:04:37 2019 +0000
+++ b/mk/bsd.pkg.mk     Sun Aug 18 21:58:51 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.2031 2018/05/28 20:37:47 rillig Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.2032 2019/08/18 21:58:51 rillig Exp $
 #
 # This file is in the public domain.
 #
@@ -573,7 +573,7 @@
 .endif
 
 .PHONY: makedirs
-makedirs: ${WRKDIR} ${FAKEHOMEDIR}
+makedirs: ${WRKDIR} ${FAKEHOMEDIR} _check-wrkdir-canonical
 
 ${WRKDIR}:
 .if !defined(KEEP_WRKDIR)
@@ -583,9 +583,23 @@
 .endif
        ${RUN} umask 077 && ${MKDIR} ${WRKDIR}
 
+# If the WRKDIR is not canonical (such as when it contains a symlink),
+# various packages such as databases/mysql57-client will not find their
+# include files. See also checkarg_sane_absolute_path in bootstrap/bootstrap.
+.PHONY: _check-wrkdir-canonical
+_check-wrkdir-canonical: ${WRKDIR}
+       ${RUN} cd ${WRKDIR}; d=`exec pwd`; ${TEST} "$$d" = ${WRKDIR}    \
+       || ${FAIL_MSG} "[bsd.pkg.mk] The path to WRKDIR ${WRKDIR} must be canonical ($$d)."
+
 # Create a symlink from ${WRKDIR} to the package directory if
 # CREATE_WRKDIR_SYMLINK is "yes".
 #
+# This symlink is not used by pkgsrc and is only created for convenience.
+# Most other pkgsrc pathnames must not contain symlinks, to prevent
+# spurious build failures (see checkarg_sane_absolute_path in
+# bootstrap/bootstrap).
+#
+# Keywords: work wrkdir symlink
 CREATE_WRKDIR_SYMLINK?=        no
 
 .if defined(WRKOBJDIR) && !empty(CREATE_WRKDIR_SYMLINK:M[Yy][Ee][Ss])



Home | Main Index | Thread Index | Old Index