On 19/06/2025 17:55, Marc Chantreux wrote:
On Thu, Jun 19, 2025 at 05:32:41PM +0100, Pádraig Brady wrote:
If we were to standardize a new tool,
we should aim for ACID file replacement functionality.
it seems to me that's the whole point of sponge:
< A foo | bar | bang > A # fail
< A foo | bar | bang | sponge A # ok
as the lhs is closed last, A isn't corrupted.
so out of curiosity: is there another possible usage ?
You're right. The atomicity issue in method 6
was due to the use of truncate and write (cp and rm in my example).
Perhaps sponge has been updated in the meantime,
but reading the man page now indicates it uses
rename() for atomicity if supported,
and so is now more like method 7 discussed at the above.
So as long as sponge adequately handles file attributes,
it would be a useful addition yes.
cheers,
Pádraig