Subject: FVWM: `Exec exec foo' v. `Exec foo'

From: Norvell Spearman <[email-masked]>
Date: Fri, 15 Nov 2002 13:04:58 -0600

fvwm-2.5.4

I've noticed when I put something like `Exec exec xterm' in my .fvwm2rc
file, I lose colorization of file types (`set' shows LS_COLORS to have
no value.  If I use just `Exec xterm' all the colors are there (`set'
shows LS_COLORS with all its regular values) but then I wonder about
what's in the fvwm man page:

``Without that [the added `exec'], the shell that fvwm invokes to run your
command stays until the command exits.  In effect, you'll have twice as
many processes	running as you need.  Note that some shells are smart
enough to avoid this, but it never hurts to include the "exec" anyway.''

The shell I use is /bin/bash.  That shows up when I type `env' and I set
it explicitly with the ExecUseShell command near the top of my .fvwm2rc.

When I do a `ps -ax' both with and without the `exec', I see two
processes:  one for xterm and one for /bin/bash (Does this also explain
why iconifying one xterm window sometimes causes FvwmEvent to play two
quasi-synchonous sounds?).  According to the man page, should there not
be only one process when using `Exec exec xterm' or is my bash
configuration possibly broken in some way?

Thanks for any help regarding this.

-- 
Norvell Spearman
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Ben Winslow <[email-masked]>
Date: Fri, 15 Nov 2002 15:40:43 -0500

> Thanks for any help regarding this.

I would guess that when you do Exec xterm, the environment you started X 
with is being inherited, and when you do Exec exec xterm, the 
environment is being cleared.  Try putting xterm*loginShell: true in 
your ~/.Xresources (or ~/.Xdefaults if appropriate), or starting xterm 
like: Exec exec xterm -xrm 'loginShell: true'

-- 
Ben

---

From: Norvell Spearman <[email-masked]>
Date: Fri, 15 Nov 2002 16:24:48 -0600

> like: Exec exec xterm -xrm 'loginShell: true'

None of those worked; I'm not sure yet why.  What I did was this:

Exec exec xterm -ls

and this seems to be working now.  Thanks for pointing me in the right
direction.  I suppose this may not have technically been an fvwm issue;
I'll try to dig a little deeper next time before I post.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 18 Nov 2002 10:29:34 +0100

> configuration possibly broken in some way?

The man page exaggerates a bit.  Without "exec", the xterm is
started as a separate process, whereas with "exec" it replaces the
*parent* shell:

  Without exec:

    bash
      xterm
        bash (client app)

  With exec:

    xterm (replaces original bash)
      bash (client app)

Bye

Dominik ^_^  ^_^

---

From: Norvell Spearman <[email-masked]>
Date: Mon, 18 Nov 2002 18:36:47 -0600

>     xterm (replaces original bash)

I added an entry to the menu so that I have ``XTerm'' and ``Other
Xterm,'' with the former using `Exec xterm' and the latter using `Exec
exec xterm.'  When I open ``Xterm'' and ``Other XTerm'' from the menu
and then do a ``ps -ax'' I get one xterm and one bash entry for both.  I
also noticed that my xterm is really a shell script calling xterm.real
(the real binary), so I changed both menu entries to call xterm.real
directly --- with the same results as above.  My ps output shows
something like this:

29836 ?        S      0:00 xterm.real -sb <more options> 
29837 pts/1    S      0:00 bash

Since bash is listed after xterm.real, does this mean that bash is
xterm's client (as in your second scenario above)?  If so, why do using
both ``Exec exec xterm'' and ``Exec xterm'' seem to produce the same
results.  I'm not trying to belabor the point; I just want to be sure I
don't have unnecessary processes going on.  Thanks very much.

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 19 Nov 2002 09:54:53 +0000

> don't have unnecessary processes going on.  Thanks very much.

With bash, both "Exec xterm" and "Exec exec xterm" are equivalent, since
it is "smart" not to fork in this case. Also try "ps xf" or "ps auxf".

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 19 Nov 2002 11:08:27 +0100

On Mon, Nov 18, 2002 at 06:36:47PM -0600, Norvell Spearman wrote:
> xterm's client (as in your second scenario above)?

In this case, probably yes.  Try "pstree -p" to see which process
was spawned by whom.

> If so, why do using
> results.

Good question.  I can only guess that modern shells use "exec"
automatically when started with "<shell> -c <cmd>".

> I'm not trying to belabor the point; I just want to be sure I

Bye

Dominik ^_^  ^_^