"User foo already exists" check is broken in installer
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Nexenta Operating System |
Fix Committed
|
Medium
|
anilg |
Bug Description
(This is for the package nexenta-builder, but launchpad doesn't seem to know about it yet.)
I've just installed the unstable version of Nexenta, and was a bit surprised to be told by the installer that "User ats already exists." when creating a user account.
"ats" didn't already exist, but "gnats" did -- which made me suspicious that it was checking for a substring rather than a match. My suspicions were confirmed by a quick look at the installer source (once I figured out where to get it from):
if cat /etc/passwd|awk -F: '{print $1}'|grep "$user" >/dev/null; then
oneline_msgbox Error "User $user already exists."
continue
fi
I'd suggest doing something like this instead, so it checks for an exact match:
if grep "^$user:" /etc/passwd >/dev/null; then
...
fi
(You should also use grep -q rather than grep >/dev/null, since you have GNU grep.)