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

File permissions are lost whenever a journal file is written to #231

Open
sclu1034 opened this issue Jan 25, 2024 · 4 comments · May be fixed by #233
Open

File permissions are lost whenever a journal file is written to #231

sclu1034 opened this issue Jan 25, 2024 · 4 comments · May be fixed by #233

Comments

@sclu1034
Copy link

When creating the temporary files to write new changes, no attention seems to be payed to properly re-creating the permissions of the old file. And once the temp file is moved over, those permissions are gone.

@jbms
Copy link
Owner

jbms commented Jan 25, 2024

Can you just rely on directory permissions instead?

@sclu1034
Copy link
Author

sclu1034 commented Jan 26, 2024

On Windows, maybe. But on *nix, permissions don't inherit like that.
The files are created with mode 0o700. No matter what the directory permissions are, the group won't be able to read or write to that file.

And while a workaround is to change the umask, that's for the whole process and the same for all files. I'd rather be able to keep the (potentially different) permissions of each individual file.

@falsifian
Copy link

Just ran into this. I am running beancount-import as a dedicated user _falsifian_beancount (hoping to gain a bit of security), and was surprised to find my .beancount files change to owner: _falsifian_beancount, mode: 600. My umask is 022 so I would expect the mode of new files to be 644 by default.

@falsifian
Copy link

Possibly related to untitaker/python-atomicwrites#42

falsifian added a commit to falsifian/beancount-import that referenced this issue Mar 21, 2024
@falsifian falsifian linked a pull request Mar 21, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants