On 12/05/17 14:44, Konstantin Belousov wrote:
On Tue, Dec 05, 2017 at 02:00:00PM +0100, Hans Petter Selasky wrote:
On 12/05/17 13:58, Rodney W. Grimes wrote:
Further more, why does freebsd need this in base?
Hi,
I think this is useful. It could replace the "-i " (intermediate) option
for "sed" for example. It avoids creating temporary files when filtering
files, right?
Hi,
No, if process fails during the operation, user data is destroyed
irretrievable.
It depends what you are doing. If the compiler crashes while outputting
an object file and the atexit() hooks fail to remove the object file and
you re-run the build, bad things can still happen and nobody will notice.
From what I can see users must be aware of the limitations of any
command they use in a script. Should probably be noted in the sponge
manual page.
sponge could also have an atexit() hook to remove the processed file
upon failure. Typically when patching files in packages, it is a waste
of system resources to have a three step procedure, mv-process-mv,
because when the build is complete the files will be deleted anyway ....
>The usual trick of creating temporary file and renaming
ensure that old file is around until all data for new file is written
into buffer cache. With some existing filesystem support, it also
guarantees that the old file is around in case of the system crash.
This process could also be automated with sponge. If some option XXX is
set, backup the file first in a safe way, before writing it new. Further
because sponge is a single utility, it can lock the files in question
through the whole procedure to make the operation atomic w.r.t. the file
system. Can you lock files from scripts? And what about performance and
complexity?
All this assuming the tool' code matches its description, which is not.
--HPS
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"