Hi, I can't build devel/gitlab-shell 14.35.0 in 14_0:x86:64 poudriere jail. I guess it's due to building as non-root. Previous versions were fine with this. Here's log excerpt: =======================<phase: extract-depends>============================ ===== env: USE_PACKAGE_DEPENDS_ONLY=1 USER=root UID=0 GID=0 =========================================================================== =======================<phase: extract >============================ ===== env: NO_DEPENDS=yes USER=nobody UID=65534 GID=65534 ===> License MIT accepted by the user ===> Fetching all distfiles required by gitlab-shell-14.35.0 for building Copy go.mod as go mod download will modify it, which breaks checksum check cp: go.mod.orig: Permission denied *** Error code 1
The last fix was necessary as go is modifing the go.mod file while downloadig packages and therefor I make a copy of the go.mod file and restore it, after go finished the download of all modules, to not break the checksum of the file. It seems that this is impossible while running as user. I do not plan to find a workaround for this case. Building as root is fine and that is also how the FreeBSD build system is creating the packages. But if you would like to provide with a patch that fixes the problem, I will merge it. Make sure you remove all distfiles, before you test your patch.
Created attachment 250487 [details] build log Any idea why copying and restoring occurs in checksum and extract phases as well, besides fetch phase? If I understand correctly, copying should occur at the start of fetch phase, and restoring at the end of fetch phase, no need to repeat it in later phases. I am attaching full log.
Created attachment 250665 [details] Build log Dear Matthias, as I can see, the user 'nobody' is something belongs to build and installation process and I can't influence it. My poudriere runs as root and I don't have any other users on my server, that's why I can't agree that building as root has no problems. My log is the same as Marko's (see full log attached). Tell me, please, if I'm doing something wrong and there's the best way to build this port. Best wishes, Anton. # get https://proxy.golang.org/sigs.k8s.io/yaml/@v/v1.3.0.zip # get https://proxy.golang.org/rsc.io/sampler/@v/v1.3.0.zip: 200 OK (1.235s) # get https://proxy.golang.org/sigs.k8s.io/json/@v/v0.0.0-20221116044647-bc3834ca7abd.zip: 200 OK (1.481s) # get https://proxy.golang.org/sigs.k8s.io/yaml/@v/v1.3.0.zip: 200 OK (1.225s) # get https://proxy.golang.org/sigs.k8s.io/structured-merge-diff/v4/@v/v4.3.0.zip: 200 OK (1.622s) Restore previous go.mod =========================================================================== =======================<phase: checksum >============================ ===== env: NO_DEPENDS=yes USER=root UID=0 GID=0 ===> License MIT accepted by the user ===> Fetching all distfiles required by gitlab-shell-14.35.0_1 for building Copy go.mod as go mod download will modify it, which breaks checksum check ===> Fetching dependencies Restore previous go.mod => SHA256 Checksum OK for go/devel_gitlab-shell/gitlab-shell-v14.35.0/go.mod. => SHA256 Checksum OK for go/devel_gitlab-shell/gitlab-shell-v14.35.0/gitlab-shell-v14.35.0.tar.bz2. =========================================================================== =======================<phase: extract-depends>============================ ===== env: USE_PACKAGE_DEPENDS_ONLY=1 USER=root UID=0 GID=0 =========================================================================== =======================<phase: extract >============================ ===== env: NO_DEPENDS=yes USER=nobody UID=65534 GID=65534 ===> License MIT accepted by the user ===> Fetching all distfiles required by gitlab-shell-14.35.0_1 for building Copy go.mod as go mod download will modify it, which breaks checksum check cp: go.mod.orig: Permission denied *** Error code 1 Stop. make: stopped in /usr/ports/devel/gitlab-shell =>> Cleaning up wrkdir ===> Cleaning for gitlab-shell-14.35.0_1 build of devel/gitlab-shell | gitlab-shell-14.35.0_1 ended at Wed May 15 00:11:25 MSK 2024 build time: 00:03:08 !!! build failure encountered !!!
Search for config option PORTBUILD_USER in /usr/local/etc/poudriere.conf and set PORTBUILD_USER=root. Does it build successfully with this option changed?
Dear Johannes, thank you, that was made it built successfully!
Hi, of 1743 ports I am currently building in poudriere, devel/gitlab-shell is the only one that won't build as non-root. Maintainting gitlab instance on FreeBSD has always been painful to me. I can only imagine what herculean effort Matthias needs to put in in order to maintain the port, officially unsupported by upstream, with few hundred rubygem dependencies that must be at exact versions, quite a number of them additionally patched. For now, my newly set up www/forgejo instance seem to meet all my expectations, with much less hassle to set up and maintain. I'll continue to try building gilab, hopefully one day it will build as non-root again, as all the other ports I know of do.
Created attachment 250677 [details] an ugly patch to allow to build gitlab-shell as non-root user This is an example patch to avoid executing the workaround repeatedly, although I don't know it is acceptable usage of DISTDIR or not. With this patch, poudriere fetches distfiles as root and does not attempt to write to DISTDIR as non root user.
Created attachment 250685 [details] an ugly patch to allow to build gitlab-shell as non-root user
(In reply to Yasuhito FUTATSUKI from comment #8) Thanks a lot, I will test it and if it is fine, I will commit the patch.
I did some tests and the `.go-post-fetch-done` will not get removed with a `make distclean` which maybe can cause some other problems. But I think I will commit it, so users that are building as non-root can create the package again.
(In reply to Matthias Fechner from comment #10) We can insert extra target before delete-distfiles target to remove extra files like: @@ -81,4 +84,13 @@ post-install: ${SED} -E -e '/sample$$/ s#^#@sample #; \ s#${DATADIR_REL}/bin#@(,,555) ${DATADIR_REL}/bin#; ' >> ${TMPPLIST} -.include <bsd.port.mk> +go-pre-delete-distfiles: + @if [ -e ${DISTDIR}/${DIST_SUBDIR}/.go-post-fetch-done ]; then\ + ${RM} ${DISTDIR}/${DIST_SUBDIR}/.go-post-fetch-done || ${TRUE};\ + fi + +.include <bsd.port.pre.mk> + +delete-distfiles: go-pre-delete-distfiles + +.include <bsd.port.post.mk>
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=3c8fd2ac242ab03120b5d7eb4a02f84d346a0475 commit 3c8fd2ac242ab03120b5d7eb4a02f84d346a0475 Author: Yasuhito FUTATSUKI <freebsd-bug-report-yf@yf.bsdclub.org> AuthorDate: 2024-05-16 11:19:29 +0000 Commit: Matthias Fechner <mfechner@FreeBSD.org> CommitDate: 2024-05-17 06:42:56 +0000 devel/gitlab-shell: fix build as non-root user in poudriere PR: 278710 devel/gitlab-shell/Makefile | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
(In reply to Yasuhito FUTATSUKI from comment #11) Thanks a lot. I committed this fix.
A commit in branch 2024Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=c0d940d81130b3847fb4a997b491c7542c4e4b62 commit c0d940d81130b3847fb4a997b491c7542c4e4b62 Author: Yasuhito FUTATSUKI <freebsd-bug-report-yf@yf.bsdclub.org> AuthorDate: 2024-05-16 11:19:29 +0000 Commit: Matthias Fechner <mfechner@FreeBSD.org> CommitDate: 2024-05-21 12:59:11 +0000 devel/gitlab-shell: fix build as non-root user in poudriere PR: 278710 (cherry picked from commit 3c8fd2ac242ab03120b5d7eb4a02f84d346a0475) devel/gitlab-shell/Makefile | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)