Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Eli Schwartz Newsgroups: gnu.bash.bug Subject: Re: Undocumented feature: Unnamed fifo '<(:)' Date: Sun, 28 Jun 2020 17:27:47 -0400 Lines: 81 Approved: bug-bash@gnu.org Message-ID: References: <20200628134945.GB24863@medium.hauri> <6427.1593375682@jinx.noi.kre.to> <346bda2f-83dc-afda-d911-9688daefb10e@archlinux.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IPHdgFMsqET4FvQKOzFPbwAaPWok4Q044" X-Trace: usenet.stanford.edu 1593379681 6683 209.51.188.17 (28 Jun 2020 21:28:01 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Robert Elz Envelope-to: bug-bash@gnu.org X-Spam-BL-Results: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1593379672; bh=EmCUszB8pgJU3UqEJQL0FQ0tkduxtkFS7vsaDlg7HAo=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=x2BL2umXgLhpopqask9opBNwYZYi+427c/IFOAYX2YgmpbgMvZHZyaOxLKZn/02oz k/oiYSxZNTrzdKbpfP1xmhNVqK2vs3LqQVMZQmWY0+CoMfhILzApgSlEP3yi1p4V9u 4rsJCShdNNOzsYVbtHdunWoxMwBZPStWuDwMud/DCKMcTlzOXOVb1DgJbgyiRdRdlc CMRfqQNx8giQuLQt2xr+igiBDwi8AEUv7X5rKtlgIMzTu8eDtXZJGnsef/L11rGp9e PF5h+LsZ8zBml51cEegz5pa4XC6HYWMw73Hk2YkQVPAJ6nVrz8tkcIRjq/6Zt/htft sWIK39Ec1dhQG4qr9Qk69chQgj7NU/MQ1DYShP5rZhBH0/oljpiCOW7wH5CwY6Sdmw jxs0EQvb4YB0868yBmNHkC6EAKXtF0+chIMJkowOYrR8RSA6McFPwyWRFoPxFqiovv 4L0UkryrSOOqKotPkArv1B5vYY4a9KTTbj2ejJyk6Jj+acI3XUMpiXkj/baQl+QTjA tUIDskjWsNyeXqk7orP/5aFTHckrEqCZmGvml5Crk/GOMfE9EXcQr1SWPJqDwTwSrz VD5JcjWT+Vn19kgwzQPS4PJ6Y20YS4kEuwO1Hl3SZN7cn2i+k8fBbntPudBlvfjeH6 ICNiZNnMnxaqEOZSds6Xzx8E= X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 In-Reply-To: <6427.1593375682@jinx.noi.kre.to> Received-SPF: pass client-ip=2a01:4f8:160:6087::1; envelope-from=eschwartz@archlinux.org; helo=orion.archlinux.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <346bda2f-83dc-afda-d911-9688daefb10e@archlinux.org> X-Mailman-Original-References: <20200628134945.GB24863@medium.hauri> <6427.1593375682@jinx.noi.kre.to> Xref: csiph.com gnu.bash.bug:16476 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --IPHdgFMsqET4FvQKOzFPbwAaPWok4Q044 Content-Type: multipart/mixed; boundary="wFZNRNnj6yorCebaqfbXpa2T5CIp87fEZ" --wFZNRNnj6yorCebaqfbXpa2T5CIp87fEZ Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: quoted-printable On 6/28/20 4:21 PM, Robert Elz wrote: > I noticed that explanation, but like Dennis, I fail to see how the > complicated version does any more than pretend there are less forks > happening. Was the speed of this actually measured, and if so, where > are the comparative results? Sure, and that can be pointed out, but that's a long way away from what Dennis actually said, which is "why not just use a function", implying that the use or not of a function is relevant here. > Either way, to make the conversion, the date command needs to be run > (in the complicated version, setbuf as well, which means an extra exec > at least) - running a command means a fork, and all we have to start > with is bash, so bash needs to fork to run date, each time it needs > to run. >=20 > What evidence is there that the complicated way, with all of its extra > file opens, etc, is faster than the simple way, or involves less forks?= IIRC bash will (if it can) optimize out $(cmd) to fork+exec cmd, rather than fork bash, then fork+exec cmd. Perhaps the OP is assuming that the fifo dance will result in one fork, rather than two? Pointing out this flawed assumption is a useful data point, saying "why not just use a function" is not. (In fact, I'd assume the $(function) is actively a bad idea as it would prevent bash from optimizing out the $(/usr/bin/date) fork.) --=20 Eli Schwartz Arch Linux Bug Wrangler and Trusted User --wFZNRNnj6yorCebaqfbXpa2T5CIp87fEZ-- --IPHdgFMsqET4FvQKOzFPbwAaPWok4Q044 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEvSewel70XCra9w4EhIGKaBmvSpsFAl75C1MACgkQhIGKaBmv SptESA//ZQ/NDEaIZ5qezx0OAIfQyjOb4hTuHsYuCqxF7oTZxHlawxxKzu7cCwFV b7+SGtAffWDh7+C+LNK8qe8zeEiMyI+Yy9DKH7MByWA2bE56Wsa7C/c0USkB8oyG lhStokdOUxPUdPKE8pSU81E2nWEPEd9HrVALhvz+90nUnkTt6SpNjh7ZZgOgvdfn NK7qm+lhti5/C3/GyQOOw0oBa2EjR0D5mbLvHJ8cl/dsmsYjYptrRXnJ2NxcCtb9 PWGoIcb4L53+rBrcwEEC0fnA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