https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=169a760e5d831f7862ff45812fc0c94fe8df88ec

commit 169a760e5d831f7862ff45812fc0c94fe8df88ec
Author:     Corinna Vinschen <[email protected]>
AuthorDate: Fri Jan 16 12:00:36 2026 +0100
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Fri Jan 16 12:00:36 2026 +0100

    Cygwin: internal_getlogin: always call internal_getgroups
    
    Commit 29b7313d2225 ("* cygheap.h (enum cygheap_pwdgrp::cache_t):
    Remove.") changed an initial conditional to skip calling
    internal_getgroups() if we're running with cygserver account caching
    in place.  This breaks changing the primary group.
    
    Unfortunately the commit message doesn't explain why the change was
    made.
    
    Just calling internal_getgroups() all the time fixes this behaviour.
    
    Fixes: 29b7313d2225 ("* cygheap.h (enum cygheap_pwdgrp::cache_t): Remove.")
    Addresses: https://cygwin.com/pipermail/cygwin/2026-January/259250.html
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/release/3.6.7 | 4 ++++
 winsup/cygwin/uinfo.cc      | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/release/3.6.7 b/winsup/cygwin/release/3.6.7
index defe55ffe75e..050f6008084e 100644
--- a/winsup/cygwin/release/3.6.7
+++ b/winsup/cygwin/release/3.6.7
@@ -3,3 +3,7 @@ Fixes:
 
 - Guard c32rtomb against invalid input characters.
   Addresses a testsuite error in current gawk git master.
+
+- Allow changing primary group even when running with cygserver account
+  caching.
+  Addresses: https://cygwin.com/pipermail/cygwin/2026-January/259250.html
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 1eb52f14578c..73e61cbffc82 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -153,8 +153,7 @@ internal_getlogin (cygheap_user &user)
      and the primary group in the token. */
   pwd = internal_getpwsid (user.sid (), &cldap);
   pgrp = internal_getgrsid (user.groups.pgsid, &cldap);
-  if (!cygheap->pg.nss_cygserver_caching ())
-    internal_getgroups (0, NULL, &cldap);
+  internal_getgroups (0, NULL, &cldap);
   if (!pwd)
     debug_printf ("user not found in passwd DB");
   else

Reply via email to