On 19/06/2025 16:43, Eric Blake wrote:
The Austin Group has been asked whether future POSIX should include
the sponge(1) utility:
https://www.austingroupbugs.net/view.php?id=1927
Before the Austin Group decides whether to sponsor such an addition,
I'm trying to get feedback on whether standardizing the utility would
be worthwhile, or whether there are lurking caveats (such as
difficulties in implementing sponge to do atomic content changes
correctly) where we might be better off leaving it non-standard.
Right now, many GNU/Linux systems get sponge from moreutils; if POSIX
were to mandate sponge, would that be something we try to move into
coreutils rather than relying on moreutils? I also note that busybox
does not (yet) have a sponge applet, as far as I can tell, but would
likely add one if POSIX mandates the utility.
sponge supports file replacement method 6 as discussed at:
https://www.pixelbeat.org/docs/unix_file_replacement.html
The documented disadvantages there were:
- Slower as file written twice
- Data inconsistent for a while
If we were to standardize a new tool,
we should aim for ACID file replacement functionality.
cheers,
Pádraig