Thursday, March 26, 2020

Re: PORTS_PRIVSEP=Yes and doas install

Marc Espie <espie@nerim.net> wrote:
> Look I'll have to try and reproduce your issue, but basically we create
> lots of dirs with different ownership in "fix-permissions"
> _CACHE_REPO is missing in there, and it's very likely it's all that's
> actually needed.

I didn't think of it, it's even better! FWIW, looks fine to me.

pkgpath.mk still needs the modifications though, as it will keep
running `doas install` otherwise. If we don't care for
PACKAGE_REPOSITORY_MODE (tbh, I found out about the *_MODE vars after
having to take a look at this), _INSTALL_CACHE_REPO can be replaced
to just `:`.

Thanks for taking the time to look at this.

-Lucas


Index: infrastructure/mk/pkgpath.mk
===================================================================
RCS file: /home/cvs/ports/infrastructure/mk/pkgpath.mk,v
retrieving revision 1.83
diff -u -p -u -p -r1.83 pkgpath.mk
--- infrastructure/mk/pkgpath.mk 30 May 2019 17:23:46 -0000 1.83
+++ infrastructure/mk/pkgpath.mk 26 Mar 2020 00:15:11 -0000
@@ -141,7 +141,7 @@ _PREDIR = |${_PBUILD} tee >/dev/null
_PSUDO = ${SUDO}
_UPDATE_PLIST_SETUP=FAKE_TREE_OWNER=${BUILD_USER} \
PORTS_TREE_OWNER=$$(id -un) ${SUDO}
-_INSTALL_CACHE_REPO = ${SUDO} install -d -o ${FETCH_USER} -g $$(id -g ${FETCH_USER}) ${PACKAGE_REPOSITORY_MODE}
+_INSTALL_CACHE_REPO = ${_PFETCH} install -d ${PACKAGE_REPOSITORY_MODE}
.else
_PFETCH =
_PBUILD =

> Index: bsd.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> retrieving revision 1.1526
> diff -u -p -r1.1526 bsd.port.mk
> --- bsd.port.mk 24 Mar 2020 17:33:43 -0000 1.1526
> +++ bsd.port.mk 26 Mar 2020 14:37:42 -0000
> @@ -2056,7 +2056,9 @@ fix-permissions:
> else \
> install -o ${FETCH_USER} -g $$f -d ${DISTDIR}; \
> fi
> -. for d in ${LOCKDIR} ${PACKAGE_REPOSITORY} ${PLIST_REPOSITORY} ${WRKOBJDIR}
> +. for d in ${LOCKDIR} ${PACKAGE_REPOSITORY} \
> + ${PACKAGE_REPOSITORY}/${MACHINE_ARCH} \
> + ${PLIST_REPOSITORY} ${WRKOBJDIR}
> @b=`id -gn ${BUILD_USER}`; \
> echo "give $d to ${BUILD_USER}:$$b"; \
> if test -d $d; then \
> @@ -2065,6 +2067,13 @@ fix-permissions:
> install -o ${BUILD_USER} -g $$b -d $d; \
> fi
> . endfor
> + @f=`id -gn ${FETCH_USER}`; \
> + echo "give ${_CACHE_REPO} to ${FETCH_USER}:$$f"; \
> + if test -d ${_CACHE_REPO}; then \
> + cd ${_CACHE_REPO} && chown -R ${FETCH_USER}:$$f .; \
> + else \
> + install -o ${FETCH_USER} -g $$f -d $${_CACHE_REPO}; \
> + fi
> .endif
>
> .for _S in ${MULTI_PACKAGES}

No comments:

Post a Comment