zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: Ray Jones <rjones@ptc.com>,
	zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: more problems w/ irix
Date: Thu, 14 Nov 1996 11:01:54 +0100	[thread overview]
Message-ID: <199611141001.LAA19816@hydra.ifh.de> (raw)
In-Reply-To: "Ray Jones"'s message of "Wed, 13 Nov 1996 10:23:08 MET." <9611131723.AA14148@dbank>

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@ifh.de>       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.


  parent reply	other threads:[~1996-11-14 10:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-13 17:23 Ray Jones
1996-11-13 18:38 ` Bart Schaefer
1996-11-13 18:43   ` rjones
1996-11-14 10:01 ` Peter Stephenson [this message]
1996-11-14 15:08   ` Zefram
1996-11-14 15:23     ` Richard Coleman
1996-11-14 15:38       ` Zefram
1996-11-14 16:05         ` Richard Coleman
1996-11-15 11:09     ` Peter Stephenson

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=199611141001.LAA19816@hydra.ifh.de \
    --to=pws@ifh.de \
    --cc=rjones@ptc.com \
    --cc=zsh-workers@math.gatech.edu \
    /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).