zsh-workers
 help / color / mirror / code / Atom feed
From: P.Stephenson@swansea.ac.uk
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Cc: kasahara@csce.kyushu-u.ac.jp (Yoshiaki KASAHARA)
Subject: Re: history file re-writing in sub-shell
Date: Fri, 08 Sep 95 17:29:08 +0100	[thread overview]
Message-ID: <14719.9509081629@pyro.swan.ac.uk> (raw)
In-Reply-To: "hzoli@cs.elte.hu"'s message of "Thu, 07 Sep 95 22:03:53 +0200." <199509072003.WAA01387@bolyai.cs.elte.hu>

hzoli@cs.elte.hu wrote:
> > 
> > Hello.  I'm not a subscriber of this list, but I found a weirdness
> > while using zsh-2.6-beta8 and 10, so I'll report it here.
> > 
> > After I replaced my zsh from 2.5 to 2.6beta, I found that saved
> > history was not read correctly.
> > 
> > Finally I found that when I use $(non-zsh-builtin-command), the
> > content of $HISTFILE is changed (just like when an interactive shell
> > exits).  I believe there are something wrong with command
> > substitution...  I have never encountered such a problem with zsh 2.5.
> 
> I send a `fix' for that in article 337 some time ago, I send it
> again as noon e responded.  It fixes the problem but is completely
> disables saving history on exec since an other bug I'm not going to
> fix (I have no time and I do not know exec.c well enough).

Sorry, I meant to have a look at this but I've been busy too.

If you apply this after Zoltan's patch, it should restore the expected
behaviour.  It simply changes the flag for subshells (subsh) in the
case where it's not a true subshell but an exec about to happen.  I
can't see a problem with this and the obvious tests seem to work.

*** Src/exec.c~	Fri Sep  8 17:14:24 1995
--- Src/exec.c	Fri Sep  8 17:18:07 1995
***************
*** 1281,1286 ****
--- 1281,1287 ----
  	    holdintr();
      } else if ((cmd->flags & CFLAG_EXEC) && !nullexec) {
  	entersubsh(bkg, 1);
+ 	subsh = 2;		/* we're execing, not a true subshell */
      } else {
      /* Job is running in current shell. */
  	jobtab[thisjob].stat |= STAT_CURSH;
***************
*** 1502,1508 ****
  
  	    if (!forked) {
  		if (cmd->flags & CFLAG_EXEC) {
! 		    if (subsh)
  			_exit(lastval);
  		    if (unset(NORCS) && interact && sourcelevel < 32768)
  			/* save the history file through execs */
--- 1503,1509 ----
  
  	    if (!forked) {
  		if (cmd->flags & CFLAG_EXEC) {
! 		    if (subsh == 1)
  			_exit(lastval);
  		    if (unset(NORCS) && interact && sourcelevel < 32768)
  			/* save the history file through execs */
***************
*** 1528,1534 ****
  	} else {
  	    if (cmd->flags & CFLAG_EXEC) {
  		setiparam("SHLVL", --shlvl);
! 		if (unset(NORCS) && interact && !subsh && sourcelevel < 32768)
  		    /* save the history file through execs */
  		    savehistfile(getsparam("HISTFILE"), 1, isset(APPENDHISTORY) ? 3 : 0);
  	    }
--- 1529,1536 ----
  	} else {
  	    if (cmd->flags & CFLAG_EXEC) {
  		setiparam("SHLVL", --shlvl);
! 		if (unset(NORCS) && interact && subsh != 1
! 		    && sourcelevel < 32768)
  		    /* save the history file through execs */
  		    savehistfile(getsparam("HISTFILE"), 1, isset(APPENDHISTORY) ? 3 : 0);
  	    }

-- 
Peter Stephenson <P.Stephenson@swansea.ac.uk>  Tel: +44 1792 205678 extn. 4461
WWW:  http://python.swan.ac.uk/~pypeters/      Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.


      reply	other threads:[~1995-09-08 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-09-07 19:26 Yoshiaki KASAHARA
1995-09-07 20:03 ` Zoltan Hidvegi
1995-09-08 16:29   ` P.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=14719.9509081629@pyro.swan.ac.uk \
    --to=p.stephenson@swansea.ac.uk \
    --cc=kasahara@csce.kyushu-u.ac.jp \
    --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).