Trying to edit any existing user with bsdconfig will result in the user's group being shown like "gid (group)". E.g. "1001 (martin)". Unfortunately, when trying to save said user, bsdconfig will always complain with an error like this: pw: group `1001 (martin)` does not exist Probably because the group string "1001 (martin)" is taken literally when it should be parsed using something like /(\d+?)\s.+/
Created attachment 174664 [details] strip appended group name from _user_gid before using it with the pw command Although there is code that attempts to add the group name to the dialog display starting in line 1023 of user_input.subr: # Attempt to translate a numeric GID into `number (name)' if f_isinteger "$user_gid"; then local user_group user_group=$( pw groupshow -g "$user_gid" 2> /dev/null ) && user_gid="$user_gid (${user_group%%:*})" fi I could not identify any existing code for bsdconfig that was meant to strip the (<groupname>) out again. Albeit not elegant, the attached patch solves the problem for me (on 10.3-STABLE).
This bug still exists in 11.1-RELEASE.
A commit references this bug: Author: dteske Date: Sun Jun 17 22:09:43 UTC 2018 New revision: 335308 URL: https://svnweb.freebsd.org/changeset/base/335308 Log: bsdconfig: Fix a bug when editing users The usermgmt API was stomping on a global ($user_gid to be specific) so things would appear to work fine until you tried to make a second pass into the API with the now-tainted variable contents. Fixed by localizing menu-specific contents as to not leak outside API. PR: bin/208774 Reported by: Martin Waschbuesch <martin@waschbuesch.de> MFC after: 1 week X-MFC-to: stable/11, stable/10 Sponsored by: Smule, Inc. Changes: head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
Can you check to see if the problem is fixed? Cheers!
(In reply to Devin Teske from comment #4) It does fix this for me. Splendid! Thanks and kudos, Martin
A commit references this bug: Author: dteske Date: Thu Jun 21 14:55:26 UTC 2018 New revision: 335485 URL: https://svnweb.freebsd.org/changeset/base/335485 Log: MFC r335308: bsdconfig: Fix a bug when editing users The usermgmt API was stomping on a global ($user_gid to be specific) so things would appear to work fine until you tried to make a second pass into the API with the now-tainted variable contents. Fixed by localizing menu-specific contents as to not leak outside API. PR: bin/208774 Reported by: Martin Waschbuesch <martin@waschbuesch.de> Sponsored by: Smule, Inc. Changes: _U stable/11/ stable/11/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
A commit references this bug: Author: dteske Date: Thu Jun 21 15:02:18 UTC 2018 New revision: 335487 URL: https://svnweb.freebsd.org/changeset/base/335487 Log: MFC r335308: bsdconfig: Fix a bug when editing users The usermgmt API was stomping on a global ($user_gid to be specific) so things would appear to work fine until you tried to make a second pass into the API with the now-tainted variable contents. Fixed by localizing menu-specific contents as to not leak outside API. PR: bin/208774 Reported by: Martin Waschbuesch <martin@waschbuesch.de> Sponsored by: Smule, Inc. Changes: _U stable/10/ stable/10/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
Thank you so very much for the bug report and your patience in waiting for a resolution. Cheers.