From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 15:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 6900@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12825780462253 (code B ref -1); Mon, 23 Aug 2010 15:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Aug 2010 15:40:46 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnZ8c-0000aI-KK for submit@debbugs.gnu.org; Mon, 23 Aug 2010 11:40:46 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnYqE-0000Ru-H6 for submit@debbugs.gnu.org; Mon, 23 Aug 2010 11:21:43 -0400 Received: from lists.gnu.org ([199.232.76.165]:53663) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OnYrU-00056E-5J for submit@debbugs.gnu.org; Mon, 23 Aug 2010 11:23:00 -0400 Received: from [140.186.70.92] (port=49581 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnYrR-0004zZ-7e for bug-coreutils@gnu.org; Mon, 23 Aug 2010 11:22:59 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnYrO-0002Ad-Ri for bug-coreutils@gnu.org; Mon, 23 Aug 2010 11:22:55 -0400 Received: from bitwagon.com ([74.82.39.175]:47083) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OnYrO-0002AE-II for bug-coreutils@gnu.org; Mon, 23 Aug 2010 11:22:54 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for ; Mon, 23 Aug 2010 08:22:48 -0700 Message-ID: <4C729233.1060104@bitwagon.com> Date: Mon, 23 Aug 2010 08:22:27 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.0 (------) X-Mailman-Approved-At: Mon, 23 Aug 2010 11:40:41 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (------) mktemp: Please add an option which creates a fifo instead of a file or a directory. "--fifo" seems appropriate, although the abbreviation "-f" might be confused as a request for an ordinary file; and "-p" as in "--pipe" is already taken for "prefix". -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 16:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.12825815303940 (code B ref 6900); Mon, 23 Aug 2010 16:39:01 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 16:38:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ona2r-00011V-V1 for submit@debbugs.gnu.org; Mon, 23 Aug 2010 12:38:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ona2p-00011Q-Fj for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 12:38:48 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7NGe2Xs019771 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Aug 2010 12:40:03 -0400 Received: from [10.3.113.18] ([10.3.113.18]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7NGe1dA018349; Mon, 23 Aug 2010 12:40:01 -0400 Message-ID: <4C72A460.8050107@redhat.com> Date: Mon, 23 Aug 2010 10:40:00 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> In-Reply-To: <4C729233.1060104@bitwagon.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Spam-Score: -10.1 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -10.1 (----------) On 08/23/2010 09:22 AM, John Reiser wrote: > mktemp: Please add an option which creates a fifo > instead of a file or a directory. "--fifo" seems appropriate, > although the abbreviation "-f" might be confused as a request > for an ordinary file; and "-p" as in "--pipe" is already taken > for "prefix". Thanks for the report. However, I'm inclined to mark this bug as a duplicate of 6330, for the reasons already documented in this long thread: http://lists.gnu.org/archive/html/bug-coreutils/2010-06/msg00013.html -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 17:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.12825849075414 (code B ref 6900); Mon, 23 Aug 2010 17:36:01 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 17:35:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnavL-0001PH-5b for submit@debbugs.gnu.org; Mon, 23 Aug 2010 13:35:07 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Onau3-0001OI-B0 for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 13:33:48 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Mon, 23 Aug 2010 10:35:01 -0700 Message-ID: <4C72B130.6050805@bitwagon.com> Date: Mon, 23 Aug 2010 10:34:40 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> In-Reply-To: <4C72A460.8050107@redhat.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.6 (---) X-Mailman-Approved-At: Mon, 23 Aug 2010 13:35:05 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -3.5 (---) On 08/23/2010 09:40 AM, Eric Blake wrote: > On 08/23/2010 09:22 AM, John Reiser wrote: >> mktemp: Please add an option which creates a fifo >> [snip] > > Thanks for the report. However, I'm inclined to mark this bug as a > duplicate of 6330, for the reasons already documented in this long thread: > http://lists.gnu.org/archive/html/bug-coreutils/2010-06/msg00013.html The suggested alternative (use "mktemp -d" to create a uniquely-named directory, then use mkfifo of an arbitrary fixed name within that directory) satisfies only some of the desired properties. Yes, it's a fifo with a safely-created unique name. However, removing that fifo leaves behind the directory, and the directory also occupies its own space [often a few kilobytes] even during the lifetime of the fifo. It is somewhat ironic that Mr. Blake's .sig promotes "Libvirt virtual- ization library", because the alternative suggestion is not a faithful virtualization of what "mktemp --fifo" should be. -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 18:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.12825863796011 (code B ref 6900); Mon, 23 Aug 2010 18:00:03 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 17:59:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnbJ4-0001Yu-VJ for submit@debbugs.gnu.org; Mon, 23 Aug 2010 13:59:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnbJ2-0001Yp-4q for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 13:59:37 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7NI0pBb005559 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Aug 2010 14:00:52 -0400 Received: from [10.3.113.18] ([10.3.113.18]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7NI0pDY004056; Mon, 23 Aug 2010 14:00:51 -0400 Message-ID: <4C72B752.8080406@redhat.com> Date: Mon, 23 Aug 2010 12:00:50 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> In-Reply-To: <4C72B130.6050805@bitwagon.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.1 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -10.1 (----------) On 08/23/2010 11:34 AM, John Reiser wrote: > On 08/23/2010 09:40 AM, Eric Blake wrote: >> On 08/23/2010 09:22 AM, John Reiser wrote: >>> mktemp: Please add an option which creates a fifo >>> [snip] >> >> Thanks for the report. However, I'm inclined to mark this bug as a >> duplicate of 6330, for the reasons already documented in this long thread: >> http://lists.gnu.org/archive/html/bug-coreutils/2010-06/msg00013.html > > The suggested alternative (use "mktemp -d" to create a uniquely-named > directory, then use mkfifo of an arbitrary fixed name within that directory) > satisfies only some of the desired properties. Yes, it's a fifo with > a safely-created unique name. However, removing that fifo leaves behind > the directory, and the directory also occupies its own space [often > a few kilobytes] even during the lifetime of the fifo. If we add 'mktemp --fifo', then where do we stop? What about creating a uniquely named symlink? Or a new shared memory object? http://lists.gnu.org/archive/html/bug-coreutils/2010-06/msg00033.html And did you not read in that thread about the arguments that recursively moving an entire temporary directory hierarchy with 'rm -rf dir' is just as short in shell code as 'rm -f fifo'? A couple kilobytes of disk space for a temporary directory given today's storage technologies is not a very convincing argument. The whole argument of Unix is that each tool does one thing well, so that the combination of tools can do everything. mktemp should NOT be bloated just to reproduce the functionality of mkfifo or of ln, when those tools can already be paired nicely. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 20:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128259598510511 (code B ref 6900); Mon, 23 Aug 2010 20:40:03 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 20:39:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ondo0-0002jU-Rd for submit@debbugs.gnu.org; Mon, 23 Aug 2010 16:39:45 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Ondnx-0002jP-2O for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 16:39:41 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Mon, 23 Aug 2010 13:40:55 -0700 Message-ID: <4C72DCC2.2080009@bitwagon.com> Date: Mon, 23 Aug 2010 13:40:34 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> In-Reply-To: <4C72B752.8080406@redhat.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.9 (--) On 08/23/2010 11:00 AM, Eric Blake wrote: [snip] > If we add 'mktemp --fifo', then where do we stop? What about creating a > uniquely named symlink? Or a new shared memory object? There are several possible answers to "Where do we stop?". 1) Stop at current code [no changes.] 2) Stop when user requests stop. 3) Add --symlink and --hardlink. Each requires another string argument. Limiting the number of string arguments is a defensible argument: it is based on an extrinsic property. 4) Add --block and --character device nodes. Each requires two non-negative integer arguments, and mktemp should check this in order to provide good Usability. 5) Stop when all file types of S_IFMT () have been covered. This would add S_IFSOCK, which is gnarly indeed. 6) Stop after shmem, which is not even a file type. I favor drawing the line between 2) and 3), which means adding --fifo and not the others. Two independent user requests [one of which includes code!] within a few months show a definite need. > http://lists.gnu.org/archive/html/bug-coreutils/2010-06/msg00033.html > > And did you not read in that thread about the arguments that recursively > moving an entire temporary directory hierarchy with 'rm -rf dir' is just > as short in shell code as 'rm -f fifo'? The user of such a fifo must be taught that one unlink() or "rm -f fifo" does recover all the resources. That is a significant reduction in *each* of the five software metric dimensions: Functionality, Usability, Performance, Maintenance, and Supportability. The hard task is finding all the places that [should] remove objects from the filesystem, and teaching them to remove the directory of such a fifo, too. For shell, a dirname() must be applied. For C code, then the code must figure out [or be told] that the name is special, parse the name, and perform another unlink(). This is not trivial. > A couple kilobytes of disk > space for a temporary directory given today's storage technologies is > not a very convincing argument. One of the places where I want such fifos [many hundreds of them] is in a filesystem that resides on a much smaller flash memory device. Occupying a megabyte more than necessary can be fatal. > The whole argument of Unix is that each tool does one thing well, so > that the combination of tools can do everything. mktemp should NOT be > bloated just to reproduce the functionality of mkfifo or of ln, when > those tools can already be paired nicely. It's not nice to get a compound object (directory plus fifo) when a singleton is expected, and when the compound object cannot be treated identically to the singleton. The properties are different, not "reproduced"; and that makes it not "bloat." -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 21:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128259849711546 (code B ref 6900); Mon, 23 Aug 2010 21:22:02 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 21:21:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OneSW-00030B-Qb for submit@debbugs.gnu.org; Mon, 23 Aug 2010 17:21:37 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OneST-000305-SL for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 17:21:34 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L7M00K7KJDROYH6@vms173003.mailsrvcs.net> for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 16:22:39 -0500 (CDT) Message-id: <4C72E69E.2070503@cs.ucla.edu> Date: Mon, 23 Aug 2010 14:22:38 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> In-reply-to: <4C72DCC2.2080009@bitwagon.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (--) On 08/23/2010 01:40 PM, John Reiser wrote: > Two independent user requests [one of which > includes code!] within a few months show a definite need. The two requests would have been more convincing if they demonstrated a definite need. Neither did: they both just said the equivalent of "we need a new option". Ordinarily, plain "|" does a good job of creating temporary fifos with a minimum of fuss. Perhaps there are exceptional cases where plain "|" doesn't suffice, but no examples have been given. We need these examples in order to judge how important the need is, in order to balance this need against the other need of keeping coreutils simple and general. From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 22:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128260377217051 (code B ref 6900); Mon, 23 Aug 2010 22:50:02 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 22:49:32 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Onfpc-0004Qw-Ej for submit@debbugs.gnu.org; Mon, 23 Aug 2010 18:49:32 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OnfpY-0004Qj-Su for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 18:49:29 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Mon, 23 Aug 2010 15:50:06 -0700 Message-ID: <4C72FB09.40309@bitwagon.com> Date: Mon, 23 Aug 2010 15:49:45 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> In-Reply-To: <4C72E69E.2070503@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.6 (--) On 08/23/2010 02:22 PM, Paul Eggert wrote: > On 08/23/2010 01:40 PM, John Reiser wrote: >> Two independent user requests [one of which >> includes code!] within a few months show a definite need. > > The two requests would have been more convincing if they demonstrated > a definite need. Neither did: they both just said the equivalent > of "we need a new option". Consider a pipeline with three logical stages: A | B1 | C where B1 is a shell script. At some point B1 notices that one parallel process B2 becomes desirable, such that B2 also pipes into the same C as B1, and output from a *subset* of the multiple sequential subprocesses of B1 pipes into the same B2 [view in constant-width font]: A | B1 | C \ / B2 where both slashes also indicate fifos. The fifo from B2 to C can be the same fifo as from B1 to C, just by forking B1 and inheriting stdout. However the fifo from B1 to B2 cannot be an anonymous pipe, but must be named because some of the subprocesses of B1 continue to pipe their output directly into C. It's the switching back and forth between "stdout goes directly to C" and "stdout goes to B2 first, and then to C" that requires a named fifo. Some subprocesses of B1 will direct their output into B2 by shell redirection "> $fifo_B1_B2". And yes, I know that B1 must hold open the write end of the fifo; I use: sleep 999000 > $fifo_B1_B2 & Finally, the $fifo_B1_B2 should be as invisible as possible when viewed from outside the A|B1|C pipeline. All together, that's why I want "mktemp --fifo". [Process C is 'cpio'. Process A is 'find'. Process B1 is a filter which is mostly pass-through but sometimes uncovers embedded filenames that must come along for the ride. Process B2 has large setup cost, but is 100% parallelizable with B1. Filenames are written singly, and are small enough to receive atomic passage through the pipes.] -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 22:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: Paul Eggert , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128260408817521 (code B ref 6900); Mon, 23 Aug 2010 22:55:02 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 22:54:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Onfug-0004YY-VF for submit@debbugs.gnu.org; Mon, 23 Aug 2010 18:54:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Onfue-0004YL-8v for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 18:54:45 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7NMu0lk019025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Aug 2010 18:56:00 -0400 Received: from [10.3.113.18] ([10.3.113.18]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7NMtxqI028332; Mon, 23 Aug 2010 18:55:59 -0400 Message-ID: <4C72FC7E.8090206@redhat.com> Date: Mon, 23 Aug 2010 16:55:58 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C72FB09.40309@bitwagon.com> In-Reply-To: <4C72FB09.40309@bitwagon.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.1 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -10.1 (----------) On 08/23/2010 04:49 PM, John Reiser wrote: > On 08/23/2010 02:22 PM, Paul Eggert wrote: >> On 08/23/2010 01:40 PM, John Reiser wrote: >>> Two independent user requests [one of which >>> includes code!] within a few months show a definite need. >> >> The two requests would have been more convincing if they demonstrated >> a definite need. Neither did: they both just said the equivalent >> of "we need a new option". > > Consider a pipeline with three logical stages: A | B1 | C > where B1 is a shell script. At some point B1 notices that one > parallel process B2 becomes desirable, such that B2 also pipes > into the same C as B1, and output from a *subset* of the multiple > sequential subprocesses of B1 pipes into the same B2 [view in > constant-width font]: > A | B1 | C > \ / > B2 > where both slashes also indicate fifos. Thanks for the example scenario. Next, could you please show the shell code that you are currently using, along with a version with your proposed 'mktemp --fifo', to show the difference in usage paradigms between the two approaches? We may be able to help you efficiently re-write your existing code into an equally manageable but more portable solution using existing tools, or it may help to convince us that the shorthand is truly useful. But without seeing actual usage examples, I can't say. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 23 Aug 2010 23:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: John Reiser , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128260733521360 (code B ref 6900); Mon, 23 Aug 2010 23:49:01 +0000 Received: (at 6900) by debbugs.gnu.org; 23 Aug 2010 23:48:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ongl4-0005YT-BM for submit@debbugs.gnu.org; Mon, 23 Aug 2010 19:48:54 -0400 Received: from vms173017pub.verizon.net ([206.46.173.17]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ongl2-0005YM-2B for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 19:48:53 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173017.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L7M005BYQ7BHBC8@vms173017.mailsrvcs.net> for 6900@debbugs.gnu.org; Mon, 23 Aug 2010 18:50:00 -0500 (CDT) Message-id: <4C730927.3090109@cs.ucla.edu> Date: Mon, 23 Aug 2010 16:49:59 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C72FB09.40309@bitwagon.com> <4C72FC7E.8090206@redhat.com> In-reply-to: <4C72FC7E.8090206@redhat.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (--) On 08/23/2010 03:55 PM, Eric Blake wrote: > We may be able to help you efficiently re-write your existing code into > an equally manageable but more portable solution using existing tools, > or it may help to convince us that the shorthand is truly useful. I agree that a full example would be helpful. Here's a quick sketch of a shell script that solves the stated problem without using a named fifo. Without the full example it's hard to say whether this approach would work well in the existing code. #! /bin/sh nl=' ' a() { for i in 0 1 2 3 4 5; do echo B$i; echo C$i; done; } b1() { start_b2=$nl while read command do case $command in (C*) printf '%s\n' "$command" >&3;; (B*) printf '%s\n' "$start_b2$command"; start_b2=;; esac done } maybe_b2() { read line && sed 's/^./D/'; } c() { sed 's/^/E/'; } a | (b1 | maybe_b2) 3>&1 | c From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 17:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128267168022286 (code B ref 6900); Tue, 24 Aug 2010 17:42:02 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 17:41:20 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnxUt-0005nP-2Z for submit@debbugs.gnu.org; Tue, 24 Aug 2010 13:41:19 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OnxUr-0005nI-MZ for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 13:41:18 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Tue, 24 Aug 2010 10:42:29 -0700 Message-ID: <4C740470.8060604@bitwagon.com> Date: Tue, 24 Aug 2010 10:42:08 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> In-Reply-To: <4C72E69E.2070503@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.6 (--) > The two requests would have been more convincing if they demonstrated > a definite need. Another case: "pipe" stderr into a separate pipeline from stdout. This is useful for stderr as a status channel. fifo_stderr1=$(mktemp --fifo stderr.XXXXXX) fifo_stderr2=$(mktemp --fifo stderr.XXXXXX) listener1 < $fifo_stderr1 & listener2 < $fifo_stderr2 & cmd1 2> $fifo_stderr1 | cmd2 2> $fifo_stderr2 Another case: Use file descriptor 3 as a command and control channel. Output has two default file descriptors (stdout and stderr), why not input (stdin and cmdin)? This is especially helpful for repairing a nest of processes that are connected by pipes. fifo_cmdin1=$(mktemp --fifo cmdin.XXXXXX); sleep 999000 > $fifo_cmdin1 & fifo_cmdin2=$(mktemp --fifo cmdin.XXXXXX); sleep 999000 > $fifo_cmdin2 & cmd1 3< $fifo_cmdin1 | cmd2 3< $fifo_cmdin2 & echo quit > $fifo_cmdin1 -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 18:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128267294622868 (code B ref 6900); Tue, 24 Aug 2010 18:03:01 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 18:02:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnxpI-0005wn-Td for submit@debbugs.gnu.org; Tue, 24 Aug 2010 14:02:25 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OnxpG-0005wg-SG for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 14:02:23 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Tue, 24 Aug 2010 11:03:38 -0700 Message-ID: <4C740965.2030102@bitwagon.com> Date: Tue, 24 Aug 2010 11:03:17 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C72FB09.40309@bitwagon.com> <4C72FC7E.8090206@redhat.com> <4C730927.3090109@cs.ucla.edu> In-Reply-To: <4C730927.3090109@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.5 (--) On 08/23/2010 04:49 PM, Paul Eggert wrote: > Here's a quick sketch > of a shell script that solves the stated problem without using a > named fifo. [snip] > maybe_b2() { read line && sed 's/^./D/'; } > a | (b1 | maybe_b2) 3>&1 | c Thank you for reminding me about using "3>&1" for "fan-in" multiplexing. This can work for B2, B3, ..., B8 but cannot handle more because shell is allowed to balk at redirecting fd greater than 9. It can be limited further if any of the Bi already use other low file descriptors. I also prefer to think about the situation as "B1 is doing fan-out multiplexing" rather than "C is doing fan-in multiplexing", because the "C" end is more "constant" and the "B" end is more "variable". I dislike the part "(b1 | maybe_b2)" because in practice it tends to be fragile. When things go wrong it is hard to diagnose and recover. Also, I do not see how to extend it for the case of more than one conditional process whose startup should be delayed (B3, B4, ...), such as the 'sed' in "read line && sed ...". -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 18:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128267470423611 (code B ref 6900); Tue, 24 Aug 2010 18:32:02 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 18:31:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnyHf-00068m-Ui for submit@debbugs.gnu.org; Tue, 24 Aug 2010 14:31:44 -0400 Received: from vms173005pub.verizon.net ([206.46.173.5]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnyHd-00068g-Ig for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 14:31:42 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L7O00E6W66QR0K5@vms173005.mailsrvcs.net> for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 13:32:51 -0500 (CDT) Message-id: <4C741051.405@cs.ucla.edu> Date: Tue, 24 Aug 2010 11:32:49 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C740470.8060604@bitwagon.com> In-reply-to: <4C740470.8060604@bitwagon.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (--) On 08/24/2010 10:42 AM, John Reiser wrote: > Another case: "pipe" stderr into a separate pipeline from stdout. > This is useful for stderr as a status channel. > > fifo_stderr1=$(mktemp --fifo stderr.XXXXXX) > fifo_stderr2=$(mktemp --fifo stderr.XXXXXX) > listener1< $fifo_stderr1& > listener2< $fifo_stderr2& > cmd1 2> $fifo_stderr1 | cmd2 2> $fifo_stderr2 For this example, it's simpler (and does not use any more processes) to follow Eric's suggestion to use mktemp -d to create a directory to hold the named fifos, to put the named fifos in that directory, and then to clean up with 'rm -r', with something like this: dir=$(mktemp -d dir.XXXXXX) mkfifo $dir/1 $dir/2 listener1 < $dir/1 listener2 < $dir/2 cmd1 2> $dir/1 | cmd2 2> $dir/2 This mktemp -d version is easier to clean up after, as 'rm -fr $dir' is easier to understand and read than 'rm -f $fifo_stderr1 $fifo_stderr1'. The simplicity of cleanup becomes a greater advantage as the number of named fifos (and other temporaries) grows. Better yet, do not use named fifos, since pipes suffice: (cmd1 2>&1 >&3 | listener1) 3>&1 | (cmd2 2>&1 >&3 | listener2) 3>&1 Pipes are simpler and more robust, as they do not need 'rm' afterwards, and you don't need to worry about what to do when mktemp or mkfifo fails. > Another case: Use file descriptor 3 as a command and control channel. > Output has two default file descriptors (stdout and stderr), why not > input (stdin and cmdin)? This is especially helpful for repairing a > nest of processes that are connected by pipes. > > fifo_cmdin1=$(mktemp --fifo cmdin.XXXXXX); sleep 999000> $fifo_cmdin1& > fifo_cmdin2=$(mktemp --fifo cmdin.XXXXXX); sleep 999000> $fifo_cmdin2& > cmd1 3< $fifo_cmdin1 | cmd2 3< $fifo_cmdin2& > echo quit> $fifo_cmdin1 Again, once things get this complicated, it doesn't cost any more processes to use a temporary directory, with something like this: dir=$(mktemp -d dir.XXXXXX) mkfifo $dir/1 $dir/2 listener1 < $dir/1 listener2 < $dir/2 cmd1 2> $dir/1 | cmd2 2> $dir/2 This example can also be simplified and made more robust by using pipes instead of named fifos, as follows: (echo quit 1 | cmd1 3<&0 <&4) 4<&0 | (: | cmd2 3<&0 <&4) 4<&0 From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 18:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128267507323853 (code B ref 6900); Tue, 24 Aug 2010 18:38:02 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 18:37:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnyNc-0006Cg-RI for submit@debbugs.gnu.org; Tue, 24 Aug 2010 14:37:52 -0400 Received: from vms173013pub.verizon.net ([206.46.173.13]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnyNa-0006CX-3Z for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 14:37:51 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L7O00AVV6H8KI68@vms173013.mailsrvcs.net> for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 13:39:09 -0500 (CDT) Message-id: <4C7411CC.507@cs.ucla.edu> Date: Tue, 24 Aug 2010 11:39:08 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C72FB09.40309@bitwagon.com> <4C72FC7E.8090206@redhat.com> <4C730927.3090109@cs.ucla.edu> <4C740965.2030102@bitwagon.com> In-reply-to: <4C740965.2030102@bitwagon.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (--) From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 19:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128267641924461 (code B ref 6900); Tue, 24 Aug 2010 19:01:01 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 19:00:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnyjK-0006MU-Mb for submit@debbugs.gnu.org; Tue, 24 Aug 2010 15:00:18 -0400 Received: from vms173005pub.verizon.net ([206.46.173.5]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnyjI-0006MN-42 for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 15:00:17 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L7O00ERS7I0R0S5@vms173005.mailsrvcs.net> for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 14:01:13 -0500 (CDT) Message-id: <4C7416F8.207@cs.ucla.edu> Date: Tue, 24 Aug 2010 12:01:12 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C72FB09.40309@bitwagon.com> <4C72FC7E.8090206@redhat.com> <4C730927.3090109@cs.ucla.edu> <4C740965.2030102@bitwagon.com> In-reply-to: <4C740965.2030102@bitwagon.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (--) On 08/24/2010 11:03 AM, John Reiser wrote: > This can work for B2, B3, ..., B8 but cannot handle more because shell > is allowed to balk at redirecting fd greater than 9. That is not a problem in practice. The limit of 10 descriptors does not mean that one can't create more than 10 pipes in one's shell script. All it means is that one can't have more than 10 useful pipes active at any given position in one's shell script. I've never had the need to have more than 10 pipes connected to a component, and I imagine that any component that needs more than 10 pipes connected to it should be simplified anyway. > I also prefer to think about the situation as "B1 is doing fan-out > multiplexing" rather than "C is doing fan-in multiplexing", because > the "C" end is more "constant" and the "B" end is more "variable". OK, but that sort of high-level thinking is one level of abstraction above named fifos and pipes, and in this case one can implement it in terms of either named fifos or pipes. Admittedly one needs to get used to the implementation strategy. > I dislike the part "(b1 | maybe_b2)" because in practice it tends to > be fragile. When things go wrong it is hard to diagnose and > recover. True, but it's hard to diagnose named fifos as well. I can use "tee" to debug either sort of shell script, and don't find it any harder to debug the piped version. I'm not sure what is meant by "recover". > Also, I do not see how to extend it for the case of more than one > conditional process whose startup should be delayed (B3, B4, ...), > such as the 'sed' in "read line&& sed ...". I don't quite follow the question, but if we're talking about multiple file descriptors for b1, each treated like the pipe to b2, surely this can be done with something like this: a | ((b1 3>&1 >&5 | maybe_b3) 4>&1 >&5 | maybe_b4) 5>&1 | c Here b1's file descriptor 3 goes to b3, and its file descriptor 4 goes to b4. From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 19:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128267740524878 (code B ref 6900); Tue, 24 Aug 2010 19:17:02 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 19:16:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnyzE-0006TD-IR for submit@debbugs.gnu.org; Tue, 24 Aug 2010 15:16:44 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OnyzC-0006T8-Fh for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 15:16:43 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Tue, 24 Aug 2010 12:17:57 -0700 Message-ID: <4C741AD0.1070604@bitwagon.com> Date: Tue, 24 Aug 2010 12:17:36 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C740470.8060604@bitwagon.com> <4C741051.405@cs.ucla.edu> In-Reply-To: <4C741051.405@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.5 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.5 (--) On 08/24/2010 11:32 AM, Paul Eggert wrote: [snip] > Again, once things get this complicated, it doesn't cost any more > processes to use a temporary directory, with something like this: > > dir=$(mktemp -d dir.XXXXXX) > mkfifo $dir/1 $dir/2 > listener1 < $dir/1 > listener2 < $dir/2 > cmd1 2> $dir/1 | cmd2 2> $dir/2 > > This example can also be simplified and made more robust by using > pipes instead of named fifos, as follows: > > (echo quit 1 | cmd1 3<&0 <&4) 4<&0 | > (: | cmd2 3<&0 <&4) 4<&0 That simplification loses functionality because it "binds" the cmdin channels to a specific process or pipeline. I gave the example "echo quit > $fifo_cmdin1" only to emphasize that the command- and-control inputs are separate from the "main" dataflow which goes through the regular pipes. When I want to control a pipeline or nest of processes interactively, then I don't know in advance which process, which commands, or in which sequence to give them. Using fifos allows for arbitrary flexibility of "fanout multiplexing" my interactive commands. I choose which fifo for each command, at the time that the I give the command. That cannot be done with fixed anonymous pipes. -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 20:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128268041226200 (code B ref 6900); Tue, 24 Aug 2010 20:07:01 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 20:06:52 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Onzlk-0006oW-2F for submit@debbugs.gnu.org; Tue, 24 Aug 2010 16:06:52 -0400 Received: from vms173007pub.verizon.net ([206.46.173.7]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Onzlh-0006oP-Kz for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 16:06:50 -0400 Received: from [192.168.1.10] ([unknown] [71.189.109.235]) by vms173007.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L7O00KUJAL5AWM2@vms173007.mailsrvcs.net> for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 15:07:54 -0500 (CDT) Message-id: <4C742699.2060006@cs.ucla.edu> Date: Tue, 24 Aug 2010 13:07:53 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C740470.8060604@bitwagon.com> <4C741051.405@cs.ucla.edu> <4C741AD0.1070604@bitwagon.com> In-reply-to: <4C741AD0.1070604@bitwagon.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Spam-Score: -2.0 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (--) On 08/24/2010 12:17 PM, John Reiser wrote: > Using fifos allows for arbitrary flexibility of "fanout multiplexing" > my interactive commands. I'm not sure what is meant by "arbitrary flexibility", but of course a shell script that is using pipes can also decide dynamically which processes to start up and connect to the control channel, and what output these processes will generate, and (when there are multiple control channels) which control channels each such process will connect to. I take your point that named fifos provide a different style for creating networks of processes, a style that may be more convenient in many cases. However, for small examples pipes seem quite adequate, and for large examples mktemp -d seems to simplify the code. Also, mktemp -d would simplify administration of large scripts: I'd far rather see a small /tmp, one subdirectory per running script, than a /tmp filled with countless fifos and other temporary files. The bottom line is that so far we haven't seen a real example exhibiting a need for mktemp --fifo that can't be satisfied just as well with existing tools. From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 24 Aug 2010 20:30:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128268179326936 (code B ref 6900); Tue, 24 Aug 2010 20:30:04 +0000 Received: (at 6900) by debbugs.gnu.org; 24 Aug 2010 20:29:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oo081-00070P-7h for submit@debbugs.gnu.org; Tue, 24 Aug 2010 16:29:53 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Oo07z-00070K-Gn for 6900@debbugs.gnu.org; Tue, 24 Aug 2010 16:29:52 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Tue, 24 Aug 2010 13:31:08 -0700 Message-ID: <4C742BF7.1090507@bitwagon.com> Date: Tue, 24 Aug 2010 13:30:47 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C740470.8060604@bitwagon.com> <4C741051.405@cs.ucla.edu> In-Reply-To: <4C741051.405@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.6 (--) > (echo quit 1 | cmd1 3<&0 <&4) 4<&0 | > (: | cmd2 3<&0 <&4) 4<&0 When adopting this style, then remember to consider the possibility of closing the "extra" file descritpor (fd 4 here) to reduce the number of open files. If there are no 'trap', then also remember to consider the possibility of using 'exec' to reduce the number of processes created ['fork' or 'clone' system calls] and their lifetimes: (exec echo quit 1 | exec cmd1 3<&0 <&4 4<&-) 4<&0 | ( : | exec cmd2 3<&0 <&4 4<&-) 4<&0 -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: pitfalls of recoding named fifo as pipe Resent-From: John Reiser Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 25 Aug 2010 14:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Paul Eggert Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128274562731823 (code B ref 6900); Wed, 25 Aug 2010 14:14:02 +0000 Received: (at 6900) by debbugs.gnu.org; 25 Aug 2010 14:13:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OoGjb-0008HE-AI for submit@debbugs.gnu.org; Wed, 25 Aug 2010 10:13:47 -0400 Received: from bitwagon.com ([74.82.39.175]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OoGjY-0008H9-0B for 6900@debbugs.gnu.org; Wed, 25 Aug 2010 10:13:44 -0400 Received: from f11-64.local ([67.171.180.43]) by bitwagon.com for <6900@debbugs.gnu.org>; Wed, 25 Aug 2010 07:14:59 -0700 Message-ID: <4C75254E.8080902@bitwagon.com> Date: Wed, 25 Aug 2010 07:14:38 -0700 From: John Reiser Organization: - User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C740470.8060604@bitwagon.com> <4C741051.405@cs.ucla.edu> In-Reply-To: <4C741051.405@cs.ucla.edu> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.5 (--) On 08/24/2010 11:32 AM, Paul Eggert wrote: > dir=$(mktemp -d dir.XXXXXX) > mkfifo $dir/1 $dir/2 > listener1 < $dir/1 > listener2 < $dir/2 > cmd1 2> $dir/1 | cmd2 2> $dir/2 > Better yet, do not use named fifos, since pipes suffice: > > (cmd1 2>&1 >&3 | listener1) 3>&1 | > (cmd2 2>&1 >&3 | listener2) 3>&1 That is not equivalent! stdout from listener1 gets piped into cmd2, instead of going to the common stdout of all processes other than cmd1. Fixing this using only anonymous pipes is cumbersome because the additional file descriptor must be [should be] redirected by all four processes. Also, file descriptor 3 is left open in all processes, which hogs system resources and is less safe. Therefore something like this is required: 4>&1 ( 3>&1 ( 1>&3 2>&1 3>&- 4>&- cmd1 | 1>&4 3>&- 4>&- listener1 ) | 3>&1 4>&- ( 1>&3 2>&1 3>&- cmd2 | 3>&- listener2 ) ) where the formatting emphasizes prefix actions and common elements. Using the named fifos is much more readable and understandable. The cost is explicit cleanup, including the transfer of the onus for recovery at resource exhaustion (fd not available, space not available in filesystem) from the shell to the user. -- From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: pitfalls of recoding named fifo as pipe Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 25 Aug 2010 20:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Reiser Cc: Eric Blake , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.128276875710517 (code B ref 6900); Wed, 25 Aug 2010 20:40:03 +0000 Received: (at 6900) by debbugs.gnu.org; 25 Aug 2010 20:39:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OoMkf-0002ja-AN for submit@debbugs.gnu.org; Wed, 25 Aug 2010 16:39:17 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OoMkc-0002jT-Uk for 6900@debbugs.gnu.org; Wed, 25 Aug 2010 16:39:16 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o7PKeZwo010517; Wed, 25 Aug 2010 13:40:35 -0700 (PDT) Message-ID: <4C757FC3.4020105@cs.ucla.edu> Date: Wed, 25 Aug 2010 13:40:35 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-Version: 1.0 References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> <4C72B130.6050805@bitwagon.com> <4C72B752.8080406@redhat.com> <4C72DCC2.2080009@bitwagon.com> <4C72E69E.2070503@cs.ucla.edu> <4C740470.8060604@bitwagon.com> <4C741051.405@cs.ucla.edu> <4C75254E.8080902@bitwagon.com> In-Reply-To: <4C75254E.8080902@bitwagon.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.5 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -3.4 (---) On 08/25/2010 07:14 AM, John Reiser wrote: > That is not equivalent! stdout from listener1 gets piped into > cmd2, instead of going to the common stdout of all processes > other than cmd1. Yes, you're right. I had assumed that the listeners did not generate standard output. If they do, it should have been this: ((cmd1 2>&1 >&3 | listener1 >&4) 3>&1 | (cmd2 2>&1 >&4 | listener2 ) ) 4>&1 > Also, file descriptor 3 is left open in all processes, which > hogs system resources and is less safe. Those resource and safety issues are typically negligible. If one wanted to be extremely cautious, one could write this: ((cmd1 2>&1 >&3 3>&- 4>&- | listener1 >&4 3>&- 4>&-) 3>&1 | (cmd2 2>&1 >&4 4>&- | listener2 4>&-) ) 4>&1 (This is a shorter and POSIX-conforming way of writing the variant that you sent, plus it fixes a couple of bugs in the way that variant redirected file descriptor 2.) But almost nobody would or should bother with this level of complication. > Using the named fifos is much more readable and understandable. Yes, as I said, once things get sufficiently complicated, it's quite possible for named fifos to be easier to use. It's still not clear to me that this is the case here, as even the overly-complicated piped version is a tad simpler than the named-fifo version. But the point remains that, once a script is complicated enough to need a lot of named fifos, it should be using mktemp -d anyway. From unknown Mon Aug 18 09:02:23 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6900: mktemp: want option to make a fifo Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 07 Aug 2011 16:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6900 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: John Reiser , 6900@debbugs.gnu.org Received: via spool by 6900-submit@debbugs.gnu.org id=B6900.13127333655769 (code B ref 6900); Sun, 07 Aug 2011 16:10:02 +0000 Received: (at 6900) by debbugs.gnu.org; 7 Aug 2011 16:09:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qq5un-0001V0-C9 for submit@debbugs.gnu.org; Sun, 07 Aug 2011 12:09:25 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qq5uk-0001Us-Sv for 6900@debbugs.gnu.org; Sun, 07 Aug 2011 12:09:23 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id B4CAD60098; Sun, 7 Aug 2011 18:08:24 +0200 (CEST) From: Jim Meyering In-Reply-To: <4C72A460.8050107@redhat.com> (Eric Blake's message of "Mon, 23 Aug 2010 10:40:00 -0600") References: <4C729233.1060104@bitwagon.com> <4C72A460.8050107@redhat.com> Date: Sun, 07 Aug 2011 18:08:24 +0200 Message-ID: <878vr5jjbb.fsf@rho.meyering.net> Lines: 20 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.1 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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 (------) forcemerge 6900 6330 tags 6900 notabug close 6900 thanks Eric Blake wrote: > On 08/23/2010 09:22 AM, John Reiser wrote: >> mktemp: Please add an option which creates a fifo >> instead of a file or a directory. "--fifo" seems appropriate, >> although the abbreviation "-f" might be confused as a request >> for an ordinary file; and "-p" as in "--pipe" is already taken >> for "prefix". > > Thanks for the report. However, I'm inclined to mark this bug as a > duplicate of 6330, for the reasons already documented in this long > thread: > http://lists.gnu.org/archive/html/bug-coreutils/2010-06/msg00013.html I've just merged them and closed both. It's clear that the proposed change is neithehr required nor justified. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 07 12:49:54 2011 Received: (at control) by debbugs.gnu.org; 7 Aug 2011 16:49:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qq6Xx-0003HY-VR for submit@debbugs.gnu.org; Sun, 07 Aug 2011 12:49:54 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qq6Xv-0003HM-4q for control@debbugs.gnu.org; Sun, 07 Aug 2011 12:49:52 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id CFEC460098 for ; Sun, 7 Aug 2011 18:48:52 +0200 (CEST) From: Jim Meyering To: control@debbugs.gnu.org Subject: merge and close Date: Sun, 07 Aug 2011 18:48:52 +0200 Message-ID: <87bow1i2vf.fsf@rho.meyering.net> Lines: 4 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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 (------) forcemerge 6900 6330 tags 6900 notabug close 6900 thanks