From unknown Sat Jun 21 05:09:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11246: Is this a bug in tee? Resent-From: Adrian May Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 15 Apr 2012 18:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11246 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 11246@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.133451340528888 (code B ref -1); Sun, 15 Apr 2012 18:11:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Apr 2012 18:10:05 +0000 Received: from localhost ([127.0.0.1]:59891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SJTtl-0007Vt-0L for submit@debbugs.gnu.org; Sun, 15 Apr 2012 14:10:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43995) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SJNXf-0004Gk-0z for submit@debbugs.gnu.org; Sun, 15 Apr 2012 07:22:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJNWC-00007K-8K for submit@debbugs.gnu.org; Sun, 15 Apr 2012 07:21:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:53706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJNWC-00007G-2s for submit@debbugs.gnu.org; Sun, 15 Apr 2012 07:21:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJNWA-0002rU-G5 for bug-coreutils@gnu.org; Sun, 15 Apr 2012 07:21:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJNW8-00006S-NF for bug-coreutils@gnu.org; Sun, 15 Apr 2012 07:21:17 -0400 Received: from mail-ee0-f41.google.com ([74.125.83.41]:49945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJNW8-00006B-9j for bug-coreutils@gnu.org; Sun, 15 Apr 2012 07:21:16 -0400 Received: by eeke53 with SMTP id e53so1144828eek.0 for ; Sun, 15 Apr 2012 04:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=05ZKFmwtYjCsEUG4l1PCmNianpjgp4ZeF6UnwPE/IWI=; b=y7rHT0tArQtCEBd7ZEyNcbbdfX4BL3dVGTMStUH5ZcSH8Jbs42lXSb5cpyE4cooBlw hE7StpTGeSC0U4QnNbFW5HQZ50z+Us6Mo1Jki+OijLdUw6zYNyLQWKIYPSAlXcmfJ+HE h4gSAsdXCLnCFwRDmQGV/WQwVbWjpkZJePAu+NWP2lpFyr6qEotu4BEZckp8Qk7eOHM8 4nX1wO1JXF5dwaSiQr4fmG3hMnbdYv8gsPE8l4/cz7xhoInWobOdui99QylqC8pq719u jGD9Xal7iCS8tdk+BxXgA8EJCwWys/Qjx+jkUqNMJ0Mf23PlHVxTD91/BFkZhzp5GJa1 3fEA== MIME-Version: 1.0 Received: by 10.213.108.199 with SMTP id g7mr574042ebp.143.1334488873662; Sun, 15 Apr 2012 04:21:13 -0700 (PDT) Received: by 10.213.7.19 with HTTP; Sun, 15 Apr 2012 04:21:13 -0700 (PDT) Date: Sun, 15 Apr 2012 19:21:13 +0800 Message-ID: From: Adrian May Content-Type: multipart/alternative; boundary=001517503bfe45785604bdb5e7c7 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Mailman-Approved-At: Sun, 15 Apr 2012 14:10:03 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --001517503bfe45785604bdb5e7c7 Content-Type: text/plain; charset=UTF-8 ad@pub:~/junk$ echo abcde | tee >(tr a 1) | tr b 2 a2cde 12cde I'd have expected 1bcde instead of 12cde. It seems like the tr b 2 is acting early on the stream going into tr a 2. This is a ubuntu server 10.04 machine. Adrian. --001517503bfe45785604bdb5e7c7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
ad@pub:~/junk$ echo abcde | tee >(tr a 1) | tr b 2
a2cde<= /div>
12cde

I'd have expected 1bcde instea= d of 12cde. It seems like the tr b 2 is acting early on the stream going in= to tr a 2.=C2=A0

This is a ubuntu server 10.04 machine.

Adrian.




--001517503bfe45785604bdb5e7c7-- From unknown Sat Jun 21 05:09:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11246: Is this a bug in tee? References: Resent-From: "Alan Curry" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 15 Apr 2012 22:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11246 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: adrian.alexander.may@gmail.com (Adrian May) Cc: 11246@debbugs.gnu.org Received: via spool by 11246-submit@debbugs.gnu.org id=B11246.133452968220273 (code B ref 11246); Sun, 15 Apr 2012 22:42:01 +0000 Received: (at 11246) by debbugs.gnu.org; 15 Apr 2012 22:41:22 +0000 Received: from localhost ([127.0.0.1]:60044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SJY8I-0005Gw-4c for submit@debbugs.gnu.org; Sun, 15 Apr 2012 18:41:22 -0400 Received: from c-68-60-252-82.hsd1.in.comcast.net ([68.60.252.82]:52920 helo=kosh.dhis.org) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1SJY8G-0005Gq-K3 for 11246@debbugs.gnu.org; Sun, 15 Apr 2012 18:41:21 -0400 Received: (qmail 3583 invoked by uid 1000); 15 Apr 2012 22:39:48 -0000 Message-ID: <20120415223948.3582.qmail@kosh.dhis.org> From: "Alan Curry" Date: Sun, 15 Apr 2012 17:39:47 -0500 (GMT+5) In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 2.4 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Adrian May writes: > > ad@pub:~/junk$ echo abcde | tee >(tr a 1) | tr b 2 > a2cde > 12cde > > I'd have expected 1bcde instead of 12cde. It seems like the tr b 2 is > acting early on the stream going into tr a 2. > > This is a ubuntu server 10.04 machine. > > Adrian. > [...] Content analysis details: (2.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.3 RCVD_IN_PBL RBL: Received via a relay in Spamhaus PBL [68.60.252.82 listed in zen.spamhaus.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 RCVD_IN_SORBS_DUL RBL: SORBS: sent directly from dynamic IP address [68.60.252.82 listed in dnsbl.sorbs.net] 1.0 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 2.4 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Adrian May writes: > > ad@pub:~/junk$ echo abcde | tee >(tr a 1) | tr b 2 > a2cde > 12cde > > I'd have expected 1bcde instead of 12cde. It seems like the tr b 2 is > acting early on the stream going into tr a 2. > > This is a ubuntu server 10.04 machine. > > Adrian. > [...] Content analysis details: (2.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.3 RCVD_IN_PBL RBL: Received via a relay in Spamhaus PBL [68.60.252.82 listed in zen.spamhaus.org] 0.0 RCVD_IN_SORBS_DUL RBL: SORBS: sent directly from dynamic IP address [68.60.252.82 listed in dnsbl.sorbs.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 1.0 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS Adrian May writes: > > ad@pub:~/junk$ echo abcde | tee >(tr a 1) | tr b 2 > a2cde > 12cde > > I'd have expected 1bcde instead of 12cde. It seems like the tr b 2 is > acting early on the stream going into tr a 2. > > This is a ubuntu server 10.04 machine. > > Adrian. > The shell sets up the pipeline, and your shell is doing it stupidly. With zsh, you'd get the correct result: % echo abcde | tee >(tr a 1) | tr b 2 a2cde 1bcde ksh and bash recently copied the process substitution feature from zsh, and they haven't got it right yet. -- Alan Curry From unknown Sat Jun 21 05:09:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11246: Is this a bug in tee? Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 15 Apr 2012 23:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11246 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Adrian May Cc: 11246@debbugs.gnu.org Received: via spool by 11246-submit@debbugs.gnu.org id=B11246.133453091522056 (code B ref 11246); Sun, 15 Apr 2012 23:02:01 +0000 Received: (at 11246) by debbugs.gnu.org; 15 Apr 2012 23:01:55 +0000 Received: from localhost ([127.0.0.1]:60064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SJYSA-0005je-VQ for submit@debbugs.gnu.org; Sun, 15 Apr 2012 19:01:55 -0400 Received: from joseki.proulx.com ([216.17.153.58]:58866) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SJYS6-0005jS-8A; Sun, 15 Apr 2012 19:01:52 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 43989211DA; Sun, 15 Apr 2012 17:00:17 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 15B692DC39; Sun, 15 Apr 2012 17:00:16 -0600 (MDT) Date: Sun, 15 Apr 2012 17:00:16 -0600 From: Bob Proulx Message-ID: <20120415230016.GA5043@hysteria.proulx.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) tags 11246 + notabug close 11246 thanks Adrian May wrote: > ad@pub:~/junk$ echo abcde | tee >(tr a 1) | tr b 2 > a2cde > 12cde > > I'd have expected 1bcde instead of 12cde. It seems like the tr b 2 is > acting early on the stream going into tr a 2. I know you are thinking this somehow is related to 'tee'. But the construct you are using ">(...)" is a "Process Substitution" feature of the bash shell. I am assuming that you are using bash. You might be using another shell. Look in the bash documentation for process substitution and you will find all of the documentation for this feature. It has nothing to do with 'tee'. So whether it is happening early or late the place you really wanted to ask the question was to the help-bash@gnu.org mailing list instead of filing a bug report to coreutils. Because of this I am marking the coreutils bug report ticket as closed. This does not mean that discussion cannot continue. Please feel free to follow up here with more discussion. Now that the bug has been created it doesn't hurt any more to have more discussion in it. Might as well as far as that goes. At the root of your problem is that bash implements process substitution asynchronously. This is a terrible design misfeature. It places the write process into the background and does not wait for it to finish. This makes the feature almost impossible to be used without problems. Because of this design misfeature I never use this feature. It isn't suitable for anything except for the most casual of command line use. Here is a message where I reported this upstream and was told that I was the only one who had ever complained about it. If this is causing you problems then please submit it as a bug. Otherwise as it stands I am the only one complaining about it so far as I know. http://lists.gnu.org/archive/html/bug-bash/2007-09/msg00019.html Also recently on help-bash there was a discussion about this concept of process substitution. The thread starts here: http://lists.gnu.org/archive/html/help-bash/2012-01/msg00023.html There was a lot of good discussion about how process substution in bash works. I even submitted some diagrams describing the flow of data through the file descriptors. I think it was good stuff. Please read through that discussion and then let me know here on this bug report (To: 11246@debbugs.gnu.org) if that helped with the understanding or not. Bob From unknown Sat Jun 21 05:09:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#11246: Is this a bug in tee? Resent-From: Andreas Schwab Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 16 Apr 2012 08:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11246 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Bob Proulx Cc: Adrian May , 11246@debbugs.gnu.org Received: via spool by 11246-submit@debbugs.gnu.org id=B11246.133456583027118 (code B ref 11246); Mon, 16 Apr 2012 08:44:02 +0000 Received: (at 11246) by debbugs.gnu.org; 16 Apr 2012 08:43:50 +0000 Received: from localhost ([127.0.0.1]:35758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SJhXJ-00073K-9h for submit@debbugs.gnu.org; Mon, 16 Apr 2012 04:43:50 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:49370) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SJhXG-00073B-Rs for 11246@debbugs.gnu.org; Mon, 16 Apr 2012 04:43:47 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3VWNRN3bLcz3hhZq; Mon, 16 Apr 2012 10:43:42 +0200 (CEST) Received: from igel.home (ppp-93-104-132-43.dynamic.mnet-online.de [93.104.132.43]) by mail.mnet-online.de (Postfix) with ESMTPA id 3VWNRL5kZnz4KK5T; Mon, 16 Apr 2012 10:43:42 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 2EC53CA2AA; Mon, 16 Apr 2012 10:43:41 +0200 (CEST) From: Andreas Schwab References: <20120415230016.GA5043@hysteria.proulx.com> X-Yow: Mmmmmm-MMMMMM!! A plate of STEAMING PIECES of a PIG mixed with the shreds of SEVERAL CHICKENS!!... Oh BOY!! I'm about to swallow a TORN-OFF section of a COW'S LEFT LEG soaked in COTTONSEED OIL and SUGAR!! .. Let's see.. Next, I'll have the GROUND-UP flesh of CUTE, BABY LAMBS fried in the MELTED, FATTY TISSUES from a warm-blooded animal someone once PETTED!! ... YUM!! That was GOOD!! For DESSERT, I'll have a TOFU BURGER with BEAN SPROUTS on a stone-ground, WHOLE WHEAT BUN!! Date: Mon, 16 Apr 2012 10:43:41 +0200 In-Reply-To: <20120415230016.GA5043@hysteria.proulx.com> (Bob Proulx's message of "Sun, 15 Apr 2012 17:00:16 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.95 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Bob Proulx writes: > At the root of your problem is that bash implements process > substitution asynchronously. Why do you think this has anthing to do with asynchronism? It is obvious that the stdout of tr a 1 is connected to the pipe, which causes it to be filtered through tr b 2. How would a synchronous execution change anything here? Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."