From unknown Tue Aug 19 21:02:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6379: process substitution with a give suffix Resent-From: Peng Yu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 08 Jun 2010 18:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6379 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Greg Wooledge Cc: 6379@debbugs.gnu.org X-Debbugs-Original-Cc: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.127602204224975 (code B ref -1); Tue, 08 Jun 2010 18:34:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 Jun 2010 18:34:02 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM3cg-0006Um-4t for submit@debbugs.gnu.org; Tue, 08 Jun 2010 14:34:02 -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 1OM3ce-0006Ub-9l for submit@debbugs.gnu.org; Tue, 08 Jun 2010 14:34:00 -0400 Received: from lists.gnu.org ([199.232.76.165]:57773) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OM3ca-0004uz-10 for submit@debbugs.gnu.org; Tue, 08 Jun 2010 14:33:56 -0400 Received: from [140.186.70.92] (port=58808 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM3cY-0007oU-Bp for bug-coreutils@gnu.org; Tue, 08 Jun 2010 14:33:55 -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,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM3cX-0004HV-7i for bug-coreutils@gnu.org; Tue, 08 Jun 2010 14:33:54 -0400 Received: from mail-gx0-f169.google.com ([209.85.161.169]:57386) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM3cX-0004HP-4D for bug-coreutils@gnu.org; Tue, 08 Jun 2010 14:33:53 -0400 Received: by gxk20 with SMTP id 20so177305gxk.0 for ; Tue, 08 Jun 2010 11:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=EtsONpFU65SioJk3E+nqkCcEnLSwYJ/86p8nQiFEqYs=; b=k/i4RozR0sImMl77wKSz5JbhaEp7Xa62oohR2jvxwr4Yaeoa44IUff6pMVYl2vVgJI vumbbr++uurR0YdDqvjF4mCSRwR7ysayYTmrAZApWz6CjYOWY1bWeVm7SodDH95Ee0kg ao6N5JMGBMMU48iwYMGCl4f/yhXHwUVXqLeRY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FPgB2yOLrWZO/csxwja94tz5wtAd4r026kmpCZcKe9UAC6ERxGBw0KxSHSrhG3r+e9 f9B83NnLUeon+1kFZE/oVQuFs8BSXDxStxhos/OvvEpIuvLq5FHBik/Romvw5GTvSAyK BnhMN51NZhUxDGILhdTO0Vt7NSUt6VOFEeZrI= MIME-Version: 1.0 Received: by 10.150.239.20 with SMTP id m20mr16221198ybh.407.1276022031994; Tue, 08 Jun 2010 11:33:51 -0700 (PDT) Received: by 10.151.26.11 with HTTP; Tue, 8 Jun 2010 11:33:51 -0700 (PDT) In-Reply-To: <20100608180235.GN1542@eeg.ccf.org> References: <20100608180235.GN1542@eeg.ccf.org> Date: Tue, 8 Jun 2010 13:33:51 -0500 Message-ID: From: Peng Yu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.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: -5.5 (-----) On Tue, Jun 8, 2010 at 1:02 PM, Greg Wooledge wrote: > On Tue, Jun 08, 2010 at 12:53:47PM -0500, Peng Yu wrote: >> I have a program that only accept argument with a give suffix >> >> ./program xxx.suffix >> >> If I use process substitution, which gives me /dev/fd/xx, it will not >> work with the program. Is there a way to make sure a suffix is added >> to the substitute process file handle in /def/fd/, so that the program >> can work with process substitution? > > =A0mkfifo myfifo.suffix > =A0something >myfifo.suffix & > =A0./program =A0wait > =A0rm myfifo.suffix The above question was sent to bug-bash. But since it is related to mkfilo. I redirect it to bug-coreutils. I have more than one arguments. I tried the following code. It doesn't seem to work for more than one arguments. Would you please let me know what is wrong? BTW, using fifo is going to be much faster than using a temp file as it avoid the disk usage, right? $ cat a.txt In a.txt $ cat b.txt In b.txt $ cat main.sh #!/usr/bin/env bash mkfifo a.suffix cat a.txt >a.suffix & mkfifo b.suffix cat b.txt >b.suffix & cat Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 08 Jun 2010 19:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6379 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Peng Yu Cc: Greg Wooledge , 6379@debbugs.gnu.org Received: via spool by 6379-submit@debbugs.gnu.org id=B6379.127602446926497 (code B ref 6379); Tue, 08 Jun 2010 19:15:02 +0000 Received: (at 6379) by debbugs.gnu.org; 8 Jun 2010 19:14:29 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM4Fp-0006tI-Cu for submit@debbugs.gnu.org; Tue, 08 Jun 2010 15:14:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM4Fm-0006tC-Ey for 6379@debbugs.gnu.org; Tue, 08 Jun 2010 15:14:27 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o58JELJm030491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Jun 2010 15:14:21 -0400 Received: from [10.11.11.241] (vpn-11-241.rdu.redhat.com [10.11.11.241]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o58JEJGo006526; Tue, 8 Jun 2010 15:14:20 -0400 Message-ID: <4C0E9672.4020900@redhat.com> Date: Tue, 08 Jun 2010 13:13:54 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.4 MIME-Version: 1.0 References: <20100608180235.GN1542@eeg.ccf.org> In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigE4088FF4E13FB21E676BE95D" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 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 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE4088FF4E13FB21E676BE95D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 06/08/2010 12:33 PM, Peng Yu wrote: >> mkfifo myfifo.suffix >> something >myfifo.suffix & >> ./program > wait >> rm myfifo.suffix >=20 > The above question was sent to bug-bash. But since it is related to > mkfilo. I redirect it to bug-coreutils. Your question is about how to use various Unix tools together; rather than directing to bug-bash or bug-coreutils, you may be better off directing to a generic shell-programming forum. As it is, you didn't raise any bug report about the mkfifo program, so redirecting to coreutils didn't really buy you anything. >=20 > I have more than one arguments. I tried the following code. It doesn't > seem to work for more than one arguments. Would you please let me know > what is wrong? >=20 > BTW, using fifo is going to be much faster than using a temp file as > it avoid the disk usage, right? A fifo will have the same speed as a pipe (another name for a fifo is named pipe; unlike 'foo | bar', where the pipe is anonymous and exists between exactly two processes, a fifo can be accessed from the file system by multiple processes, but but under the hood, it uses the same kernel pipe handling code). It has the drawback of being non-seekable in comparison to temporary regular files. It has the advantage of atomic operations not guaranteed by disk files, provided you stick to transactions below the size guaranteed by your kernel. And if you use a ramdisk backing store for /tmp, there is little difference in speed (either way, a ramdisk or a fifo does not have to do disk I/O); but since you can't guarantee that /tmp is a ramdisk, yes, a fifo can be faster for interprocess communication. And if used incorrectly, it has the potential to deadlock your shell script (something that won't happen with regular files). >=20 > $ cat a.txt > In a.txt > $ cat b.txt > In b.txt > $ cat main.sh > #!/usr/bin/env bash >=20 > mkfifo a.suffix > cat a.txt >a.suffix & > mkfifo b.suffix > cat b.txt >b.suffix & > cat wait > rm a.suffix b.suffix > $ ./main.sh > In b.txt >=20 --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigE4088FF4E13FB21E676BE95D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJMDpZyAAoJEKeha0olJ0Nqd7gIAI5A0nVAsvA6mHRAvDCLxAu9 8EqR2IKEto8hgQCuWa+WslSVbTPgVfD3ifutCXfVdI8KNVBd6BWTFMsJMF8VG3P4 L+JkgGecSMnCwDzY7Ts6wcAbFBOzhdzAC3eh475C18SRxNZM/1XGOJBcKLqVLmzn oLeLlT4PG1VpnepacIBjl3p8HX3zxhJyKPdesqbjiaG9DHmWCA7J+cFNKp0fhFNt ldb6/2dx8Zbzai34Koy8bKdc3aH2n8W4Lo0MQD59b3I0MgM5Bt7FmPVjBB4tp4T6 9nAdbode8t4g2DkGSDs+JCnZv0bWcHNozCDY2f6dSnbF6SqZ/yI/wBUrUBKaEnM= =rSs1 -----END PGP SIGNATURE----- --------------enigE4088FF4E13FB21E676BE95D-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 25 11:19:22 2011 Received: (at control) by debbugs.gnu.org; 25 Jul 2011 15:19:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QlMwE-00047O-9W for submit@debbugs.gnu.org; Mon, 25 Jul 2011 11:19:22 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QlMwB-00047C-Do for control@debbugs.gnu.org; Mon, 25 Jul 2011 11:19:20 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 990E6600AE for ; Mon, 25 Jul 2011 17:19:13 +0200 (CEST) From: Jim Meyering To: control@debbugs.gnu.org Subject: close non-bug issues Date: Mon, 25 Jul 2011 17:19:13 +0200 Message-ID: <877h764ccu.fsf@rho.meyering.net> Lines: 3 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 (------) close 6379 close 6356 thanks