From owner-freebsd-bugs@FreeBSD.ORG Sat Jan 11 20:00:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CFD5AD55 for ; Sat, 11 Jan 2014 20:00:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AAA901D97 for ; Sat, 11 Jan 2014 20:00:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s0BK00xs017996 for ; Sat, 11 Jan 2014 20:00:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s0BK00tH017995; Sat, 11 Jan 2014 20:00:00 GMT (envelope-from gnats) Resent-Date: Sat, 11 Jan 2014 20:00:00 GMT Resent-Message-Id: <201401112000.s0BK00tH017995@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jason Edwards Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7BAEC13 for ; Sat, 11 Jan 2014 19:52:42 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9AEB91D5D for ; Sat, 11 Jan 2014 19:52:42 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0BJqgFI053810 for ; Sat, 11 Jan 2014 19:52:42 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0BJqgx4053805; Sat, 11 Jan 2014 19:52:42 GMT (envelope-from nobody) Message-Id: <201401111952.s0BJqgx4053805@oldred.freebsd.org> Date: Sat, 11 Jan 2014 19:52:42 GMT From: Jason Edwards To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/185666: Regression for 'pw usermod -G ' X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Jan 2014 20:00:01 -0000 >Number: 185666 >Category: bin >Synopsis: Regression for 'pw usermod -G ' >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 11 20:00:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Jason Edwards >Release: 10.0-RC3 >Organization: ZFSguru >Environment: FreeBSD zfsguru.bsd 10.0-RC3 FreeBSD 10.0-RC3 #0: Tue Dec 24 02:57:59 UTC 2013 jason@zfsguru:/usr/obj/tmpfs/2-source/sys/OFED-POLLING-ALTQ amd64 >Description: The pw(8) manpage states: -G grouplist Set additional group memberships for an account. grouplist is a comma, space or tab-separated list of group names or group numbers. The user's name is added to the group lists in /etc/group, and removed from any groups not specified in grouplist. This works as expected on FreeBSD 9.2-RELEASE where the user is removed from any groups not specified explicitly in the -G grouplist. However, on 10.0-RC1 and 10.0-RC3, I can reproduce 100% a regression where the username is *NOT* removed from the 'old group'. It is only added to the new group. >How-To-Repeat: It works as expected on 9.2: pw useradd testuser pw groupadd testgroup pw groupadd testgroup2 pw usermod testuser -G testgroup # /etc/group section before: # testuser:*:1001: # testgroup:*:1002:testuser # testgroup2:*:1003: pw usermod testuser -G testgroup2 # /etc/group section after: # testuser:*:1001: # testgroup:*:1002: # testgroup2:*:1003:testuser However, on 10.0-RC1 and 10.0-RC3 amd64 the behavior is very different; it does not remove the 'old group': pw useradd testuser pw groupadd testgroup pw groupadd testgroup2 pw usermod testuser -G testgroup # /etc/group section before: # testuser:*:1004: # testgroup:*:1005:testuser # testgroup2:*:1006: pw usermod testuser -G testgroup2 # /etc/group section after: # testuser:*:1004: # testgroup:*:1005:testuser # testgroup2:*:1006:testuser >Fix: Workaround is to use 'groupmod' instead, to achieve a rough equivalent: # remove from the group pw groupmod -d # add to the group pw groupmod -m Of course, the usermod -G command is superior, because it removes the user from all groups not specified explicitly. >Release-Note: >Audit-Trail: >Unformatted: