Date: Mon, 23 Mar 2015 20:19:23 +0800 From: Peter Xu <xzpeter@gmail.com> To: freebsd-bugs@freebsd.org Subject: "pw user mod" with "-G" would add user into group multiple times? Message-ID: <CAGRNztBjLsEOdd1Ym8%2B3u=VL=V1UjyB%2B5Sa55cLz0VhasaSqWQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, all, I found that I could add the same user into same group for many times, like: root@PeterDev2:/usr/src/lib# pw user mod -n peter1 -G petergroup1 root@PeterDev2:/usr/src/lib# pw group show petergroup1 petergroup1:*:1001:peter1 root@PeterDev2:/usr/src/lib# pw user mod -n peter1 -G petergroup1 root@PeterDev2:/usr/src/lib# pw group show petergroup1 petergroup1:*:1001:peter1,peter1 This is strange. I had a look at the source code at /usr/src/lib/libutil/gr_util.c and found that there is no check on whether the group already has the specific user when doing gr_add(). Further, I checked the commit log of BSD head on SVN, it seems that there was the check: https://svnweb.freebsd.org/base?view=revision&revision=244736 But it is removed in another refactoring: https://svnweb.freebsd.org/base?view=revision&revision=247919 So... Is it a bug? Peter
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGRNztBjLsEOdd1Ym8%2B3u=VL=V1UjyB%2B5Sa55cLz0VhasaSqWQ>