[Bug 238995] adduser does not check for pre-existing user field entries in /etc/group

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 23 Nov 2021 05:02:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238995

Dennis Clarke <dclarke@blastwave.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|12.0-RELEASE                |CURRENT

--- Comment #1 from Dennis Clarke <dclarke@blastwave.org> ---
Here we are at the end of 2021 and heading into 2022 and we still
have this situation : 

We have the following group in /etc/group : 

aarch64:*:31415:aarch64

We then create the user aarch64 with the slightly borked adduser : 

europa# adduser 
Username: aarch64
Full name: ARM64 QEMU
Uid (Leave empty for default): 31415
Login group [aarch64]: 
Login group is aarch64. Invite aarch64 into other groups? []: devl
Login class [default]: 
Shell (sh csh tcsh git-shell bash rbash nologin) [sh]: 
Home directory [/home/aarch64]: 
Home directory permissions (Leave empty for default): 
Use password-based authentication? [yes]: 
Use an empty password? (yes/no) [no]: 
Use a random password? (yes/no) [no]: 
Enter password: 
Enter password again: 
Lock out the account after creation? [no]: 
Username   : aarch64
Password   : *****
Full Name  : ARM64 QEMU
Uid        : 31415
Class      : 
Groups     : aarch64 devl
Home       : /home/aarch64
Home Mode  : 
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (aarch64) to the user database.
Add another user? (yes/no): no
Goodbye!
europa# 

Sure enough the "adduser" creates yet another group with the exact same
name but a separate gid : 

europa# grep 'aarch' /etc/group
devl:*:20002:dclarke,riscv,aarch64
aarch64:*:31415:aarch64
aarch64:*:31416:
europa# 

This is just plain blunt trauma wrong.  So now I need to go manually fix
this mess and change the gid ownership in the new user home directory.

-- 
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

-- 
You are receiving this mail because:
You are the assignee for the bug.