From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3) with ESMTP id KAA03136 for ; Tue, 7 May 1996 10:57:45 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id UAA02202; Mon, 6 May 1996 20:48:53 -0400 (EDT) Resent-Date: Mon, 6 May 1996 20:48:53 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199605070048.CAA00203@hzoli.ppp.cs.elte.hu> Subject: A little fix for beta17 To: zsh-workers@math.gatech.edu (Zsh hacking and development) Date: Tue, 7 May 1996 02:48:41 +0200 (MET DST) X-Mailer: ELM [version 2.4ME+ PL11 (25)] MIME-Version: 1.0 Content-Type: application/pgp; format=text; x-action=sign Content-Transfer-Encoding: 7bit Resent-Message-ID: <"kSwWF3.0.KY.ltfZn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/987 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- I have just discovered a little problem in the new process substitution code. The file descriptorts created for the process substitution were not closed in the parent after forking an external command. It is not really a bug as it does not cause any real problem and the open descitptor will disappear either when the process on the other side of the pipe terminates or after the next builtin. And an other note: if zsh is compiled with -DDEBUG and you invoke a zsh script with process substitution arguments, you will receive some warnings like `closem: fd 11 not closed'. This is not a bug. It only means that earlier zsh closed all file descriptors greater than 9 before executing any external command. beta17 does not do this which probably makes external command invocation faster (more than 240 system calls before each exec is probably noticeable) and it makes possible to use these file descriptors. <(...) and >(...) will always use a file descriptor greater than 9 to avoid clashes with redirection. Therefore if a system supports /dev/fd and a script has a process substitution argument it will also have an open file descriptor greater than 9 which would have been closed by earier zsh versions. If -DDEBUG is enabled closem() will notice this and will give a warning which can be ignored in this case. Cheers, Zoltan *** Src/exec.c 1996/05/05 11:47:47 2.18 --- Src/exec.c 1996/05/06 23:46:02 *************** *** 1320,1325 **** --- 1320,1328 ---- close(synch[1]); read(synch[0], &dummy, 1); close(synch[0]); + #ifdef HAVE_DEV_FD + closem(-1); + #endif if (how & Z_ASYNC) { lastpid = (long) pid; } else if (!jobtab[thisjob].stty_in_env && nonempty(cmd->vars)) { -----BEGIN PGP SIGNATURE----- Version: 2.6.3i Charset: noconv iQCVAwUBMY6d4wupSCiLN749AQHmxQP+MM8ZvrFFa/Ty9q6FvirhuuI0/XYR7F8g pdF5mroqN02sLe7YVsvgjby/MoedPS+aLYDWCFKVCqflvH/wmkOz8DxXtE25H10s p9Gx4ddpHtv6nMjM46XbIvWkNdVZIGuE5zAX+jGwLHeugZneaXahiAJh+t20fsln SomSTq44yCw= =fMm5 -----END PGP SIGNATURE-----