From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11895 invoked by alias); 27 Feb 2012 16:15:08 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30275 Received: (qmail 10125 invoked from network); 27 Feb 2012 16:15:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 454250.38389.bm@omp1024.mail.ird.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1330358932; bh=lf+gbtCsjLyS+GSxJwgxvjprOGyDDRo+rPvPzP3xPxY=; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=e4JyqzEoGZ4NWOOZkTXrudvOfYRyOb+QnX3hscOhhfAsUdPSf86aY2rI7GEWqvOvOK63r2+aS0i6ABDEh3SnXPbtXx00eaFnwlvUY+aXhyQRBLb2MezH8kWAAOkpivQWYbKjGAhcCIhluwmtGRucg7eFz5I5iK4GTgslm9DUAR0= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Mailer:Message-ID:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=eNJThyiqKdEsOl57RN37GnsXgejsvWPMgZ3+8+JOjEBEkcOvlqwcN/5BcVtMKOsU5ujpick12x2rcS0pIqPsJbz9okCQHnCCbmp5QW11CLaLwsd0CL8UKyLM6FLKue+YZslZ6NT74a8ZjgQkGPZztQV3OF/gq6HhsTx95uEaKYw=; X-YMail-OSG: GjfYjr0VM1mXcP6HgYe8CVbSJNDzYFlX4Xbeo_o4tbtvohM TnImsMgWt X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.116.338427 Message-ID: <1330358932.36076.YahooMailClassic@web29706.mail.ird.yahoo.com> Date: Mon, 27 Feb 2012 16:08:52 +0000 (GMT) From: Oliver Kiddle Subject: Re: PATCH: Fix _file_descriptors To: zsh-workers@zsh.org In-Reply-To: <1330281433-23949-1-git-send-email-mikachu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable --- On Sun, 26/2/12, Mikael Magnusson wrote:=0A=0A> I n= oticed file descriptor completion=0A> didn't work, with the verbose style s= et=0A> because when this is run,=0A> =A0 fds=3D( /dev/fd/<0-9>(N:t) )=0A> t= he /dev/fd dir is open while the glob is performed, which=0A> results in=0A= > a spurious entry in the result, which then cannot be=0A> dereferenced. Th= e=0A> result is that the list array is not aligned to the fds=0A> array (an= d also=0A> an error message is output), and an fd that doesn't exist is=0A>= completed.=0A=0AI'm not sure what you mean by "cannot be dereferenced".=0A= =0AIn any case, this whole function can be simplified by using the newish := A modifier. Also, I'm fairly certain that it is intentional that this funct= ion only completes file descriptors from 0 - 9.=0A=0AWith :A, assigning fds= can just be:=0A=0Afds=3D( /dev/fd/<0-9>(e,'[[ $REPLY:A !=3D /proc/$$/fd ]]= ',) )=0A=0AIt's probably best to build up list then with a for loop after c= hecking the style but again :A can be used instead of trying the three old = mechanisms.=0A=0AAnother approach would be to use a subshell to open the di= rectory:=0A fds=3D( $(print /proc/$$/fd/<0-9>(N:t)) ) =0ABut I think there= are some platforms that have /dev/fd but not /proc/$$/fd.=0A=0AOliver