Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 595908 - [Tracker] Many eclasses & ebuilds uses root instead of UID/GID 0
Summary: [Tracker] Many eclasses & ebuilds uses root instead of UID/GID 0
Status: IN_PROGRESS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Quality Assurance Team
URL:
Whiteboard:
Keywords: Tracker
Depends on:
Blocks:
 
Reported: 2016-10-02 10:21 UTC by Haelwenn (lanodan) Monnier
Modified: 2022-04-02 18:44 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Haelwenn (lanodan) Monnier 2016-10-02 10:21:31 UTC
Using root as a UID/GID for the superuser isn’t standard, the only standard for this is using UID/GID 0.

I found https://bugs.gentoo.org/show_bug.cgi?id=315807 when I grepped eclasses and I wonder why using root as UID and/or GID isn’t an error/warning in QA checks.

I modified few ebuild and eclasses in my overlay https://gitlab.com/lanodan/overlay/issues/3

Reproducible: Always

Steps to Reproduce:
1. Have a system where UID 0 / GID 0 isn’t root
2. Try to merge packages which uses root:root
Actual Results:  
Packages fails to build because root:root doesn’t exist.

Expected Results:  
Packages manages to build.

Use GID&UID 0 instead of root.
Comment 1 Mike Gilbert gentoo-dev 2016-10-02 13:25:25 UTC
Please file separate bugs. At a minimum, we would need one bug for each unique maintainer.
Comment 2 Mike Gilbert gentoo-dev 2016-10-02 13:26:59 UTC
Assigning this one to QA to decide if this is really a bug or not.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-10-02 13:41:31 UTC
Well, I've been fighting this in the past but I guess I didn't open a tracker. The bug I just linked tells what you can expect of Gentoo developers, though.
Comment 4 Haelwenn (lanodan) Monnier 2016-10-07 20:06:55 UTC
Oh well thanks gentoo for being a choice distro… :P
And I don’t think I’ll try discussing with people that doesn’t want to read standards and don’t seems like wanting to discuss. But well people can change.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-10-07 20:13:58 UTC
Just to be clear, I agree with you. Do you happen to have a standards ref I could use to pursue this at hand?
Comment 6 Ulrich Müller gentoo-dev 2022-03-26 08:24:31 UTC
(In reply to Michał Górny from comment #5)
> Just to be clear, I agree with you. Do you happen to have a standards ref I
> could use to pursue this at hand?

I don't think there is a standard. POSIX only says that UIDs are non-negative integers, and that -1 shall not be valid (which seems redundant). Otherwise, it doesn't say anything about specific UIDs or user names:
https://pubs.opengroup.org/onlinepubs/9699919799/

UID 0 is hardcoded in the Linux kernel and in coreutils, so I guess you'd have a hard time trying to use any other ID for the superuser. However, I don't see anything assuming that its name must be root.

The FHS mentions a root user, but not sure if that's supposed to be read as "root user" or as "root" user:
https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s14.html#ftn.idm236092633504
Comment 7 Ulrich Müller gentoo-dev 2022-03-26 08:49:31 UTC
Looks like these eclasses rely on the root name:

    cron.eclass
    fcaps.eclass
    qmail.eclass
    toolchain.eclass
    webapp.eclass
Comment 8 Ulrich Müller gentoo-dev 2022-03-26 08:54:34 UTC
For fcaps we have a patch, but it no longer applies:
https://gitlab.com/lanodan/overlay/-/commit/ca5680a61871c420d1d147e206f093636b055993
Comment 9 Haelwenn (lanodan) Monnier 2022-03-26 10:16:54 UTC
(In reply to Haelwenn (lanodan) Monnier from comment #4)
> Oh well thanks gentoo for being a choice distro… :P
> And I don’t think I’ll try discussing with people that doesn’t want to read
> standards and don’t seems like wanting to discuss. But well people can
> change.

Old but that tone was undeserved, sorry.  
I should have linked to the documentation, I think it was in the linux kernel docs rather than things like the FHS but it's been a lot of years since and I don't think I still have the notes I had.

Might try doing this experiment again and would focus more on upstreaming my commits rather than dumping them in my overlay.
Comment 10 Larry the Git Cow gentoo-dev 2022-03-28 19:48:01 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=255c3f853ffa896fb9dc65294fc40cee2682b558

commit 255c3f853ffa896fb9dc65294fc40cee2682b558
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-03-26 09:29:52 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-03-28 19:47:18 +0000

    webapp.eclass: Use UID 0 instead of root
    
    Bug: https://bugs.gentoo.org/595908
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eclass/webapp.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=367ba7457991d008b011eba0b06455276933bf7c

commit 367ba7457991d008b011eba0b06455276933bf7c
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-03-26 09:28:30 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-03-28 19:47:17 +0000

    toolchain.eclass: Use UID 0 instead of root
    
    Bug: https://bugs.gentoo.org/595908
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eclass/toolchain.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=12a54e0eeefa9f2d80cf7eb57b1736134acad7e8

commit 12a54e0eeefa9f2d80cf7eb57b1736134acad7e8
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-03-26 09:25:07 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-03-28 19:47:16 +0000

    qmail.eclass: Use UID 0 instead of root
    
    Bug: https://bugs.gentoo.org/595908
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eclass/qmail.eclass | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0295d66cf7cbc1b719c1325c1442f9404de2ba69

commit 0295d66cf7cbc1b719c1325c1442f9404de2ba69
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-03-26 09:22:52 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-03-28 19:47:16 +0000

    cron.eclass: Use UID 0 instead of root
    
    Bug: https://bugs.gentoo.org/595908
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eclass/cron.eclass | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83e510378a6ae9906da52b0c276319f87d490593

commit 83e510378a6ae9906da52b0c276319f87d490593
Author:     Haelwenn (lanodan) Monnier <contact@hacktivis.me>
AuthorDate: 2016-10-02 10:32:23 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-03-28 19:47:11 +0000

    fcaps.eclass: Use UID 0 instead of root
    
    Bug: https://bugs.gentoo.org/595908
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 eclass/fcaps.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 11 Ulrich Müller gentoo-dev 2022-03-28 19:51:44 UTC
Eclasses done.

For ebuilds, I think it makes sense to follow comment #1 and file individual bugs. This bug can be used as a tracker.