From owner-svn-src-all@freebsd.org Tue Dec 5 16:06:24 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E36ABE6EF16; Tue, 5 Dec 2017 16:06:24 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from shxd.cx (mail.shxd.cx [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C610080832; Tue, 5 Dec 2017 16:06:24 +0000 (UTC) (envelope-from devin@shxd.cx) Received: from [64.201.244.132] (port=54721 helo=[10.0.0.109]) by shxd.cx with esmtps (TLSv1:AES256-SHA:256) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1eMFjj-000MSc-0P; Tue, 05 Dec 2017 16:06:23 +0000 Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r326554 - in head: . usr.bin/sponge usr.bin/sponge/tests usr.bin/tee From: Devin Teske X-Mailer: iPhone Mail (13G36) In-Reply-To: Date: Tue, 5 Dec 2017 08:06:21 -0800 Cc: Hans Petter Selasky , rgrimes@freebsd.org, cem@freebsd.org, Eitan Adler , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <16BDAEF5-87B3-482F-B5AB-372E128D0514@shxd.cx> References: <201712051258.vB5CwjQN051356@pdx.rh.CN85.dnsmgr.net> <22918eec-4c98-01e4-4c63-e145fbc6eab9@selasky.org> To: Matt Joras Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 16:06:25 -0000 > On Dec 5, 2017, at 7:53 AM, Matt Joras wrote: >=20 >=20 >=20 > On Dec 5, 2017 7:35 AM, "Devin Teske" wrote: >=20 > > On Dec 5, 2017, at 5:00 AM, 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 fi= les, right? > > > > --HPS > > >=20 > Wth is wrong with: >=20 > data=3D$( sed -e '...' somefile ) && > echo "$data" > somefile >=20 > or >=20 > set -e > data=3D... > echo "$data" > ... >=20 > or >=20 > exec 3< $( ... ) > EOF > cat > ... <&3 >=20 > or >=20 > (I digress) >=20 > Infinite variations, but the gist is that sponge looks to be trying to hel= p sh(1)/similar when help is unneeded. >=20 > Why buffer data into memory via fork-exec-pipe to sponge when you can buff= er to native namespace without pipe to sponge? >=20 > Am I missing something? Why do we need sponge(1)? > -- > Devin >=20 > I do believe you are sort of missing the point. It is a utility that is ex= plicitly useful in shell pipelines, so when you want to do things as one-lin= ers. I like the utility and use the one from ports and my own version in var= ious things here and there. It is a common utility installed in Linux distro= s and the top answer on Google for questions such as "redirect shell output t= o same file". I think the outrage about adding a tiny utility that's common e= lsewhere is a bit silly. >=20 > As for the implementation, I have my own version of sponge (hobby program w= ritten in rust so not base-worthy), and it uses explicit temporary files for= larger outputs.=20 >=20 > Matt The problems I have are: 1. Should be in ports Not pre-installed on Linux, why should we have it in base? If in base, people will target it thinking it solves a need that can't other= wise be solved and thus end up creating a script that is less portable becau= se it is encumbered with dependencies specific to our base. 2. Teaches bad practice sed ... somefile | sponge somefile Ignores if there is a sed error and indiscriminately zeroes somefile. 3. Solution in search of a problem --=20 Devin=