]> Cypherpunks repositories - gostls13.git/commitdiff
os/user: use getgrouplist on illumos && cgo
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 11 Sep 2025 16:57:00 +0000 (09:57 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 26 Sep 2025 19:11:42 +0000 (12:11 -0700)
The getgrouplist call is available on Illumos since December 2020:

    https://github.com/illumos/illumos-gate/commit/f2c438c5058c64b7373448f239156bf60009abcb

We can assume it is available for users now. Let's switch to using it
when cgo is enabled.

Since neither LUCY nor legacy trybots provide illumos, I tested this
locally in a OpenIndiana VM, with and without osusergo, with cgo enabled
and disabled.

This is a continuation of CL 315278.

Fixes #14709

Change-Id: I922049e7ea5f450f6900914b30967e522e56cfc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/702975
Reviewed-by: Andrew Stormont <andyjstormont@gmail.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Kirill Kolyshkin <kolyshkin@gmail.com>
TryBot-Bypass: Kirill Kolyshkin <kolyshkin@gmail.com>

src/os/user/cgo_listgroups_unix.go
src/os/user/getgrouplist_unix.go
src/os/user/listgroups_unix.go
src/os/user/listgroups_unix_test.go

index 59636954b2ab87aff8115683cbb7b2a5f7989935..6b88f30c55d852b0bca64e6cd1c3c151157e7fad 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build (cgo || darwin) && !osusergo && (darwin || dragonfly || freebsd || (linux && !android) || netbsd || openbsd || (solaris && !illumos))
+//go:build (cgo || darwin) && !osusergo && (darwin || dragonfly || freebsd || (linux && !android) || netbsd || openbsd || solaris)
 
 package user
 
index fb482d35baee0cbe2c6e8506651dc7bd02f925b1..81b4cb74f90b92ca0308a4e03b300d9a8a96db18 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build cgo && !osusergo && (dragonfly || freebsd || (!android && linux) || netbsd || openbsd || (solaris && !illumos))
+//go:build cgo && !osusergo && (dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris)
 
 package user
 
index 67bd8a776e2bbec1171b6d17081afb09192274d7..570926fae0fa75e688d046e7a4ec71224641a441 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build ((darwin || dragonfly || freebsd || (js && wasm) || wasip1 || (!android && linux) || netbsd || openbsd || solaris) && ((!cgo && !darwin) || osusergo)) || aix || illumos
+//go:build ((darwin || dragonfly || freebsd || (js && wasm) || wasip1 || (!android && linux) || netbsd || openbsd || solaris) && ((!cgo && !darwin) || osusergo)) || aix
 
 package user
 
index 9619462cec983ab70901a4a745b0b7a80fc68a53..252eef07ee57189061adc7bb1f93ed1d5052a7ab 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build ((darwin || dragonfly || freebsd || (js && wasm) || wasip1 || (!android && linux) || netbsd || openbsd || solaris) && ((!cgo && !darwin) || osusergo)) || aix || illumos
+//go:build ((darwin || dragonfly || freebsd || (js && wasm) || wasip1 || (!android && linux) || netbsd || openbsd || solaris) && ((!cgo && !darwin) || osusergo)) || aix
 
 package user