zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: echo > * and EMFILE
Date: Mon, 12 Feb 2007 22:32:39 +0000	[thread overview]
Message-ID: <20070212223239.GA4812@sc.homeunix.net> (raw)

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.

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

strace gives:

bind(3, {sa_family=AF_INET, sin_port=htons(2208), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)
[...]
write(2, "ztcp: could not bind to port 409"..., 59ztcp: could not bind to port 40968: address already in use

There is someone indeed already listening on 2208, but not on 40968.

strace also gives:

bind(3, {sa_family=AF_INET, sin_port=htons(3014), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl64(3, F_DUPFD, 10)                 = -1 EMFILE (Too many open files)
bind(3, {sa_family=AF_INET, sin_port=htons(3015), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl64(3, F_DUPFD, 10)                 = -1 EMFILE (Too many open files)
bind(3, {sa_family=AF_INET, sin_port=htons(3016), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl64(3, F_DUPFD, 10)                 = -1 EMFILE (Too many open files)
bind(3, {sa_family=AF_INET, sin_port=htons(3017), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl64(3, F_DUPFD, 10)                 = -1 EMFILE (Too many open files)
bind(3, {sa_family=AF_INET, sin_port=htons(3018), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl64(3, F_DUPFD, 10)                 = -1 EMFILE (Too many open files)
bind(3, {sa_family=AF_INET, sin_port=htons(3019), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl64(3, F_DUPFD, 10)                 = -1 EMFILE (Too many open files)
bind(3, {sa_family=AF_INET, sin_port=htons(3020), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
fcntl64(3, F_DUPFD, 10)                 = -1 EMFILE (Too many open files)

but no error message.

I get similar problems with zsocket.

Cheers,
Stéphane


             reply	other threads:[~2007-02-12 22:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 22:32 Stephane Chazelas [this message]
2007-02-13 10:53 ` Peter Stephenson
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=20070212223239.GA4812@sc.homeunix.net \
    --to=stephane_chazelas@yahoo.fr \
    --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).