From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.6/8.7.3) with ESMTP id VAA00812 for ; Thu, 14 Nov 1996 21:06:30 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id FAA20452; Thu, 14 Nov 1996 05:03:08 -0500 (EST) Resent-Date: Thu, 14 Nov 1996 05:03:08 -0500 (EST) Message-Id: <199611141001.LAA19816@hydra.ifh.de> X-Authentication-Warning: hydra.ifh.de: Host pws@localhost didn't use HELO protocol To: Ray Jones , zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: more problems w/ irix In-reply-to: "Ray Jones"'s message of "Wed, 13 Nov 1996 10:23:08 MET." <9611131723.AA14148@dbank> Date: Thu, 14 Nov 1996 11:01:54 +0100 From: Peter Stephenson Resent-Message-ID: <"9zAW62.0.U_4.RvkYo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2406 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Ray Jones wrote: > i applied pws's patch, and it fixed the fdtable problems for the cases > that i was seeing a crash before. > > to test it further and see how it responds when given more files than > OPEN_MAX, i tried the "cat < * > /dev/null" in a directory w/ about > 4000 files (OPEN_MAX is 2500). now i'm getting a crash in halloc(), > or (if i turn enable zsh_mem) malloc(). I have a horrible feeling all that OPEN_MAX stuff was actually irrelevant... struct multio can only hold MAXREDIRECT redirections, normally 16; trying <* where there are more than 16 expanded files simply isn't supposed to work. I've added the test and now it won't work. I've documented this. If anyone wants to remove the limit, it would be possible to make the fds member a pointer, and enlarge it as necessary. I have little enthusiasm. It's a rather inefficient way of processing a lot of files anyway. *** Doc/zshmisc.man.mfd Sat Aug 31 15:24:25 1996 --- Doc/zshmisc.man Thu Nov 14 10:58:24 1996 *************** *** 423,429 **** assuming there's at least one. (Without the .B MULTIOS ! option, it would create an empty file called "*".) .PP If the user tries to open a file descriptor for reading more than once, the shell opens the file descriptor as a pipe to a process that copies --- 423,431 ---- assuming there's at least one. (Without the .B MULTIOS ! option, it would create an empty file called "*".) Note that the ! number of multiple redirections is restricted to 16 for a particular ! file descriptor. .PP If the user tries to open a file descriptor for reading more than once, the shell opens the file descriptor as a pipe to a process that copies *** Src/exec.c.mfd Thu Nov 14 10:42:14 1996 --- Src/exec.c Thu Nov 14 10:44:28 1996 *************** *** 1047,1054 **** mfds[fd1]->pipe = pipes[1 - rflag]; redup(pipes[rflag], fd1); mfds[fd1]->ct = 2; ! } else /* add another fd to an already split stream */ mfds[fd1]->fds[mfds[fd1]->ct++] = movefd(fd2); } if (subsh_close >= 0 && !fdtable[subsh_close]) subsh_close = -1; --- 1047,1057 ---- mfds[fd1]->pipe = pipes[1 - rflag]; redup(pipes[rflag], fd1); mfds[fd1]->ct = 2; ! } else if (mfds[fd1]->ct < MAXREDIRECT) { ! /* add another fd to an already split stream */ mfds[fd1]->fds[mfds[fd1]->ct++] = movefd(fd2); + } else /* run out of space in struct multio */ + close(fd2); } if (subsh_close >= 0 && !fdtable[subsh_close]) subsh_close = -1; -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.