Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

echo > * and EMFILE



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



Messages sorted by: Reverse Date, Date, Thread, Author