The following reply was made to PR bin/173005; it has been noted by GNATS. From: Mark Johnston <mark...@gmail.com> To: bug-follo...@freebsd.org, jb.1234a...@gmail.com, li...@eitanadler.com Cc: Subject: Re: bin/173005: PW(8) - 'pw usermod' causes Segmentation fault: 11 (core dumped) Date: Sun, 28 Oct 2012 01:36:57 -0400
--TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --TB36FDmn/VVEgNH/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pw_empty_group.patch" diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 1b72cbd..26d13cf 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -228,7 +228,8 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) cnf->password_days = atoi(arg->val); if ((arg = getarg(args, 'g')) != NULL) { - if (!*(p = arg->val)) /* Handle empty group list specially */ + /* Handle empty group list specially when defining a default group. */ + if (!*(p = arg->val) && getarg(args, 'D')) cnf->default_group = ""; else { if ((grp = GETGRNAM(p)) == NULL) { --TB36FDmn/VVEgNH/-- _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"