-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: added chown #15007
RFC: added chown #15007
Conversation
@@ -441,3 +442,9 @@ function chmod(p::AbstractString, mode::Integer) | |||
uv_error("chmod",err) | |||
nothing | |||
end | |||
|
|||
function chown(path::AbstractString, owner::Int, group::Int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since -1
leaves things unchanged I think it would make sense to switch group
to be an optional parameter. Also owner and group should be Integer
.
function chown(path::AbstractString, owner::Integer, group::Integer=-1)
...
end
Unless this goes through libuv so that it works cross-platform, I see little advantage to wrapping this in a Julia function as opposed to just edit: looks like there is a |
I agree that if Base Julia is going to export this it should be portable. |
I have changed it to use uv_fs_chown and made group optional. |
@test_throws Base.UVError chown(file, -1, -2)#on-root user cannot change group to a group they are not a member of (eg: nogroup) | ||
end | ||
: @test chown(file, -2, -2) == nothing#chown shouldn't cause any errors for Windows | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be after the end for the test to actually run on windows? would be preferable to use something like if @unix? true : false
for blocks rather than extended ternary across lines.
I have separated the tests for windows and unix |
@@ -81,6 +81,13 @@ | |||
|
|||
Change the permissions mode of ``path`` to ``mode``\ . Only integer ``mode``\ s (e.g. 0o777) are currently supported. | |||
|
|||
.. function:: chown(path, owner, group =-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the genstdlib script might be sensitive to this matching the signature in the docstring exactly, including spacing
I think I've taken care of the documentation fixes now. Please let me know if there is anything else I should change. Thanks! |
Looks good, can you squash the commits? And minor nitpick but comments look a bit more readable if they are preceded with a space. |
The commits have now been squashed. Thanks for all the helpful hints! |
Is there anything else I should fix? |
Amend the commit message to be a bit more descriptive then I think this is good. |
Is this better? |
Better, yeah. I tend to err on the multiline side of longer descriptions when things are nontrivial, but good enough I suppose. Thanks for the contribution! |
If chmod exists why not chown?