Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 498394

Summary: user.eclass: add support for user/group for systems w/out getent
Product: Gentoo Linux Reporter: Anthony Basile <blueness>
Component: EclassesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 430702    

Description Anthony Basile gentoo-dev 2014-01-17 18:55:10 UTC
musl is an alternative libc which does not ship with getent.  Like our other CHOSTs, we need to update egetent() to check whether a user/group id has already been allocated.  I'll just inline the patch:

--- /usr/portage/eclass/user.eclass	2012-06-22 15:31:13.000000000 -0400
+++ user.eclass	2014-01-17 13:46:45.950421229 -0500
@@ -91,6 +91,9 @@
 	*-netbsd*|*-openbsd*)
 		grep "${key}:\*:" /etc/${db}
 		;;
+	*-musl*)
+		grep "${key}:x:" /etc/${db}
+		;;
 	*)
 		# ignore output if nscd doesn't exist, or we're not running as root
 		nscd -i "${db}" 2>/dev/null


We don't need to update enewuser(), enewgroup(), egethome(),egetshell() or esethome() because in ever other respect the default is fine.

Reproducible: Always
Comment 1 Anthony Basile gentoo-dev 2014-01-17 18:58:42 UTC
Blessings to commit?
Comment 2 SpanKY gentoo-dev 2014-01-18 06:50:40 UTC
(In reply to Anthony Basile from comment #0)

unfortunately, i'm fairly certain that patch is wrong.  unless musl implements all the shadow utils itself which would be pretty crazy.  you cannot assume anything about the content of the second field.  "x" just means the password has been shadowed.

for uClibc, we just install a simple getent shell script.  why don't we move that out of uClibc and into a getent package which musl/uclibc/etc... can depend on ?
Comment 3 Anthony Basile gentoo-dev 2014-01-18 15:04:12 UTC
(In reply to SpanKY from comment #2)
> (In reply to Anthony Basile from comment #0)
> 
> unfortunately, i'm fairly certain that patch is wrong.  unless musl
> implements all the shadow utils itself which would be pretty crazy.  you
> cannot assume anything about the content of the second field.  "x" just
> means the password has been shadowed.

Agreed about the 2nd feild.

musl doesn't implement any shadow utils.  But I don't get why this is a requirement.  We have to have sys-apps/shadow installed or some other provider like busybox.  So I'm confused here.

> 
> for uClibc, we just install a simple getent shell script.  why don't we move
> that out of uClibc and into a getent package which musl/uclibc/etc... can
> depend on ?

Okay let's work in that direction.
Comment 4 Anthony Basile gentoo-dev 2014-01-21 17:46:19 UTC
> Okay let's work in that direction.

What do you think of this:

  git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=tree;f=sys-apps/getent

To not depend on master/HEAD, I'd have to keep an archive of versons of getent at

  http://dev.gentoo.org/~blueness/getent/

Of course, we'd have to remove the dobins in uclibc-9999 and new ebuilds added to the tree.  These would then RDEPEND on sys-apps/getent.
Comment 5 Anthony Basile gentoo-dev 2014-01-23 14:19:53 UTC
I added sys-apps/getent to the tree but its blocking both glibc and uclibc to avoid file collision.  When/if we drop dobins getent from uclibc's ebuild, we can relax the block.