Your message dated Sun, 21 Aug 2022 20:23:31 +0000 with message-id <[email protected]> and subject line Bug#682156: fixed in adduser 3.127 has caused the Debian Bug report #682156, regarding delgroup I/O requirements are O(n^2) with regards to number of configured users to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 682156: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682156 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: adduser Version: 3.112+nmu2 delgroup is a wrapper to groupdel which performs additional validations. It checks to see whether any other user on the system has, as its primary group, the group that it is potentially deleting. It does so with the following code: setpwent; while ((my $acctname,my $primgrp) = (getpwent)[0,3]) { if( $primgrp eq $gr_gid ) { fail (7, gtx("`%s' still has `%s' as their primary group!\n"),$acctname,$group); } } endpwent; Perl's implementation of getpwent will call getspnam() for each user to get the shadow password. On a default system (using /etc/passwd and /etc/shadow) this means, for each line of /etc/passwd, perl will open /etc/shadow, scan it until it finds the matching user, and close the file. Given adding users adds lines to /etc/passwd and /etc/shadow, this means the overall I/O complexity for deleting a group is O(n^2). On systems with ~100k users this quickly ends up being hundreds of gigabytes that needs to be read and processed in order to remove a group; given how often delgroup gets called from postrm scripts this can make a lot of operations rather expensive. groupdel performs the same check from C, using getpwent() without calling the getspnam(), so safety-wise this check is not needed. The only thing we gain from it is the opportunity to detect the error before printing "Removing group ..." and calling groupdel. groupdel has a return value specifically for this case (it will return 8) in the event we wanted to make any behavior conditional on this case. The simplest fix is to simply remove the offending lines of perl entirely. This will result in a slightly different output being printed when attempting to remove a group in use, but will otherwise behave the same, as so: With current delgroup: # delgroup root /usr/sbin/delgroup: `root' still has `root' as their primary group! If offending code were simply removed: # delgroup root Removing group `root' ... groupdel: cannot remove the primary group of user 'root' /usr/sbin/delgroup: `/usr/sbin/groupdel root' returned error code 8. Exiting. The bug was introduced in this commit: http://anonscm.debian.org/viewvc/adduser/trunk/deluser?r1=233&r2=234& and it's entirely plausible (I haven't checked) that groupdel didn't have any check at all at this point in time. If people believe it's unacceptable to simply remove the check and rely on groupdel to fail, this also suggests an alternate approach to fixing this bug -- calling out to grep via a subshell will be O(n) instead of O(n^2) and should work fine on systems with much larger numbers of users. Daniel
--- End Message ---
--- Begin Message ---Source: adduser Source-Version: 3.127 Done: Marc Haber <[email protected]> We believe that the bug you reported is fixed in the latest version of adduser, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to [email protected], and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Marc Haber <[email protected]> (supplier of updated adduser package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing [email protected]) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Format: 1.8 Date: Sun, 21 Aug 2022 21:42:09 +0200 Source: adduser Architecture: source Version: 3.127 Distribution: unstable Urgency: medium Maintainer: Debian Adduser Developers <[email protected]> Changed-By: Marc Haber <[email protected]> Closes: 57280 152195 398802 440801 541620 609114 678615 682156 1012492 1015283 1015907 1016574 1017694 Changes: adduser (3.127) unstable; urgency=low . [ Jason Franklin ] * Document the intent of the --no-create-home option (Closes: #152195) . [ Marc Haber ] * create home directory with primary group of the user (Closes: #1017694) * update and extend README . adduser (3.126) experimental; urgency=medium . * more clear conffile handling in debian/preinst. Thanks to Simon McVittie (Closes: #1016574) * add postrm script cleaning up better after purge * add a Debian README, move too long DIR_MODE explanation from NEWS.Debian to README. . adduser (3.125) experimental; urgency=medium . [ Marc Haber ] * remove debconf. (Closes: #57280, #398802) * install (add|del)user.conf as examples. * install adduser.conf as dpkg-conffile directly to /etc. (Closes: #541620) * remove postinst/postrm. (Closes: #1012492) . [ Jason Franklin ] * Remove the unused "get_users_groups" subroutine. (Closes: #1015907) . [ Matt Barry ] * Do not check for group being empty on 'delgroup'. (Closes: #682156) . adduser (3.124) experimental; urgency=medium . * experimental upload * implement new USERS_GROUP semantics * adapt documentation * implement testcases * re-work adduser logic to support USERGROUPS mechanics. This also kind of drive-by implements --firstgid and --lastgid (Closes: #609114, #678615, #440801) * rework adduser.conf * improve test infrastructure * implement new test for non membership in group * implement new group_has_gid test * implement new apply_config_hash function. * fix bugs and docs in --add-extra-groups * update debian/copyright * Update of German program translation. Thanks to Dr. Tobias Quathamer (Closes: #1015283) Checksums-Sha1: 825f3ab6f8ffebc4f2e372c43acc0699586abdcc 1671 adduser_3.127.dsc 52bd3f3f71426f27456beea06925c37795f0886d 228768 adduser_3.127.tar.xz b0ac6916d692a1e148333a817f5c800d94e48c17 6132 adduser_3.127_source.buildinfo Checksums-Sha256: f1e0a1da2668caabdcd231ae50c2a2df56108bcf6f6b8ebd3578f33ec96f0890 1671 adduser_3.127.dsc ec6e45491147b2b372fd2fff7d778489fab370f2a93af3a9295ca79219ed5f4d 228768 adduser_3.127.tar.xz 966920e6e0cae288a3cdae8d5e1c611a89c9c579e611efe75fa40ae97d051112 6132 adduser_3.127_source.buildinfo Files: b49370838a3d3315ebeff92c480c058a 1671 admin important adduser_3.127.dsc 69659ccd0dd19c046f9ec6068ba291b6 228768 admin important adduser_3.127.tar.xz fd9e7f1f0d3db6ea8cea564729e8bd65 6132 admin important adduser_3.127_source.buildinfo -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE6QL5UJ/L0pcuNEbjj3cgEwEyBEIFAmMCi30ACgkQj3cgEwEy BEIpOQ//f7leyhu+ByMO0c9MELEorP9WEHZF8RSCguOdZrtHBTcXUQFcxZsv3C6T Dk1A0zsmN3XHrYUIOEASz31y416L0j/9Qxilh4qpB6TXTvSKPJwYayPtd4jVVzt1 XGX723xG8964KBfeNMPmUBcYnbhUOFu7oPzvuKL0r7wcaXIJ18ca3tnDX+VLiGbO fJyM+1VaaWvEYHmXNNFj5+A0NFMNMmxcJc3FlyjuIP0L0LsXHULKKsNL8jn49RuK 0tQEZgeFs8N3AceBU9e1kUumrA2OsANZyy8kv3l7p0fEvZJwWJr1CYBljZLBOSGR 9cuS1bpWuK2NXB/P/PSQ0BnYb2HP94Sefqw+Okv6/LKjr93iGKMKimidpZY2auJl 3U/SSX8glGYXeOd7taCv96gH/G96xP7R2FgjrF8SAoOMVDf+xFeHcxWbk2azTWZf O+KxDX/fGZNJrpYCAUj1OfO2i9cWKwO4uJrlYMxIhZVzBGh3NCMV3CEZFa7ldqBE 9UAy9/aVRX+ulQpgKBKPlL02FDKjml0M+Agk+5uSBjU7V2g+BONzWpdbjKcUMuxn uLz8Wrc34hiEDkgp4MDMMheUWNJVC84XZnJhhHO3NfIu7p5JN2ipuWRdTT+cP9ke SNvCv9dBbqJYzESJ1KCuzToT9/rOp1OoURt7H8KiVE9zBX8Seps= =STub -----END PGP SIGNATURE-----
--- End Message ---

