zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: Help needed with execcmd() (was: Re: Cant fg a suspended su (4.1.0-dev-7))
Date: Sat, 1 Mar 2003 18:42:10 +0000	[thread overview]
Message-ID: <1030301184210.ZM837@candle.brasslantern.com> (raw)
In-Reply-To: <87smuaw1o9.fsf_-_@ceramic.fifi.org>

On Feb 27, 12:47am, Philippe Troin wrote:
} Subject: Help needed with execcmd() (was: Re: Cant fg a suspended su (4.1.
}
} Could somebody familiar with Src/exec.c point out for me where I can
} insert a statement where the following conditions are true:

I'm not sure I can tell you that, but ...

}   - I can find out if we are doing a real exec(), not a "fake" exec
}     (BTW, what's a "fake" exec?)

A "fake" exec means that the current shell has state that must explicitly
be cleaned up after the external command begins, so the shell can't just
replace its process image with that of the new process.  Instead it forks,
but then [eventually] exits to simulate an exec having taken place.

As noted in one of the comments in exec.c, this is similar to the case
where the command to be exec'd is a builtin.

}     following a "exec blah" command
}     line. For example, in execcmd(), I can find this out with the
}     do_exec variable.

The shell will never do a real exec on do_exec false, but do_exec true
does not imply the opposite.  A fake exec could still occur.  If you're
in the code beyond the comment that reads

    /* Make a copy of stderr for xtrace output before redirecting */

then (is_exec == 1 && forked == 0) means it's a real exec; before the
big comment about "Do we need to fork?" the test is more complex.
 
}   - the terminal (SHTTY) is still open

This should be true any time SHTTY > -1.

}   - there will be no more terminal or process group ids changes before
}     we hit zexecve() (meaning no more attachtty(), nor setpgrp())
} 
} I can't seem to find a spot where all three conditions are true.

I'm not 100% certain, but I don't think there is a spot where all three
conditions are true, because of the side-effects of the STTY environment
variable.  There may be a spot where all three plus "STTY is not set"
are true, but it'd have to be after all the redirections have been
processed, so probably it's never true until somewhere inside the
execute() function.


  reply	other threads:[~2003-03-01 18:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-21 18:07 Cant fg a suspended su (4.1.0-dev-7) Peter Whaite
2003-02-22 23:04 ` Bart Schaefer
2003-02-22 23:42   ` Bart Schaefer
2003-02-25  0:38   ` Philippe Troin
2003-02-27  8:47     ` Help needed with execcmd() (was: Re: Cant fg a suspended su (4.1.0-dev-7)) Philippe Troin
2003-03-01 18:42       ` Bart Schaefer [this message]
2003-02-25  1:29 ` Cant fg a suspended su (4.1.0-dev-7) Philippe Troin
2003-02-25  3:00   ` Peter Whaite
2003-02-25  3:37     ` Philippe Troin
2003-02-25 16:34       ` Philippe Troin
2003-02-25 17:02         ` Peter Whaite
2003-03-06  4:47           ` Philippe Troin
2003-03-06 18:23             ` Peter Whaite
2003-03-06 22:14               ` Philippe Troin
2003-03-07 12:18               ` Peter Stephenson
2003-03-07 14:01                 ` Philippe Troin
2003-02-26  6:18 ` Philippe Troin
2003-02-26 16:25   ` Bart Schaefer
2003-02-26 16:34     ` Peter Stephenson
2003-02-26 20:30     ` Philippe Troin

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=1030301184210.ZM837@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).