jose icon indicating copy to clipboard operation
jose copied to clipboard

Please consider atomic --output to a file

Open cbiedl opened this issue 5 years ago • 1 comments

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.

cbiedl avatar Nov 24 '20 18:11 cbiedl

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?

sarroutbi avatar Oct 11 '21 07:10 sarroutbi