From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29612 invoked from network); 13 Feb 2007 10:56:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Feb 2007 10:56:05 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 85163 invoked from network); 13 Feb 2007 10:55:58 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Feb 2007 10:55:58 -0000 Received: (qmail 22898 invoked by alias); 13 Feb 2007 10:55:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23168 Received: (qmail 22889 invoked from network); 13 Feb 2007 10:55:55 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 13 Feb 2007 10:55:55 -0000 Received: (qmail 84923 invoked from network); 13 Feb 2007 10:55:54 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 13 Feb 2007 10:55:46 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly21c.srv.mailcontrol.com (MailControl) with ESMTP id l1DAnqLY027219 for ; Tue, 13 Feb 2007 10:55:37 GMT Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Feb 2007 10:53:24 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.8/8.13.4) with ESMTP id l1DArLxZ003127 for ; Tue, 13 Feb 2007 10:53:21 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.8/8.13.8/Submit) with ESMTP id l1DArKoK003124 for ; Tue, 13 Feb 2007 10:53:21 GMT Message-Id: <200702131053.l1DArKoK003124@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Zsh hackers list Subject: Re: echo > * and EMFILE In-reply-to: <20070212223239.GA4812@sc.homeunix.net> References: <20070212223239.GA4812@sc.homeunix.net> Comments: In-reply-to Stephane Chazelas message dated "Mon, 12 Feb 2007 22:32:39 +0000." Date: Tue, 13 Feb 2007 10:53:20 +0000 From: Peter Stephenson X-OriginalArrivalTime: 13 Feb 2007 10:53:24.0971 (UTC) FILETIME=[2F6F13B0:01C74F5D] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.67.0.131 Stephane Chazelas wrote: > Hi guys, > > $ touch {1..2000} > $ : > * > $ echo *(L1) | wc > 1 1007 4921 > > zsh obviously couldn't open that many files, which is normal, > the number of files a process can open at the same time is > generally limited. > > But the problem here is that zsh didn't output any error > message. So that the user might think he erased the content of > every file when actually he didn't. There are lots and lots of unchecked system calls; it would be very useful to handle them better. Fixing them up as well as consistently handling the errors without, for example, file descriptor leaks needs a lot of work. (The fact we don't handle errors well at the moment is probably actually a bonus from the latter point of view: we're just closing a lot of file descriptors that are -1, which is useless but harmless.) > Also: > > $ zsh -c 'zmodload zsh/net/tcp; for f ({1..1020}) ztcp -l $((f+2000))' > ztcp: could not bind to port 40968: address already in use The error message doesn't switch from network to host order; that's easy to fix. > I get similar problems with zsocket. Which message is wrong? There's no network order problem here, so it must be something else. Index: Src/Modules/tcp.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v retrieving revision 1.41 diff -u -r1.41 tcp.c --- Src/Modules/tcp.c 30 May 2006 22:35:03 -0000 1.41 +++ Src/Modules/tcp.c 13 Feb 2007 10:46:16 -0000 @@ -432,7 +432,7 @@ if (bind(sess->fd, (struct sockaddr *)&sess->sock.in, sizeof(struct sockaddr_in))) { char buf[DIGBUFSIZE]; - convbase(buf, (zlong)lport, 10); + convbase(buf, (zlong)ntohs(lport), 10); zwarnnam(nam, "could not bind to port %s: %e", buf, errno); tcp_close(sess); return 1; -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview