A NOTE has been added to this issue. 
====================================================================== 
https://www.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-26 15:45 UTC
====================================================================== 
Summary:                    Add sponge utility
====================================================================== 

---------------------------------------------------------------------- 
 (0007212) eblake (manager) - 2025-06-26 15:45
 https://www.austingroupbugs.net/view.php?id=1927#c7212 
---------------------------------------------------------------------- 
The busybox maintainers chimed in on a thread starting here:
https://lists.busybox.net/pipermail/busybox/2025-June/091540.html

Among the quotes that stand out to me:

Steffen Nurpmeso: "And what the *standard* would need, much more than that, and
in my opinion, is flock(1) (after we gained timeout(1))."

Harald van Dijk:
"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."

David Leonard:
"My first thought is that sponge may benefit from a flock option. This
would allow file users to avoid accessing the file in an intermediate
state. For example sponge -l would obtain a read lock first, then collects
input, then upgrade to a write lock, then replace the file's content.

     flock -s myfile -c cat myfile | sed -e s/foo/bar/g | sponge -l myfile
" 

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                          
2025-06-22 08:43 stephane       Note Added: 0007207                          
2025-06-26 15:28 eblake         Note Added: 0007211                          
2025-06-26 15:41 eblake         Note Edited: 0007211                         
2025-06-26 15:45 eblake         Note Added: 0007212                          
======================================================================


  • [1003.1(20... Austin Group Issue Tracker via austin-group-l at The Open Group
    • [1003... Austin Group Issue Tracker via austin-group-l at The Open Group
      • R... Steffen Nurpmeso via austin-group-l at The Open Group
    • [1003... Austin Group Issue Tracker via austin-group-l at The Open Group
    • [1003... Austin Group Issue Tracker via austin-group-l at The Open Group
      • R... Steffen Nurpmeso via austin-group-l at The Open Group
        • ... Steffen Nurpmeso via austin-group-l at The Open Group
    • [1003... Austin Group Issue Tracker via austin-group-l at The Open Group
    • [1003... Austin Group Issue Tracker via austin-group-l at The Open Group
    • [1003... Austin Group Issue Tracker via austin-group-l at The Open Group
    • [1003... Austin Group Issue Tracker via austin-group-l at The Open Group

Reply via email to