Re: [dev] [sbase] sponge v2

From: Galos, David <>
Date: Tue, 2 Jul 2013 15:39:06 -0400

> It also sucks. avoiding a temporary file is the whole point to sponge.
> otherwise:
> cat file | grep file > file_temp; mv file_temp file;

Actually, it would be
     tmp = $(mktemp)
     grep 'foo' file > $tmp
     cat $tmp > file

Not only that, but tmpfile(3) is safer with respect to race
conditions. You'll notice that even moreutils sponge always opens a
tempfile[1]. In fact, it's really stupid: first it fills up all your
remaining memory then, it writes all of that to a tempfile, which if
in a tmpfs-mounted /tmp will fail miserably.

Received on Tue Jul 02 2013 - 21:39:06 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 02 2013 - 21:48:05 CEST