| Summary: | databases/ruby-bdb: Allow poudriere run with BUILD_AS_NON_ROOT=yes on ZFS | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Ports & Packages | Reporter: | Fukang Chen <loader> | ||||||||||||||||||
| Component: | Individual Port(s) | Assignee: | Akinori MUSHA <knu> | ||||||||||||||||||
| Status: | Closed Overcome By Events | ||||||||||||||||||||
| Severity: | Affects Only Me | CC: | bdrewery, koobs, loader, mat, swills | ||||||||||||||||||
| Priority: | --- | Keywords: | needs-qa | ||||||||||||||||||
| Version: | Latest | Flags: | bugzilla:
maintainer-feedback?
(knu) koobs: merge-quarterly? |
||||||||||||||||||
| Hardware: | Any | ||||||||||||||||||||
| OS: | Any | ||||||||||||||||||||
| URL: | https://reviews.freebsd.org/D15425 | ||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||
|
Description
Fukang Chen
2018-05-06 12:48:45 UTC
Created attachment 193088 [details]
patch
@Fukang Thanks for the detailed bug report and patch.
For patches to ports with maintainers (who are not you), could you in addition to creating Bugzilla issues (which is needed for approving with maintainer timeout if necessary), please create a review in Phabricator with a proposed commit log and QA confirmation notes as we have previously done and include that review in the issue's URL field.
I believe this change is/can be considered Approved by: portmgr (infrastructure compliance blanket)
CC'ing swills@ for opinion/question on other (ruby) ports using "rdoc + ${COPYTREE_SHARE}", for which modifying bsd.port.mk COPYSHARE_TREE may be valuable. If that's the preferred path, the change should probably be exp-run'd.
Thanks Kubilay. :) Sure, I will create a review in Phabricator when I figure out how to run the unit tests. # ruby24 tests/recnum.rb VERSION of BDB is Berkeley DB 5.3.28: (September 9, 2013) Loaded suite tests/recnum Started /usr/ports/databases/ruby-bdb/work/bdb-0.6.6/src/bdb.so: Undefined symbol "RCLASS_M_TBL" Created attachment 193388 [details]
make regression
Created attachment 193389 [details]
make test
Patch here should be updated to match the review, or removed (obsoleted) in favour of the review code. Consider however: maintainer cant approve here if there's no patch (and must accept in phabricator) Created attachment 193414 [details]
patch v2
(In reply to Fukang Chen from comment #0) > % stat -f '%Sp %Su:%Sg %N' docs/doc/css/ > drwxr-xr-x nobody:wheel docs/doc/css/ > > % stat -f '%Sp %Su:%Sg %N' docs/doc/css/*.css > -rw-r--r-- root:wheel docs/doc/css/fonts.css > -rw-r--r-- root:wheel docs/doc/css/rdoc.css I cannot reproduce this: root@11amd64-ports:/wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6 # stat -f '%Sp %Su:%Sg %N' docs/doc/css/ drwxr-xr-x nobody:wheel docs/doc/css/ root@11amd64-ports:/wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6 # root@11amd64-ports:/wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6 # stat -f '%Sp %Su:%Sg %N' docs/doc/css/*.css -rw-r--r-- nobody:wheel docs/doc/css/fonts.css -rw-r--r-- nobody:wheel docs/doc/css/rdoc.css how did you manage to get those files extracted as with the root user? The only thing that is done as root is fetching, extracting is done as a user, so it cannot produces files owned by root. (In reply to Mathieu Arnold from comment #8) Have you tried to set USE_TMPFS=no in poudriere.conf, I think wrkdirs is on tmpfs by default. tmpfs worked for me too. Created attachment 193425 [details]
ruby24-bdb-0.6.6_5.log (USE_TMPFS=yes)
Created attachment 193426 [details]
ruby24-bdb-0.6.6_5.log (USE_TMPFS=no)
Created attachment 193427 [details]
ruby24-bdb-0.6.6_5.log (USE_TMPFS=yes)
rdoc tries to create hard links using FileUtils.ln (line 564) if it's failed then copy the file using FileUtils.cp (line 570) https://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v2_4_4/lib/rdoc/generator/darkfish.rb?revision=63013&view=markup#l557 557 def install_rdoc_static_file source, destination, options # :nodoc: 558 return unless source.exist? 559 560 begin 561 FileUtils.mkdir_p File.dirname(destination), options 562 563 begin 564 FileUtils.ln source, destination, options 565 rescue Errno::EEXIST 566 FileUtils.rm destination 567 retry 568 end 569 rescue 570 FileUtils.cp source, destination, options 571 end 572 end I just rebuild databases/ruby-bdb with the rdoc -D option ($DEBUG_RDOC): --- extconf.rb.orig 2011-04-06 19:35:39 UTC +++ extconf.rb @@ -50,7 +50,7 @@ SUBDIRS = #{subdirs.join(' ')} rdoc: docs/doc/index.html docs/doc/index.html: $(RDOC) -\t@-(cd docs; rdoc .) +\t@-(cd docs; ${RUBY_RDOC} -D .) ri: \t@-(rdoc -r docs/*rb) When USE_TMPFS=no, both source and target files are within the same filesytems, ln worked and hard links preserve the ownership of these files (root:wheel): Generating Darkfish format into /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc... Copying static files mkdir -p ./css ln /usr/local/lib/ruby/2.4/rdoc/generator/template/darkfish/css/fonts.css ./css/fonts.css mkdir -p ./fonts When USE_TMPFS=yes, the wrkdirs direcotry is on tmpfs, hard link doesn't work these files were copied to ${WRKSRC}/docs/doc/ and they have new ownership (nobody:wheel): Generating Darkfish format into /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc... Copying static files mkdir -p ./css ln /usr/local/lib/ruby/2.4/rdoc/generator/template/darkfish/css/fonts.css ./css/fonts.css cp /usr/local/lib/ruby/2.4/rdoc/generator/template/darkfish/css/fonts.css ./css/fonts.css mkdir -p ./fonts Mmmm, this looks like a poudriere bug to me.
With my usual USE_TMPFS, I get:
root@11amd64-ports:~ # find /wrkdirs/ -name jquery.js -exec ls -l {} +
-rw-r--r-- 2 nobody wheel 91669 May 16 10:23 /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc/js/jquery.js
-rw-r--r-- 2 nobody wheel 91669 May 16 10:23 /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby24/bdb/doc/js/jquery.js
With USE_TMPFS=no, I get:
root@11amd64-ports:~ # find /wrkdirs/ -name jquery.js -exec ls -l {} +
-rw-r--r-- 3 root wheel 91669 Sep 5 2014 /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc/js/jquery.js
-rw-r--r-- 3 root wheel 91669 Sep 5 2014 /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby24/bdb/doc/js/jquery.js
I don't understand why one uses the normal nobody and the other has root.
(In reply to Mathieu Arnold from comment #14) > With my usual USE_TMPFS, I get: > > root@11amd64-ports:~ # find /wrkdirs/ -name jquery.js -exec ls -l {} + > -rw-r--r-- 2 nobody wheel 91669 May 16 10:23 /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc/js/jquery.js > -rw-r--r-- 2 nobody wheel 91669 May 16 10:23 /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby24/bdb/doc/js/jquery.js This file belongs to the port lang/ruby24, the ownership is root:wheel: /usr/local/lib/ruby/2.4/rdoc/generator/template/darkfish/js/jquery.js and it's located on ZFS, rdoc process (run as user nobody) tries to create a hard link for this file to /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc/js/jquery.js With USE_TMPFS=yes, /wrkdirs is on tmpfs, both source file and target file were not within the same filesystem, so hard link didn't work there, then the rdoc process (run as user nobody) created a copy of it, that's why the file owner is nobody. > With USE_TMPFS=no, I get: > > root@11amd64-ports:~ # find /wrkdirs/ -name jquery.js -exec ls -l {} + >-rw-r--r-- 3 root wheel 91669 Sep 5 2014 /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc/js/jquery.js >-rw-r--r-- 3 root wheel 91669 Sep 5 2014 /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby24/bdb/doc/js/jquery.js With USE_TMPFS=no, now both /usr/local/lib/ruby/2.4/rdoc/generator/template/darkfish/js/jquery.js and /wrkdirs/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc/js/jquery.js are on ZFS, the rdoc process (run as user nobody) created a hard link for this file, they have the same inode number and ownership, even the process was run by a normal user. and ${COPYTREE_SHARE} uses cpio -l, that's why it's also a hard link in the stage directory: /wrkdirs/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby24/bdb/doc/js/jquery.js Hope this helps. Okay, maybe we could try to explain it by compiling this port as a normal user,
my /usr/local and /tmp are on the same filesystem:
% id
uid=1001(loader) gid=1001(loader) groups=1001(loader)
% cd /usr/ports/databases/ruby-bdb
% make WRKDIRPREFIX=/tmp
... ... ...
... ... ...
% ls -il /usr/local/lib/ruby/2.4/rdoc/generator/template/darkfish/js/jquery.js \
$(make WRKDIRPREFIX=/tmp -V WRKSRC)/docs/doc/js/jquery.js \
$(make WRKDIRPREFIX=/tmp -V STAGEDIR)/usr/local/share/doc/ruby24/bdb/doc/js/jquery.js
1730459 -rw-r--r-- 3 root wheel 91669 Sep 5 2014 /tmp/usr/ports/databases/ruby-bdb/work/bdb-0.6.6/docs/doc/js/jquery.js
1730459 -rw-r--r-- 3 root wheel 91669 Sep 5 2014 /tmp/usr/ports/databases/ruby-bdb/work/stage/usr/local/share/doc/ruby24/bdb/doc/js/jquery.js
1730459 -rw-r--r-- 3 root wheel 91669 Sep 5 2014 /usr/local/lib/ruby/2.4/rdoc/generator/template/darkfish/js/jquery.js
They are hard links and have the same inode number.
|