On 19/06/2025 17:45, Steffen Nurpmeso wrote:
Eric Blake wrote in
<xhnenmzckigq5wmfmz43aoeabxxlcsusz2eflxhrosd2e56ive@pjutzahpva5l>:
|The Austin Group is debating whether to sponsor a proposal to add
|sponge(1) to a future edition of POSIX:
|
|https://www.austingroupbugs.net/view.php?id=1927
|
|I note that at present, busybox does NOT have a sponge applet; but it
|seems like the sort of applet that could be easily added if someone
|were to contribute it. Many GNU/Linux systems currently have sponge
|installed from the `moreutils` project, if that were to serve as a
|starting point for deciding which features to match.
|
|Does anyone on this list have any comments on why it might be a good
|or a bad idea for POSIX to standardize sponge? Similarly, if busybox
OpenBSD does not have it. FreeBSD had it, and one can still get
the manual via web, but it was removed in the tree -- funny:
added in 7202e5e8f6e3f0d364dfd30fd8df5a4b8e076169 (2017-12-05)
removed in fbc88a6f35671bd37d0a4ed68c0bb0687c364c21 (2017-12-06)
I am seeing a difference between the moreutils implementation and that
removed FreeBSD implementation. The proposed wording, taken from
moreutils states:
sponge preserves the permissions of the output file if it already
exists.
It also states:
When possible, sponge creates or updates the output file atomically by
creating a separate temp file in TMPDIR and then renaming that temp
file into place.
But, in order to achieve that second point, the moreutils implementation
fails to achieve the first. It does not preserve the permissions of the
output file, it preserves the permission bits. On systems that support
ACLs, the two are not equivalent.
The use of a temporary file to be renamed to replace the original also
breaks hardlinks.
Personally, I have never used this utility but if it were to be added to
POSIX and/or busybox, I would prefer that FreeBSD version over the
moreutils version. If I wanted to write to a temporary file and then
move it over the original, I'd just use the shell's > to write to a
temporary file and then the standard mv command to move it over the
original.
Cheers,
Harald van Dijk
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox