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

Please consider atomic --output to a file #88

Open
cbiedl opened this issue Nov 24, 2020 · 1 comment
Open

Please consider atomic --output to a file #88

cbiedl opened this issue Nov 24, 2020 · 1 comment
Labels

Comments

@cbiedl
Copy link

cbiedl commented Nov 24, 2020

Hello,
the various jose subcommands have an option -o/--output to write the result to a file. For the sake of robustness I'd like to suggest to make that output operation atomic, i.e. write to a temporary file in the same directory, then mv to the actual location.
Overhead is neglectable but that approach will avoid having zero-sized or incomplete files in various error conditions, with possibly a lot of complications introduced by that.
The direct write still should exist as an option to deal with the rare situation where due to strict permissions only the output file is writable, not the directory itself.

@sarroutbi
Copy link
Collaborator

HEllo @cbiedl : thanks for describing the issue. I have a question regarding this ... why is the temporary file that you suggest required to be in the same directory? Being a temporary file ... would not it better to use "mktemp" to leave the operating system do its job without worrying about the path?

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

No branches or pull requests

2 participants