Creation of users in ports

Brooks Davis brooks at freebsd.org
Wed Dec 7 20:42:58 UTC 2011


On Wed, Dec 07, 2011 at 07:54:07PM +0000, Chris Rees wrote:
> Hi all,
> 
> I'm at a loss as to how to restore functionality for creating (or
> using) customised users in ports.  For example, using the old method
> (pkg-install scripts) many ports allowed the user to change the
> username used for the port.
> 
> With the new functionality, if the username isn't found in
> /usr/ports/UIDs it's rejected, and the port can't use it.
> 
> Can anyone explain to me why it would be a bad idea to include the
> system's passwd and group files in the search? This would allow the
> ports system to accept any user that already exists, as well as
> creating the correct code in the plist.
> 
> For example; someone wants to install postgresql as username Fred, so
> s/he sets PG_USER=Fred in /etc/make.conf.  Currently this causes an
> error on build, because Fred is not in /usr/ports/UIDs.  Were
> /etc/master.passwd and /etc/group searched too, that wouldn't cause a
> problem.
> 
> Any obvious oversights?

It seems like a better (but more complicatd) solution would use "getent
passwd ${USER}" to check for existing users.  (You need to check
explicitly rather than treating the output without /etc/passwd because
some nss modules don't enumerate to avoid listing the thousands or tens
of thousands of users in a corporate AD or LDAP installation).

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20111207/54586226/attachment.pgp


More information about the freebsd-ports mailing list