On Wed, Mar 22, 2006, Bernhard Reiter wrote:
> [...]
> Talking about shell portability, you probably know a lot more than I do.
> I have looked up POSIX for "ps" and -elf are posix options.
<grin> Yes, I know. They even can be _used_ without errors on a BSD
system. But unfortunately (for historical reasons) they do something
different on a BSD system. Hence they cannot really used in a portable
way, at least not if one wants to achieve the same results. The only
ugly workaround (if one really wants to watch the process list in a
package) would be to use "<prefix>/lib/openpkg/rpmtool signal". There
I've added a small abstraction for most of the platforms. But best is to
completely avoid looking at the process list :-(
> BTW: Do you have a reference where such shell portability issues are written
> down?
No, I've no good reference at hand. What I know is partly in my head and
partly coded down in my GNU Portable Shell Tool (shtool). Whenever I
need a portable-enough shell construct, I look into my own code of GNU
shtool: everything I used there is "portable enough" as GNU shtool since
many years is driven on mostly all Unix platforms without problems. Some
of the constructs in GNU shtool are horribly and totally unelegant, but
they work on all known Unix platforms...
> > And there my be more than one OpenPKG instance with a running Postfix on
> > a given system.
>
> Yes!
> It is a lot better to precisely look for the one postfix process we want,
> Ralf suggestion does this.
Nevertheless we have to live with the fact that the possibility exists
that our "kill -0" test might still lead an incorrect result as a
different process now could own the PID. The chance is acceptable small
under regular circumstances (not too much time between the run-time of
the original and the "kill -0" test). But it is the best we currently
can do in a portable way...
Ralf S. Engelschall
[EMAIL PROTECTED]
www.engelschall.com
______________________________________________________________________
The OpenPKG Project www.openpkg.org
User Communication List [email protected]