On Thu, Oct 13, 2016 at 02:48:07AM +0200, Theo Buehler wrote:
> On Wed, Oct 12, 2016 at 10:30:26PM +0200, Theo Buehler wrote:
> > Several people noticed that a few files from libstdc++-v3 in /usr/obj
> > end up being owned by root, namely:
> >
> > c++config.h gthr.h gthr-single.h gthr-posix.h gthr-tpf.h gthr-default.h
> >
> > The problem is that they are regenerated by root when beforeinstall does
> > 'make includes' directly from /usr/src/includes. A cheap fix is to call
> > make includes from the main Makefile, which was already fixed to
> > de-escalate the prereq step.
> >
> > Fixing that directly in gnu/lib/libstdc++-v3/Makefile would also be
> > possible, but it seems to be quite a bit messier since one would have to
> > touch quite a few targets to do the proper de-escalation.
> >
> > With that, /usr/obj contains no root-owned files after 'make build'.
> >
>
> Here's an improved version of the patch that doesn't interrupt
> 'make release' by asking for BUILDUSER's password because of trying
> to do 'sh -c ${BUILDUSER}' as BUILDUSER.
>
> Index: Makefile
> ===================================================================
> RCS file: /var/cvs/src/Makefile,v
> retrieving revision 1.129
> diff -u -p -r1.129 Makefile
> --- Makefile 6 Oct 2016 18:56:17 -0000 1.129
> +++ Makefile 13 Oct 2016 00:19:13 -0000
> @@ -57,7 +57,11 @@ includes:
> beforeinstall:
> cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} distrib-dirs
> cd ${.CURDIR}/etc && exec ${MAKE} DESTDIR=${DESTDIR} install-mtree
> - cd ${.CURDIR}/include && exec ${MAKE} includes
> + @if [[ `id -u` -ne 0 ]]; then \
> + cd ${.CURDIR}/include && exec ${MAKE} includes; \
> + else \
> + exec ${MAKE} includes; \
> + fi
I think that should be
exec ${MAKE} includes
with the conditional in the 'includes' target. Like this (untested):
includes:
cd ${.CURDIR}/include && \
if [[ `id -u` -eq 0 ]]; then \
su ${BUILDUSER} -c 'exec ${MAKE} prereq'; \
else \
exec ${MAKE} prereq; \
fi && \
exec ${MAKE} includes
That way 'prereq' is always run, also when started as unprivileged user,
and the 'includes' target can be started as BUILDUSER when DESTDIR is
pointing inside a noperm FS.
>
> afterinstall:
> .ifndef NOMAN
>