On 26/02/2026 05:02, Collin Funk wrote:
The change in behavior can be seen with the invocations below:

     $ time ./src/groups-prev $(yes collin | head -n 10000 | tr '\n' ' ') >&-
     groups-prev: write error: Bad file descriptor
real 0m35.295s
     user       0m9.271s
     sys        0m17.325s
     $ time ./src/groups $(yes collin | head -n 10000 | tr '\n' ' ') >&-
     groups: write error: Bad file descriptor
real 0m0.021s
     user       0m0.006s
     sys        0m0.018s

-- 8< --

* NEWS: Mention the improvement.
* src/groups.c (main): Call fflush for each listed user to check for
write errors.
---
  NEWS         | 3 +++
  src/groups.c | 3 +++
  2 files changed, 6 insertions(+)

diff --git a/NEWS b/NEWS
index cf1b1414e..13bb6031a 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,9 @@ GNU coreutils NEWS                                    -*- 
outline -*-
** Improvements + 'group' will now exit immediately upon receiving a write error, which is
+  significant when listing information for many users.

s/group/groups/

Also you might squash this in for tests:

diff --git a/tests/misc/io-errors.sh b/tests/misc/io-errors.sh
index 63649603e..e947df142 100755
--- a/tests/misc/io-errors.sh
+++ b/tests/misc/io-errors.sh
@@ -44,7 +44,9 @@ fmt foo
 fold foo
 fold -b foo
 fold -c foo
+groups
 head -n1 foo
+id
 join foo foo
 nl foo
 numfmt --invalid=ignore < foo

Otherwise looks good.

cheers,
Padraig

Reply via email to