zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: echo > * and EMFILE
Date: Tue, 13 Feb 2007 10:53:20 +0000	[thread overview]
Message-ID: <200702131053.l1DArKoK003124@news01.csr.com> (raw)
In-Reply-To: <20070212223239.GA4812@sc.homeunix.net>

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@csr.com>                  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


  reply	other threads:[~2007-02-13 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 22:32 Stephane Chazelas
2007-02-13 10:53 ` Peter Stephenson [this message]
2007-02-13 17:11   ` Bart Schaefer
2007-02-13 17:28     ` Peter Stephenson
2007-02-14  7:53       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200702131053.l1DArKoK003124@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).