-
Notifications
You must be signed in to change notification settings - Fork 18k
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
x/sys/unix: Setfsuid and Setfsgid have wrong return values #36649
Comments
I'm not sure we should change it in package |
Yeah, I always forget about |
@shynie Please feel free to send a patch for Thanks! |
Change https://golang.org/cl/215240 mentions this issue: |
I reverted the change (in https://go-review.googlesource.com/c/sys/+/215518) because it's a breaking API change and code search suggests it does break programs (and some ones that seem popular). |
I left a comment on introducing a new name in my CL but as the CL's status by now is 'merged', I'll post it here as well. Is there any naming conventions for this kind of fixes? Linux itself tends to add '1' to syscall names that would otherwise break backwards compatibility, should we do the same, thus adding something like Setfsgid1 and Setfsuid1? Also should I create a new CL or it's possible to reopen this one? |
Maybe something like You'll have to create a new CL since the original one was already merged. |
Yep, that looks better. I'll open a new CL with these changes tomorrow. |
Please wait for @ianlancetaylor to approve any name. Ideally it should match some existing naming convention precedent. That may not be possible, in which case getting the precedent nice for such future cases is worth getting more people's thoughts on. |
I can't think of any other case where we had to add a new function to add a result. There may have been one that I'm forgetting. I'm OK with adding I'm kind of surprised this comes up; as I understand it those system calls are obsolete. |
|
Change https://golang.org/cl/215577 mentions this issue: |
Did it like it was done with |
You could define a |
Change https://golang.org/cl/215579 mentions this issue: |
I managed to mess up the CLs and |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
According to the documentation, both setfsuid() and setfsgid() should return the previous filesystem user or group ID which is not the case in go's syscall package. The signatures in syscall package are (for all architectures):
What did you expect to see?
Correct ones would be
Right now there's no way to determine if the call succeeded or not as the
err
value will always be nil both on successful call and on fail.Though it can be fixed just by adding an extra return value to the function signatures in
syscall_linux_%arch%.go
, it would be a breaking change.Another way is to introduce another version of these functions with correct signatures. Linux uses that approach for its epoll functionality (
epoll_create(2)
andepoll_create1(2)
). But to be honest, it's even worse than breaking the backwards compatibility in my opinion, as the code will become a total mess after a few 'fixes' like that one.What did you see instead?
Pretty much meaningless return value after a call that didn't fail due to lack of CAP_SETUID :c
The text was updated successfully, but these errors were encountered: