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

Nixfmt does not persist file ownership #73

Open
jnsaff opened this issue Aug 24, 2020 · 2 comments
Open

Nixfmt does not persist file ownership #73

jnsaff opened this issue Aug 24, 2020 · 2 comments

Comments

@jnsaff
Copy link

jnsaff commented Aug 24, 2020

Description

When run on a file to be formatted in place nixfmt does not persist file ownership. When run as a user that is not the owner of the file but has permissions to edit the file the formatted file ownership will be changed to the user running nixfmt.

This can be easily worked around and is a remote edge case to begin with but I'm reporting it still for completeness sake.

Thank you for the great work from a fellow nixer from Tallinn!

@kirelagin
Copy link
Member

Oh, yes, you are right, thanks for the report!

The reason here is that we do an atomic write by creating a new file and then mving it in place. I suspect it might be impossible to preserve 100% of permissions, but we should, at least, try.

@dasJ
Copy link
Member

dasJ commented Apr 2, 2024

Not sure if linux lets you create a file for another user without CAP_CHOWN anyway :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

3 participants