From owner-freebsd-questions@FreeBSD.ORG Mon Jun 13 02:01:19 2005 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A19A216A41C for ; Mon, 13 Jun 2005 02:01:19 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B64F43D1D for ; Mon, 13 Jun 2005 02:01:19 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j5D21If2058972; Sun, 12 Jun 2005 21:01:18 -0500 (CDT) (envelope-from dan) Date: Sun, 12 Jun 2005 21:01:18 -0500 From: Dan Nelson To: Mike Meyer Message-ID: <20050613020118.GB20259@dan.emsphone.com> References: <17067.62149.92183.56827@guru.mired.org> <1118608948.705.6.camel@localhost> <17068.51586.885638.130044@guru.mired.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17068.51586.885638.130044@guru.mired.org> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i Cc: Christopher Black , questions@freebsd.org Subject: Re: Problems with command line scratch files in zsh X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2005 02:01:19 -0000 In the last episode (Jun 12), Mike Meyer said: > [Format recovered from top posting.] > In <1118608948.705.6.camel@localhost>, Christopher Black typed: > > On Sun, 2005-06-12 at 03:31 -0500, Mike Meyer wrote: > > > Since going to 5.x with devfd, I've noticed that some of the > > > shell constructs used by zsh (and other shells - I know zsh > > > didn't invent this) quit working. To wit: > > > > > > guru% wc <(cat /etc/motd) > > > wc: /dev/fd/11: open: No such file or directory > > > > > > The <(...) construct runs the pipe in (), and replaces the <(...) > > > with the name of the /dev/fd/ entry for the output of that pipe. > > > The file exists for the shell process doing all this. But when > > > the comm process tries to open the file to read the data, the > > > file doesn't exist. This is pretty nasty. > > > > > > Anyone got any suggestions on how to fix this? A bug report with > > > a patch, maybe (I couldn't find any such bug report)? > > > Workarounds? Maybe this should go to hackers@freebsd.org? > > Why not just 'cat /etc/motd | wc' ? > > Because I used a trivial example designed to illustrate the problem. A > less trivial example would be: > > comm -12 <(sort file_one) <(sort file_two) > > Of course, this can also be rewritten using temp files instead of > pipes. But that will be longer, slower, and uglier. > > This worked on 4.X. It ought to work on 5.X. If you want a tempfile, you should probably use the =() syntax, which will always use a tempfile. <() and >() will attempt to use /dev/fd. It probably worked on 4.* because 4.* creates 64 /dev/fd/* device nodes on install. If for some reason zsh had more than 64 files open already, it would have failed even on 4.*. -- Dan Nelson dnelson@allantgroup.com