Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/user: add LookupGroup and LookupGroupId #2617

Closed
bradfitz opened this issue Dec 26, 2011 · 33 comments
Closed

os/user: add LookupGroup and LookupGroupId #2617

bradfitz opened this issue Dec 26, 2011 · 33 comments
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@bradfitz
Copy link
Contributor

The os/user package lacks group lookup functions.
@peterGo
Copy link
Contributor

peterGo commented Dec 26, 2011

Comment 1:

The os/user package has a complex conditional Makefile.
include ../../../Make.inc
TARG=os/user
GOFILES=\
    user.go\
ifeq ($(CGO_ENABLED),1)
CGOFILES_linux=\
    lookup_unix.go
CGOFILES_freebsd=\
    lookup_unix.go
CGOFILES_darwin=\
    lookup_unix.go
endif
ifneq ($(CGOFILES_$(GOOS)),)
CGOFILES+=$(CGOFILES_$(GOOS))
else
GOFILES+=lookup_stubs.go
endif
include ../../../Make.pkg

@bradfitz
Copy link
Contributor Author

Comment 2:

Not for long.  Makefiles will be removed.
But what does that have to do with this bug?

@adg
Copy link
Contributor

adg commented Jan 4, 2012

Comment 3:

Marking as Later because it would not be a backwards-incompatible change, even though it
may happen for Go 1.

Labels changed: added priority-later, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 4:

Labels changed: added go1.1maybe.

@shanemhansen
Copy link
Contributor

Comment 5:

So, would LookupGroup return some struct about the user's main group? A list of groups
the user belongs to? Is it an api for getting information about a specific group?

@ianlancetaylor
Copy link
Contributor

Comment 6:

By analogy with LookupUser, LookupGroup should return information about a specific group
by name.  There should probably be a Group type, with the group name, group ID, and a
user list.  LookupGroupId would take a group ID and return the group information.
We should also have a function to return the list of groups for a user.
This would have to work for Windows also.  I have no idea what groups look like on
Windows.

@bradfitz
Copy link
Contributor Author

Comment 7:

Labels changed: added suggested.

Owner changed to ---.

@shanemhansen
Copy link
Contributor

Comment 8:

I've been looking through the code and modeling the group datastructure. AFAIK there's
no sane way to get this info w/o cgo, right?
I haven't really figured out the windows side of this API quite yet.

@bradfitz
Copy link
Contributor Author

Comment 9:

Correct. You'll want to use cgo, just like the user lookup functions.

@shanemhansen
Copy link
Contributor

Comment 10:

Awesome, I'll plan on working on a CL this week then.

@robpike
Copy link
Contributor

robpike commented Mar 7, 2013

Comment 11:

Labels changed: removed go1.1maybe.

@bradfitz
Copy link
Contributor Author

Comment 12:

CL at https://golang.org/cl/4589049/ but for after Go 1.1.

@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 13:

[The time for maybe has passed.]

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 14:

Labels changed: added go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 15:

Labels changed: added feature.

@robpike
Copy link
Contributor

robpike commented Aug 16, 2013

Comment 16:

Is this going anywhere?

@robpike
Copy link
Contributor

robpike commented Aug 30, 2013

Comment 17:

Status changed to Started.

@rsc
Copy link
Contributor

rsc commented Sep 11, 2013

Comment 18:

Not for this round I guess.

Labels changed: added go1.3maybe, removed go1.2maybe.

@bradfitz
Copy link
Contributor Author

Comment 19:

Also: https://golang.org/cl/13454043

@alexbrainman
Copy link
Member

Comment 20:

Brad, lets leave it for after go1.2, so we can try to actually implement it on windows.
We might discover the interface is not suitable.
Alex

@bradfitz
Copy link
Contributor Author

Comment 21:

Of course. This isn't for Go 1.2.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 22:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 23:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 24:

Labels changed: added repo-main.

@bradfitz bradfitz added started Suggested Issues that may be good for new contributors looking for work to do. labels Dec 4, 2013
@bradfitz bradfitz added this to the Go1.5Maybe milestone Dec 16, 2014
carmark added a commit to hyperhq/hyperd that referenced this issue Jun 5, 2015
Since the issue(golang/go#2617) of golang, we may not support to set the file's group
@rsc rsc modified the milestones: Unplanned, Go1.5Maybe Jun 29, 2015
@mmcco
Copy link

mmcco commented Jan 3, 2016

Is there still interest in adding this? I was surprised to find it missing. I could try writing it.

@zombiezen
Copy link
Contributor

It's mostly written already; I'm not sure why it never made it in. See the CLs linked above.

@bradfitz
Copy link
Contributor Author

@zombiezen, do you want to usher it through?

@zombiezen
Copy link
Contributor

I'll take a look tomorrow. I'll reach out to the CL author for permission
to clone it.

On Tue, Jan 19, 2016 at 9:53 PM Brad Fitzpatrick notifications@github.com
wrote:

@zombiezen https://github.com/zombiezen, do you want to usher it
through?


Reply to this email directly or view it on GitHub
#2617 (comment).

@bradfitz bradfitz modified the milestones: Go1.7, Unplanned Jan 20, 2016
@garthk
Copy link

garthk commented Jan 26, 2016

That'll save me trying to consolidate the ~20 scattered copies of @andrenth's code down to one stable dependency, @zombiezen. All luck to you.

@zombiezen
Copy link
Contributor

I have the CL mostly ready, but when I go to test locally, the size of the group is too large in memory. Turns out that _SC_GETGR_R_SIZE_MAX is not a maximum, but a suggested size for the buffer, and proper implementations need to do retries.

@gopherbot
Copy link

CL https://golang.org/cl/19235 mentions this issue.

@cgkades
Copy link

cgkades commented Aug 2, 2016

Has this been implemented? I don't see it in the doc for os/user

@cespare
Copy link
Contributor

cespare commented Aug 2, 2016

@cgkades it will be in 1.7, which is not yet released. You can see the upcoming docs here:

https://tip.golang.org/pkg/os/user/#LookupGroup

@golang golang locked and limited conversation to collaborators Aug 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests