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

Re: more problems w/ irix



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 <muffled but entirely audible whimper> 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 <pws@xxxxxx>       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.



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