From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1907 invoked from network); 10 Jul 2022 00:43:22 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Jul 2022 00:43:22 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1657413802; b=eJeASvFaObjvqNBqkPWdqOwMhO1IiC9ufwm4m4gVGXQviVjZIUpu3b7X+4Di1Un6ahPkOzVk3a HDbsWR574ALYfNm0T+oWipcRukOvi2Ab9/9NdMP7a4H62EWeb5GNPR4PWrkOV1N7IAGQNMT1VK 00aGeP5fRySQEMgKsHUi5+0ePvuRTNjPOBZy9LqkzKjagcxN+D0tU3CFsaWbVZAU47/VOY2G6U 2sUFWk0qYXqqZ2My86Fdibrelhm2ATiCESKRzavCG6lAsma2VjUXK2Bk+iYaELz76j3+QoLBrZ BVByGNuqkdwNPdIxhUOUG8so2zUa/Ay4ILCNodvcY1uvzg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mout.gmx.net) smtp.remote-ip=212.227.17.21; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.a=rsa-sha256; dmarc=none header.from=gmx.de; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1657413802; bh=UO39hhyelu01wQ7kT87EzMmEPN4dDTQopJjQmVvkdCE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:In-Reply-To:Content-Type: MIME-Version:References:Reply-To:Message-ID:Subject:To:From:Date: DKIM-Signature:DKIM-Signature; b=m9vhkMblry4vbeoSEAzN6hJ3WHSx4afjy3l8VvxZ+q+dVYgrEv76cxl9TrWKYb8Z/HIBcf/dJ4 R2tDIH04aCBfxVtQilLdY4AZpQIBmHr9Pom227EUauxJSqeNedZ7+OwPLGxJ+WjekL/9xGs4Vf ZcAWQTgfElY9DeyjXNdfPX/3qHvQbBMGX9aFaaWoY+5mn+s6MpmuQ4gLH1bJDnbs6aPaNmVOEZ 0zBIoLtlKvIRd7hF9ulx5JDufiZgH+QBfDStTHWx2M0E3POCGdx0i8IkY3zxerWs2/Z+NEtZ4k ABsf1UUxzgyQgRuZVTOtsVtansrXnnppGeIeiuk+ezcZlQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding:In-Reply-To :Content-Type:MIME-Version:References:Reply-To:Message-ID:Subject:To:From: Date:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID; bh=GJT2Lx1sUdOq2KPNRnGtwT8xwLZh8FnVHGpQPXIvBNM=; b=PbhJscbGPI8PThRkMh27Rp3BI/ 2HWnFzv03Hym1fP9Kb3iJjQk9PF/gs1n4fIB3Ah1swF/tB6x3MayyBxdAz4kOIzUXG5hsjmSTzHZQ DQXfkMW00PEwwkTc7bTMUiCJ4qk5+F7RKsxx/pPaMGXQmjJP+wz/svqyBkkacN0bk7eOP4Et7ycy/ /suuq9B3H+eWDbL0sbc7b6RoXS9fDM4lmxpGPR0AAH01lDUG7NMZRbiar3SvtOA9AShByo9eqFdHI /3Cumcb+pQbJ2GzC2OsqWtgWzgJV1SmWShHbko2kJeEQx7o+hUcsqC/CUZIalIFqOGTNZ3tUuXBsb EbwDo5kw==; Received: from authenticated user by zero.zsh.org with local id 1oAL2e-0008YO-J6; Sun, 10 Jul 2022 00:43:20 +0000 Authentication-Results: zsh.org; iprev=pass (mout.gmx.net) smtp.remote-ip=212.227.17.21; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.a=rsa-sha256; dmarc=none header.from=gmx.de; arc=none Received: from mout.gmx.net ([212.227.17.21]:59023) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oAL1b-0007oH-J1; Sun, 10 Jul 2022 00:42:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1657413734; bh=UO39hhyelu01wQ7kT87EzMmEPN4dDTQopJjQmVvkdCE=; h=X-UI-Sender-Class:Date:From:To:Subject:Reply-To:References: In-Reply-To; b=lxBm7mEBvbmonwUML/DlV27ZnGPZBaeaq1ETvSXNw4GzMBTHCicDA5KCl9XWxsdj9 U+FC7WeInDds0W+duK0Cj3BIwXlBRWYlsmrXC/5xIeDsmn8UELBNxKWAauGOw9KfKA AsfDAg72sXW8uAdQVaMY3zmHiaIQ7i3Jhp3fS8fY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from zitrone.obstwiese ([46.223.163.174]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MmDIu-1nk2kQ1qK0-00iDja for ; Sun, 10 Jul 2022 02:42:14 +0200 Received: from luthien by zitrone.obstwiese with local (Exim 4.94.2) (envelope-from ) id 1oAL1W-0001mE-57; Sun, 10 Jul 2022 01:42:10 +0100 Date: Sun, 10 Jul 2022 01:42:10 +0100 From: Dominik Vogt To: Zsh Users Subject: Re: Using file lines as "input files" Message-ID: Reply-To: dominik.vogt@gmx.de Mail-Followup-To: Zsh Users References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:ohypXz2addY1jwvUu1pscY4SOLLVEaRx9uSX0/ZB+o+0+XCp3l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MLNf1LAz326dcqKoE4/bJ1AyVPC1BkR/LA/TRhOpf3h qWWGHOyTi0dJpPnUVTQH9tcE81T5AzhemaCtEaS4/aCru+dE3sMxYbFqiw02XMjVbDdXCAnBf OcJ8YdgojX9DRLv6jYiGbq+fh1MQve55aVeh3xjJ1JoQpi593Xxd8y02oyfYXXP5FTRIJxA+p 9u/O/coz8EpwaofPYPf4HUtTbnTmsnvHxfcrVaRVRayDDlDXWoPFufd/IAvw8pYnA0i8kP2ua yrxZjxaN74NNnSuabJLFGswOVxu+Ual4zSEHCA9w7BCzApxY4kfefXVxA== Content-Transfer-Encoding: quoted-printable X-Seq: 27882 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Sat, Jul 09, 2022 at 04:21:37AM +0200, Mikael Magnusson wrote: > I realized I misinterpreted the question originally, and the following > doesn't seem to work 100% but it was a fun idea: > % mkfifo apipe > % foo[265000]=3D'' # number of lines in the file > % cksum apipe$^foo # pass "apipe" to cksum 265000 times For some mysterious reason that doesn't work with the shwordsplit option active: $ foo[9]=3D'' $ setopt shwordsplit $ echo x^foo x x $ unsetopt shwordsplit $ echo x^foo x x x x x x x x x > (in another terminal or job control etc) > % while read; do echo $REPLY > apipe; done < infile > > When I tried the above on some test data, I got about 10 broken pipes. > Also several lines sometimes get passed through the pipe without an > intervening EOF, I'll admit I don't know the finer points of pipe/fifo > behavior when you open and close them rapidly. Hm, a fifo created with mkfifo is automatically blocking. So, when either end is opened while the other is not present, it blocks until the other end is opened. The reader gets an EOF when there's no more data and no writer has the fifo open. Otherwise it waits for more data. 1) Multiple lines processed by a single reader: * writer opens the fifo and blocks for a reader * reader opens the fifo and blocks for data * writer writes its data and closes the fifo * the next writes opens the fifo * the reader processes the first writer's data but gets no EOF because the new writer has the fifo open * the new writer writes another line to the fifo and terminates * the reader reads the next line, gets an EOF because no writer is open and terminates itself. 2) SIGPIPE may be generated in this case: * writer opens the fifo and blocks for a reader * reader opens the fifo and blocks for data * the writer unblocks, writes its data and closes. * the reader unblocks consumes the data and gets an EOF * the next writer opens the pipe without blocking because the reader has not yet closed the fifo * the reader closes the fifo * the writer tries to write data but gets SIGPIPE because there is no reader Unfortunately fifos have no notion of an EOF as part of the data stream. > That said, this also seems to take around 4-5 seconds to run. A pity that pipes are so uncomfortable to handle in Unix. I like that approach. Ciao Dominik ^_^ ^_^ =2D- Dominik Vogt