Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 615212 - sys-apps/portage: properly support FreeBSD filesystem or filesystem mounted with grpid|bsdgroups with FEATURE="userpriv"
Summary: sys-apps/portage: properly support FreeBSD filesystem or filesystem mounted w...
Status: RESOLVED OBSOLETE
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-10 21:12 UTC by i.Dark_Templar
Modified: 2023-10-18 17:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
freebsd-uid-gid-install.patch (freebsd-uid-gid-install.patch,927 bytes, patch)
2017-04-10 21:16 UTC, i.Dark_Templar
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description i.Dark_Templar 2017-04-10 21:12:25 UTC
On UFS filesystem or EXT* filesystem mounted with option grpid or bsdgroups entries inherit group of parent directory, not current group of process. If such filesystem is used with FEATURE="userpriv" of portage, it may lead to installed files and directories being in group portage, if they're created via 'do*' or 'new*' portage helpers.

Reproducible: Always

Steps to Reproduce:
1. Use UFS filesystem on Gentoo/FreeBSD or ext* on Gentoo/Linux with option 'bsdgroups' for PORTAGE_TMPDIR
2. emerge -1 tcp-wrappers
3. ls -la /usr/share/doc/tcp-wrappers-*/
Actual Results:  
gentoo_freebsd ~ # ls -la /usr/share/doc/tcp-wrappers-7.6.22-r1/
total 96
drwxr-xr-x    2 root  wheel      512 Apr 10 23:55 .
drwxr-xr-x  104 root  wheel     3584 Apr 10 23:08 ..                                                                                                                                
-rw-r--r--    1 root  portage   1038 Apr 10 23:55 BLURB.bz2                                                                                                                         
-rw-r--r--    1 root  portage   7567 Apr 10 23:55 CHANGES.bz2                                                                                                                       
-rw-r--r--    1 root  portage    416 Apr 10 23:55 DISCLAIMER.bz2                                                                                                                    
-rw-r--r--    1 root  portage   1335 Apr 10 23:55 README.IRIX.bz2                                                                                                                   
-rw-r--r--    1 root  portage   2439 Apr 10 23:55 README.NIS.bz2                                                                                                                    
-rw-r--r--    1 root  portage  15567 Apr 10 23:55 README.bz2                       

Expected Results:  
gentoo_freebsd ~ # ls -la /usr/share/doc/tcp-wrappers-7.6.22-r1/
total 96
drwxr-xr-x    2 root  wheel      512 Apr 10 23:55 .
drwxr-xr-x  104 root  wheel     3584 Apr 10 23:08 ..                                                                                                                                
-rw-r--r--    1 root  wheel   1038 Apr 10 23:55 BLURB.bz2                                                                                                                         
-rw-r--r--    1 root  wheel   7567 Apr 10 23:55 CHANGES.bz2                                                                                                                       
-rw-r--r--    1 root  wheel    416 Apr 10 23:55 DISCLAIMER.bz2                                                                                                                    
-rw-r--r--    1 root  wheel   1335 Apr 10 23:55 README.IRIX.bz2                                                                                                                   
-rw-r--r--    1 root  wheel   2439 Apr 10 23:55 README.NIS.bz2                                                                                                                    
-rw-r--r--    1 root  wheel  15567 Apr 10 23:55 README.bz2                       

Here're steps to reproduce it on Gentoo/Linux box:
1. dd if=/dev/zero of=/tmp/tmpfs bs=1M count=100
2. mkfs.ext3 /tmp/tmpfs
3. mkdir /tmp/tmpfsmounted
4. mount /tmp/tmpfs /tmp/tmpfsmounted -o bsdgroups
5. FEATURES="userpriv" PORTAGE_TMPDIR=/tmp/tmpfsmounted/ ebuild /usr/portage/sys-apps/tcp-wrappers/tcp-wrappers-7.6.22-r1.ebuild install
6. ls -la /tmp/tmpfsmounted/portage/sys-apps/tcp-wrappers-7.6.22-r1/image/usr/share/doc/tcp-wrappers-*/
Comment 1 i.Dark_Templar 2017-04-10 21:16:02 UTC
Created attachment 469660 [details, diff]
freebsd-uid-gid-install.patch

This is a patch with proposed solution to fix this issue by fixing uid/gid of EROOT directory of install image, i.e. ${ED} or ${D}
Comment 2 Zac Medico gentoo-dev 2017-04-10 21:25:50 UTC
(In reply to i.Dark_Templar from comment #1)
> Created attachment 469660 [details, diff] [details, diff]
> freebsd-uid-gid-install.patch
> 
> This is a patch with proposed solution to fix this issue by fixing uid/gid
> of EROOT directory of install image, i.e. ${ED} or ${D}

Are the getent calls really necessary? I would think that this should work:]

   chown "${PORTAGE_INST_UID}:${PORTAGE_INST_GID}" "${_x}"
Comment 3 i.Dark_Templar 2017-04-10 21:40:42 UTC
chown command takes username/groupname both in form of name and in form of ID, and I preferred to get rid of this ambiguity in the patch. This possible issue aside, I think getent call may be omitted.