Subject: Re: pkgtools/x11-links permissions
To: Todd Vierling <tv@duh.org>
From: Ian D. Leroux <ian_leroux@fastmail.fm>
List: tech-pkg
Date: 01/31/2005 20:27:42
On Mon, Jan 31, 2005 at 12:06:20PM -0500, Todd Vierling wrote:
> Be careful: directories should not be owned by root in the work directory at
> "make clean" time.

Understood.  I've tried the simple-minded solution of setting the
-m 755 flag on calls to ${MKDIR}, leaving the ${PAX} -rwpp call
unchanged.  This creates the directory under work/ with world-readable
permissions but owned by the user doing the build.  The ${PAX} -rwpp
preserves those permissions when installing to /usr/pkg/share but
switches the owner to root.  Patch appended.

This seems to work ok: no root-owned files in the build directory
(make clean as an unprivileged user works fine), and the resulting
tree allows me to build x11 packages as an unprivileged user (I
tried wm/ratpoison.  My good taste is not yet sufficiently developed
to be sure whether this is a solution or a hack.  Comments?

Ian Leroux

--- Makefile.orig	2005-01-31 20:16:33.000000000 -0500
+++ Makefile	2005-01-31 17:51:18.000000000 -0500
@@ -52,12 +52,12 @@
 CREATE_X11LINK?=	${LN} -fs $$src $$dest
 
 do-build:
-	${MKDIR} ${X11_LINKS_BUILD_DIR}
+	${MKDIR} -m 755 ${X11_LINKS_BUILD_DIR}
 	${RM} -f ${PLIST_SRC.dirs}
 	${FILES_LIST_CMD} | ${SED} -e "s,/[^/]*$$,," | ${SORT} -u |	\
 	while read dir; do						\
 		if [ -d ${X11BASE}/$$dir ]; then			\
-			${MKDIR} ${X11_LINKS_BUILD_DIR}/$$dir;		\
+			${MKDIR} -m 755 ${X11_LINKS_BUILD_DIR}/$$dir;	\
 			${ECHO} "@dirrm ${X11_LINKS_SUBDIR}/$$dir"	\
 				>> ${PLIST_SRC.dirs};			\
 		fi;							\