ports/113425: [PATCH] bsd.port.mk: make COPYTREE_* work under plain user
Dmitry Marakasov
amdmi3 at amdmi3.ru
Wed Jun 6 17:50:09 UTC 2007
>Number: 113425
>Category: ports
>Synopsis: [PATCH] bsd.port.mk: make COPYTREE_* work under plain user
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 06 17:50:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Dmitry Marakasov
>Release: FreeBSD 6.1-RELEASE-p12 i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 6.1-RELEASE-p12 FreeBSD 6.1-RELEASE-p12 #0: Tue Jan 16 23:12:21 MSK 2007 amdmi3 at hades.panopticon:/usr/obj/usr/src/sys/HADES i386
>Description:
When using ports as a plain user (not root), INSTALL_* macros don't try to change ownership of installed files, but COPYTREE_* macros do, so an attempt to install a port that uses COPYTREE_* macros under non-root will fail.
The patch attached fixes this by adding alternative COPYTREE_* macros to be used when running as non-root.
Also COPYTREE_* macros are moved closer to INSTALL_, where they do logically belong.
>How-To-Repeat:
Try to install any port that uses COPYTREE_* macros as a plain user.
>Fix:
--- bsd.port.mk.patch begins here ---
--- bsd.port.mk.orig Wed Jun 6 21:29:52 2007
+++ bsd.port.mk Wed Jun 6 21:32:28 2007
@@ -2201,18 +2201,6 @@
REINPLACE_ARGS?= -i.bak
REINPLACE_CMD?= ${SED} ${REINPLACE_ARGS}
-# Macro for coping entire directory tree with correct permissions
-COPYTREE_BIN= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \
- 2>&1) && \
- ${CHOWN} -R ${BINOWN}:${BINGRP} $$1 && \
- ${FIND} $$1 -type d -exec chmod 755 {} \; && \
- ${FIND} $$1 -type f -exec chmod ${BINMODE} {} \;' --
-COPYTREE_SHARE= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \
- 2>&1) && \
- ${CHOWN} -R ${SHAREOWN}:${SHAREGRP} $$1 && \
- ${FIND} $$1/ -type d -exec chmod 755 {} \; && \
- ${FIND} $$1/ -type f -exec chmod ${SHAREMODE} {} \;' --
-
# Names of cookies used to skip already completed stages
EXTRACT_COOKIE?= ${WRKDIR}/.extract_done.${PORTNAME}.${PREFIX:S/\//_/g}
CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done.${PORTNAME}.${PREFIX:S/\//_/g}
@@ -2380,6 +2368,29 @@
BSD_INSTALL_MAN="${INSTALL_MAN}"
MAKE_ENV+= ${INSTALL_MACROS}
SCRIPTS_ENV+= ${INSTALL_MACROS}
+
+# Macro for coping entire directory tree with correct permissions
+.if ${UID} == 0
+COPYTREE_BIN= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \
+ 2>&1) && \
+ ${CHOWN} -R ${BINOWN}:${BINGRP} $$1 && \
+ ${FIND} $$1 -type d -exec chmod 755 {} \; && \
+ ${FIND} $$1 -type f -exec chmod ${BINMODE} {} \;' --
+COPYTREE_SHARE= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \
+ 2>&1) && \
+ ${CHOWN} -R ${SHAREOWN}:${SHAREGRP} $$1 && \
+ ${FIND} $$1/ -type d -exec chmod 755 {} \; && \
+ ${FIND} $$1/ -type f -exec chmod ${SHAREMODE} {} \;' --
+.else
+COPYTREE_BIN= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \
+ 2>&1) && \
+ ${FIND} $$1 -type d -exec chmod 755 {} \; && \
+ ${FIND} $$1 -type f -exec chmod ${BINMODE} {} \;' --
+COPYTREE_SHARE= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \
+ 2>&1) && \
+ ${FIND} $$1/ -type d -exec chmod 755 {} \; && \
+ ${FIND} $$1/ -type f -exec chmod ${SHAREMODE} {} \;' --
+.endif
# The user can override the NO_PACKAGE by specifying this from
# the make command line
--- bsd.port.mk.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list