[Toybox] Fwd: potential addition of sponge to POSIX
enh
enh at google.com
Wed Jun 25 06:09:41 PDT 2025
On Tue, Jun 24, 2025 at 7:03 PM Rob Landley <rob at landley.net> wrote:
>
> Anybody have a strong opinion on this command? It's 5 minutes to add,
> probably something vaguely like:
>
> USE_SPONGE(NEWTOY(sponge, ">1", TOYFLAG_USR|TOYFLAG_BIN))
>
> void sponge_main(void)
> {
> off_t len = 0;
> char *blah = readfd(0, 0, &len);
>
> xwrite(*toys.optargs?xopen(*toys.optargs, O_CREATE|O_BINARY:1, 700),
presumably O_TRUNC too?
> blah, len);
> }
>
> https://linux.die.net/man/1/sponge
my opinion reading the coreutils thread was basically "i've never
heard of this in all my decades of unixing, and even now i'm
underwhelmed".
(the arguments about what exactly the semantics should be also leaned
me towards "this is not a convincingly good idea".)
> -------- Forwarded Message --------
> Subject: potential addition of sponge to POSIX
> Date: Thu, 19 Jun 2025 10:43:39 -0500
> From: Eric Blake <eblake at redhat.com>
> To: coreutils at gnu.org
>
> 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.
>
> --
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.
> Virtualization: qemu.org | libguestfs.org
>
>
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
More information about the Toybox
mailing list