# pw usermod moo4 -g "" Segmentation fault: 11 (core dumped) # How-To-Repeat: as above
On 23 October 2012 18:19, jb <jb.1234abcd@gmail.com> wrote: >>Description: > # pw usermod moo4 -g "" > Segmentation fault: 11 (core dumped) note to the person who fixes this: this is reproducible as root on FreeBSD radar 10.0-CURRENT FreeBSD 10.0-CURRENT #1 r239951: Fri Aug 31 10:32:27 PDT 2012 eitan@radar:/usr/obj/more/src/sys/GENERIC amd64 if the user exists. -- Eitan Adler
Looks like this was introduced by r63596, which itself was a fix for bin/5717: http://www.freebsd.org/cgi/query-pr.cgi?pr=5717 Basically, pw(8) allows '-g ""' when setting the default group for new users; it has a special meaning, described in the man page. I think the right fix is to check for -D before proceeding when running with -g "". With the attached patch, 'pw useradd -D -g ""' still does the right thing, and we also have # pw usermod mark -g "" pw: group `' does not exist # which I think is the right behaviour. Thanks, -Mark
Well done, except for error message. It should be: # pw usermod mark -g "" pw: group `' is not defined which would be consistent with: # pw useradd mark -g "" pw: group `' is not defined jb
With my patch the error message is consistent: # pw useradd mark -g "" pw: group `' does not exist # pw usermod mark -g "" pw: group `' does not exist #
This is the current (unpatched) state: # pw useradd moo -g moo pw: group `moo' does not exist # pw useradd moo -g boo pw: group `boo' does not exist # pw useradd moo -g "" pw: group `' is not defined As you can see there is a distinction between error msgs based on user input of primary group (or lack of it). That's why I asked you to be consistent with past and current user experience. jb
The error messages aren't different by design though - the different behaviour for -g "" is a side-effect of the change I mentioned in the first email. There is no practical distinction between those two errors anyway - they come from two essentially identical checks at different points in the code. In fact, the "... is not defined" check is redundant and can be removed/simplified if my patch is applied. Specifically, that check only fails with -g "" in the unpatched pw(8). -Mark
Simplifying for user is good. So, go ahead - that segmentation fault looks bad :-) jb
Responsible Changed From-To: freebsd-bugs->bapt I'll take it.
State Changed From-To: open->closed This has been fixed long ago, forgot to close, thanks for reporting