A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1927 ====================================================================== Reported By: dwheeler Assigned To: ajosey ====================================================================== Project: 1003.1(2008)/Issue 7 Issue ID: 1927 Category: Shell and Utilities Type: Clarification Requested Severity: Editorial Priority: normal Status: Under Review Name: David A. Wheeler Organization: The Linux Foundation User Reference: Utilities Section: Utilities Page Number: NA Line Number: NA Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2025-06-01 01:18 UTC Last Modified: 2025-06-11 16:49 UTC ====================================================================== Summary: Add sponge utility ======================================================================
---------------------------------------------------------------------- (0007198) dwheeler (reporter) - 2025-06-11 16:49 https://austingroupbugs.net/view.php?id=1927#c7198 ---------------------------------------------------------------------- Note: I'm sure that the proposed text above for the new utility could be improved. However, the first step is to decide whether or not to include the sponge utility at all, and the second step is to refine its definition to be appropriate for POSIX. I tried to do both, but I've focused on step 1. There's no point in refining the proposal if it will be rejected no matter what :-). However, I think "use a pipeline to update in place" is such a common use case that it's good to make it *easy*. There have been proposals for "in-place" commands that run a string passed in, but don't know of any that are fully implemented or widely used. Part of the problem is that they don't they require complex escape mechanisms for widely-used characters. As a result they require complex escaping to use that is hard to reason about, the mixing of data and command easily leads to vulnerabilities, and it's hard to create tools to do things like provide proper syntactic highlighting. In contrast, "sponge" has been used for a long time by many, it's easy to reason about, and it doesn't require complex reasoning . Instead, just write your pipeline as usual, and pipe to sponge as the final command. No separate mv command needed, and you know that the permissions are the same (if it's possible to do that). Many places highlight sponge as a useful utility. Here are some: https://www.reddit.com/r/linux/comments/18gifb8/usefull_cli_tools/ https://www.putorius.net/linux-sponge-soak-up-standard-input-and-write-to-a-file.html https://www.youtube.com/watch?v=9RXkZpmBDj0 (at time 15:10) https://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/ Issue History Date Modified Username Field Change ====================================================================== 2025-06-01 01:18 dwheeler New Issue 2025-06-01 01:18 dwheeler Status New => Under Review 2025-06-01 01:18 dwheeler Assigned To => ajosey 2025-06-11 16:49 dwheeler Note Added: 0007198 ======================================================================
