Bug 259639 - ports-mgmt/poudriere{-devel}: databases/ruby-bdb fails to build with USE_TMPFS=NO in poudriere.conf: chmod: $file: Operation not permitted
Summary: ports-mgmt/poudriere{-devel}: databases/ruby-bdb fails to build with USE_TMPF...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Bryan Drewery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-04 08:46 UTC by Yasuhiro Kimura
Modified: 2025-01-17 20:40 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback? (bdrewery)
koobs: maintainer-feedback? (ruby)


Attachments
Poudriere.conf used to build databases/ruby-bdb (11.98 KB, text/plain)
2021-11-04 08:46 UTC, Yasuhiro Kimura
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yasuhiro Kimura freebsd_committer freebsd_triage 2021-11-04 08:46:27 UTC
Created attachment 229262 [details]
Poudriere.conf used to build databases/ruby-bdb

Host: 13.0-RELEASE amd64, ZFS root
Poudriere: 3.3.99.20211017_2
Ports tree: ports aea6528e3c40 (main branch)

Build of databases/ruby-bdb fails as following if I set USE_TMPFS to 'no' in poudriere.conf.

----------------------------------------------------------------------
=======================<phase: stage          >============================
===== env: DEVELOPER_MODE=yes STRICT_DEPENDS=yes USER=nobody UID=65534 GID=65534
===>  Staging for ruby27-bdb-0.6.6_8
===>   ruby27-bdb-0.6.6_8 depends on file: /usr/local/bin/ruby27 - found
===>   Generating temporary packing list
/usr/bin/install -c -m 0755 bdb.so /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/lib/ruby/site_ruby/2.7/amd64-freebsd13
/usr/bin/strip /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/lib/ruby/site_ruby/2.7/amd64-freebsd13/bdb.so/bin/mkdir -p /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby27/bdb/doc
(cd /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6 && install  -m 0644 Changes README.en bdb.rd docs/*.rd /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby27/bdb)
(cd /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc && /bin/sh -c '(/usr/bin/find -Ed $1 $3 | /usr/bin/cpio -dumpl $2 >/dev/null 2>&1) &&  /usr/bin/find -Ed $1 $3 \(   -type d -exec /bin/sh -c '\''cd '\''$2'\'' && chmod 755 "$@"'\'' . {} +  -o -type f -exec /bin/sh -c '\''cd '\''$2'\'' && chmod 0644 "$@"'\'' . {} + \)' COPYTREE_SHARE . /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby27/bdb/doc)
chmod: ./css/rdoc.css: Operation not permitted
chmod: ./css/fonts.css: Operation not permitted
chmod: ./js/search.js: Operation not permitted
chmod: ./js/darkfish.js: Operation not permitted
chmod: ./images/date.png: Operation not permitted
chmod: ./images/loadingAnimation.gif: Operation not permitted
chmod: ./images/brick.png: Operation not permitted
chmod: ./images/package.png: Operation not permitted
chmod: ./images/brick_link.png: Operation not permitted
chmod: ./images/ruby.png: Operation not permitted
chmod: ./images/bullet_toggle_plus.png: Operation not permitted
chmod: ./images/wrench_orange.png: Operation not permitted
chmod: ./images/find.png: Operation not permitted
chmod: ./images/delete.png: Operation not permitted
chmod: ./images/arrow_up.png: Operation not permitted
chmod: ./images/add.png: Operation not permitted
chmod: ./images/page_white_width.png: Operation not permitted
chmod: ./images/zoom.png: Operation not permitted
chmod: ./images/plugin.png: Operation not permitted
chmod: ./images/bullet_black.png: Operation not permitted
chmod: ./images/transparent.png: Operation not permitted
chmod: ./images/page_green.png: Operation not permitted
chmod: ./images/tag_green.png: Operation not permitted
chmod: ./images/bug.png: Operation not permitted
chmod: ./images/wrench.png: Operation not permitted
chmod: ./images/bullet_toggle_minus.png: Operation not permitted
chmod: ./images/tag_blue.png: Operation not permitted
chmod: ./images/page_white_text.png: Operation not permitted
chmod: ./images/macFFBgHack.png: Operation not permitted
chmod: ./fonts/Lato-Light.ttf: Operation not permitted
chmod: ./fonts/SourceCodePro-Regular.ttf: Operation not permitted
chmod: ./fonts/SourceCodePro-Bold.ttf: Operation not permitted
chmod: ./fonts/Lato-Regular.ttf: Operation not permitted
chmod: ./fonts/Lato-LightItalic.ttf: Operation not permitted
chmod: ./fonts/Lato-RegularItalic.ttf: Operation not permitted
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/ruby-bdb
build of databases/ruby-bdb | ruby27-bdb-0.6.6_8 ended at Thu Nov  4 17:28:06 JST 2021
build time: 00:00:36
!!! build failure encountered !!!
----------------------------------------------------------------------

Full build log: https://www.utahime.org/FreeBSD/poudriere/data/logs/bulk/130amd64-default/2021-11-04_17h27m25s/logs/ruby27-bdb-0.6.6_8.log

If I change USE_TMPFS to 'yes', then build of databases/ruby-bdb succeeds.

The problem also happens with ports-mgmt/poudriere (3.3.7).
Comment 1 Bryan Drewery freebsd_committer freebsd_triage 2021-11-04 17:01:14 UTC
I'm not sure why tmpfs is relevant here but I doubt this is a Poudriere-specific problem persay, and is more likely a build-as-non-root issue with the port.

===== env: DEVELOPER_MODE=yes STRICT_DEPENDS=yes USER=nobody UID=65534 GID=65534

I bet the files with EPERM errors are not owned by this uid.
Comment 2 Yasuhiro Kimura freebsd_committer freebsd_triage 2021-11-04 17:50:00 UTC
(In reply to Bryan Drewery from comment #1)

I saved working directory with `poudriere testport -w` and checked owner of files in question. Then they are owned by root. Next I added 'BUILD_AS_NON_ROOT=no' to poudriere.conf and tried test build. Then build completed successfully. So it is correct that this is build-as-non-root issue.

But I wonder why these files are owned by root. There is following target in databases/ruby-bdb/Makefile

--------------------------------------------------------------------------------
post-install-DOCS-on:
        ${MKDIR} ${STAGEDIR}${DOCSDIR}/doc
        (cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${STAGEDIR}${DOCSDIR})
        (cd ${WRKSRC}/docs/doc && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/doc)
--------------------------------------------------------------------------------

And the error happens with last line.

If I understand correctly staging phase is done with UID=65534 and GID=65534. And each line of above target is also executed with same UID and GID.

Then why files in question are copied to staging area as owned by root?
Comment 3 Tatsuki Makino 2021-11-06 01:16:32 UTC
I can't reproduce it on my poudriere.

Outputs that may be relevant:

building for: FreeBSD src-default-job-01 12.3-STABLE FreeBSD 12.3-STABLE 1203500 amd64
Poudriere version: 3.3.7_1
Host OSVERSION: 1203500
Jail OSVERSION: 1203500

[00:00:29] Will build as nobody: (65534:65534)

NO_ZFS=yes
BASEFS=/usr/local/poudriere
USE_TMPFS=no

/dev/ada0s1a on / (ufs, local, soft-updates)
 ︙
/dev/ada0s1f on /usr (ufs, local, soft-updates)
Comment 4 Yasuhiro Kimura freebsd_committer freebsd_triage 2021-11-06 22:57:18 UTC
(In reply to Tatsuki Makino from comment #3)

I made clean install of 13.0-RELEASE amd64 with UFS and confirmed the error doesn't happen. So the problem seems to be specific to ZFS.
Comment 5 Tatsuki Makino 2021-11-15 04:02:04 UTC
It use the commands we get when we run the following commands.

make -C /usr/ports/databases/ruby-bdb/ -V COPYTREE_BIN -V COPYTREE_SHARE

As you can see the result, all the output of cpio is discarded to /dev/null.
It may have contained an important message from cpio.

For example, yesterday...
I had set /am/paths_containing_symlink.../tmp/ports/work to WRKDIRPREFIX.
www/chromium uses ${COPYTREE_SHARE}, but chmod encountered an error that the files do not exist.
I was searching for 2 hours to find the reason why the file was not copied, but it was something I could notice in an instant if I had the cpio output.

0.531267769 write(2,"cpio: ",6)                  = 6 (0x6)
0.531284321 write(2,"Cannot extract through symlink /"...,191) = 191 (0xbf)
0.531299822 write(2,"\n",1)                      = 1 (0x1)