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

Missing Flag For nix::unistd::fchownat #1029

Closed
gatoWololo opened this issue Feb 13, 2019 · 5 comments · Fixed by #2267
Closed

Missing Flag For nix::unistd::fchownat #1029

gatoWololo opened this issue Feb 13, 2019 · 5 comments · Fixed by #2267

Comments

@gatoWololo
Copy link

Hello!

Currently fchownat<P: ?Sized + NixPath>(dirfd: Option<RawFd>, path: &P, owner: Option<Uid>, group: Option<Gid>, flag: FchownatFlags) -> Result<()> takes an enum as it's flag argument nix::unistd::FchownatFlags. Where the variants are either FollowSymlink or NoFollowSymlink. According to man 2 fchownat since Linux 2.6.39 fchownat() may also takes AT_EMPTY_PATH as part of the flags bitmask.

This is currently not possible with the current implementation provided by Nix, the enum will probably have to be changed to a bitflag.

@asomers
Copy link
Member

asomers commented Feb 13, 2019

This sounds like an easy thing to fix. Would you like to write a PR to add the new flag?

@gatoWololo
Copy link
Author

Sure! I can do that.

@otavio
Copy link
Contributor

otavio commented Sep 22, 2019

I was looking at the flags and the AT_EMPTY_PATH is Linux specific. Couldn't same thing to be done using fchown()?

@dubiousjim
Copy link

Bump. Would be great to get the functionality of fchown exposed, either as a standalone, or via the AT_EMPTY_PATH flag for fchownat. If the latter is Linux-specific, then the former seems preferable.

@asomers
Copy link
Member

asomers commented May 2, 2020

Yes, I think fchown would be a good addition. And an easy one. Would you care to submit a PR< @dubiousjim ?

bors bot added a commit that referenced this issue Jun 12, 2020
1257: Add fchown(2) wrapper r=asomers a=nateavers

Mentioned [in #1029](#1029 (comment)).

Co-authored-by: Nate Avers <nathan.avers@alumni.case.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants