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
Parameters for chown should be signed integers not unsigned #15828
Conversation
@monojenkins build |
Can't believe I totally spaced on the return types there. |
@nicholi it does introduce an API breaking change though so I think we'll need to add an overload for the existing uint-taking public methods. |
@akoeplinger Semi-related, would it be posible to request a more recent build uploaded to NuGet? https://www.nuget.org/packages/Mono.Posix.NETStandard The last one was quite awhile ago. Though it doesn't look like too many serious changes have been committed since then. Other than this one possibly. |
Yeah I wasn't too sure on that, since the uint versions were technically incorrect all along. Re-added them back in marked regions, and also with Obsolete attribute. That seems most appropriate correct? |
Yes that looks fine.
I'll ping the relevant people after this was merged. |
@monojenkins approve |
@monojenkins commit apidiff |
@nicholi thank you for the contribution! |
Fixes #10748
The calls for chown, lchown, fchown, and fchownat (from
Mono.Unix.Native.Syscall
) are all declared with unsigned integers for theowner
andgroup
parameters. This is incorrect.Directly from the manpage
man 2 chown
Emphasis added on the documentation explaining how the parameters can take the value -1, clearly not an unsigned integer. The
uid_t
struct is not an unsigned integer. I am assuming this was just an oversite on whoever re-wroteMono.Unix.Native.Syscall
.The original calls from
Mono.Posix.Syscall
(now marked as Obsolete) all correctly use signed integers.Even the documentation directly from
mcs/class/Mono.Posix/Documentation/en/Mono.Unix.Native/Syscall.xml
I have changed the signatures from uint to int, the relevant XML documentation, and also 3 usages of chown within the project itself (switch from Convert.ToUInt32 to Convert.ToInt32). Hopefully this PR won't sit here for years, but who knows.