On Sun, Jun 09, 2002 at 12:21:40PM -0400, Courier User wrote:
>
> Here is a small subset of the group of tests that I performed on my
> freebsd 4.0 system before posting my previous message:
>
> [ ... ]

I tried some new tests, and they shed some more light on this problem:

1% echo "echo foo" >/tmp/xxx
2% /usr/bin/env - /bin/sh -c ". /tmp/xxx ; (echo bar &)"
foo
bar
3% echo "T=foo; export T" >/tmp/xxx
4% /usr/bin/env - /bin/sh -c "T=bar; export T; . /tmp/xxx; (/usr/bin/env &)"
T=foo

Note that enclosing the final command in parentheses along with its
ampersand fixes the problem on my system. Therefore, I just now put
the following command as the final line in share/couierctl.start
(again, this is a single line in the original script ... I just
split it here in this message for ease of readability):

  /usr/bin/env - /bin/sh -c "set -a ; . ${sysconfdir}/courierd; \
    ( ${libexecdir}/courier/courierd & )"

[ note the parentheses ]

I then completely shut down Courier, made sure all the processes
were really dead, and then started it up again.  And this time, all
of the variables in etc/courierd did indeed appear in the
environment of courierd when I do a "ps aeuxwww | egrep 'courier[d]'",
and the DEFAULTDELIVERY instructions in etc/courierd are now indeed
being honored.

Therefore, using this "parentheses" method is an alternative to the
"here document" method that I mentioned in my earlier messages.

And because of all this, I stand by my original statement that the
following construct that is contained in a few Courier startup
scripts is not portable:

  /usr/bin/env - /bin/sh -c "blah; blah; blah ... &"

However, the following construct seems more portable.

  /usr/bin/env - /bin/sh -c "blah; blah; ...; (blah &)"


And for reference purposes, here's the set of tests that I described
in my previous message:

> 1% echo "echo foo" >/tmp/xxx
> 2% /usr/bin/env - /bin/sh -c ". /tmp/xxx; echo bar &"
> bar
> 3% /usr/bin/env - /bin/sh -c ". /tmp/xxx; echo bar"
> foo
> bar
> 4% /usr/bin/env - /bin/sh -c "(. /tmp/xxx; echo bar) &"
> bar
> 5% echo "T=foo; export T" >/tmp/xxx
> 6% /usr/bin/env - /bin/sh -c "T=bar; export T; . /tmp/xxx; /usr/bin/env &"
> T=bar
> 7% /usr/bin/env - /bin/sh -c "T=bar; export T; . /tmp/xxx; /usr/bin/env"
> T=foo

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to