zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: Wayne Davison <wayne@clari.net>,
	zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: Weird problem with trn's Configure script
Date: Mon, 05 Aug 1996 15:08:47 +0200	[thread overview]
Message-ID: <199608051308.PAA16798@hydra.ifh.de> (raw)
In-Reply-To: "wayne@clari.net"'s message of "Sun, 04 Aug 1996 14:28:55 MET." <199608042128.OAA27658@bebop.clari.net>

wayne@clari.net wrote:
> I finally tested trn's Configure script with zsh enulating sh and I found
> one weird problem.  The script is trying to ensure that it is being run
> by sh, not csh, so it does this test (tweaked for simplicity):
> 
> 	(exit $?0) || echo You are not running sh
> 
> Under zsh 3.0pre6 in either zsh or sh compatibility mode this causes a
> large chunk of the script to get executed multiple times.

Looks like I'm going to get to this before Zoltan...

This is an extremely typical symptom of an exit() being called instead
of _exit() in a forked subshell which never exec'd.  This occurs most
often on System-V-like systems.  (I learnt all that from Bart.)

Knowing that, it's easy to fix.  Luckily, most regular exits go
through zexit(), though I caught one other at the tail end of a list.
I think most other exits in the code are abnormal, so aren't such a
problem, but there are possibly others which need the treatment.  To
the best of my knowledge checking that we still have the original pid
before an exit is (a) completely safe (b) quick.  I tested this on
OSF/1 3.0 which showed the problem.

(This is actually about the third round of _exit() fixes.  I apologise
for not fixing this on the last round; I thought about some fairly
similar things but obviously didn't check this.  I expect it's been
there since zsh prehistory.)

*** Src/builtin.c.exit	Mon Aug  5 14:07:34 1996
--- Src/builtin.c	Mon Aug  5 14:38:39 1996
***************
*** 4610,4616 ****
      }
      if (sigtrapped[SIGEXIT])
  	dotrap(SIGEXIT);
!     exit(val);
  }
  
  /* . (dot), source */
--- 4610,4619 ----
      }
      if (sigtrapped[SIGEXIT])
  	dotrap(SIGEXIT);
!     if (mypid != getpid())
! 	_exit(val);
!     else
! 	exit(val);
  }
  
  /* . (dot), source */
*** Src/exec.c.exit	Mon Aug  5 14:06:56 1996
--- Src/exec.c	Mon Aug  5 14:44:53 1996
***************
*** 569,575 ****
  	    if (lastval && isset(ERREXIT)) {
  		if (sigtrapped[SIGEXIT])
  		    dotrap(SIGEXIT);
! 		exit(lastval);
  	    }
  	}
  
--- 569,578 ----
  	    if (lastval && isset(ERREXIT)) {
  		if (sigtrapped[SIGEXIT])
  		    dotrap(SIGEXIT);
! 		if (mypid != getpid())
! 		    _exit(lastval);
! 		else
! 		    exit(lastval);
  	    }
  	}
  

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


      parent reply	other threads:[~1996-08-05 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-04 21:28 Wayne Davison
1996-08-04 22:39 ` Zoltan Hidvegi
1996-08-05  7:47   ` Weird problem with zsh running " Wayne Davison
1996-08-05 13:08 ` Peter Stephenson [this message]

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=199608051308.PAA16798@hydra.ifh.de \
    --to=pws@ifh.de \
    --cc=wayne@clari.net \
    --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).