Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: echo > * and EMFILE
- X-seq: zsh-workers 23168
- From: Peter Stephenson <pws@xxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: Re: echo > * and EMFILE
- Date: Tue, 13 Feb 2007 10:53:20 +0000
- In-reply-to: <20070212223239.GA4812@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20070212223239.GA4812@xxxxxxxxxxxxxxx>
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 <pws@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author