Subject: Re: pkgtools/x11-links permissions
To: Jonathan Perkin <jonathan@perkin.org.uk>
From: Ian D. Leroux <ian_leroux@fastmail.fm>
List: tech-pkg
Date: 02/02/2005 08:05:25
On Tue, Feb 01, 2005 at 02:01:18PM +0000, Jonathan Perkin wrote:
> * On 2005-02-01 at 13:53 GMT, Ian D. Leroux wrote:
> 
> > That was my original thought, but it's since been pointed out that
> > there are problems with that.  The INSTALL_*_DIR macros create
> > directories owned by ${BINOWN}, ${SHAREOWN}, ${GAMEOWN} ... So you'd
> > end up with stuff owned by root in the build tree, so the
> > unprivileged user doing the build can no longer "make clean".
> 
> People who do unprivileged builds always set those variables to their
> local user, else loads of stuff breaks.  This should probably be
> documented somewhere, however :-)

Well at least it'll be documented in the list archives; and I'll think
about putting it some place more obvious.  How should I be setting those
variables so that they're unprivileged during the build but back to
default during the install?  I can understand manually giving different
values for the two phases, but that gets in the way of being able to do

cd /usr/pkgsrc/foo/bar ; make install

and having the just-in-time su mechanism kick in at the right moment.
In the meantime, I've appended a patche to address the concern
about mkdirs that don't support -m using explicit chmods (tested).

Cheers,

Ian Leroux


--- Makefile.orig	2005-01-31 20:16:33.000000000 -0500
+++ Makefile.fixed	2005-02-01 19:31:32.000000000 -0500
@@ -53,11 +53,14 @@
 
 do-build:
 	${MKDIR} ${X11_LINKS_BUILD_DIR}
+	${CHMOD} ${PKGDIRMODE} ${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;		\
+			${CHMOD} ${PKGDIRMODE}				\
+				${X11_LINKS_BUILD_DIR}/$$dir;		\
 			${ECHO} "@dirrm ${X11_LINKS_SUBDIR}/$$dir"	\
 				>> ${PLIST_SRC.dirs};			\
 		fi;							\