On Tue, 20 Dec 2005, David Lee wrote:

> I have come across a couple of instances (copies of each other) of a
> non-portable shell "test", but I don't know how to proceed.  Help!
>
> Both "heartbeat/lib/BasicSanityCheck.in" and "heartbeat/shellfuncs.in"
> contain functionality to make temporary files.  These contain the line
>    test ! -O "$F" -o -L "$F" -o ! -f "$F"
> (where $F is a filename).
>
> The problem is that "-O $F" clause.  The "-O" (asks: "is the file's owner
> the e-uid?") simply isn't available on some OSes (e.g. Solaris).  It gives
> an error: "test: unknown operator" (and subsequent problems).
>
> What is a good fix?  The test, if available, is certainly useful, so I
> don't want to remove it.  But doing "ls ... $F | cut ..." feels clunky, as
> does a possible use of "find ...".  Advice welcome!
> [...]

Answering my own question...  I think I've solved this.

Firstly bear in mind that this code is only ever invoked if "mktemp" isn't
available. "mktemp" is present on Linux, so Linux is unaffected by this
issue.

Bourne "sh" (on Solaris, at least) builtin lacks "-O".  But the binary
"/usr/bin/test" supports it.  So I have adjusted those shell fragments to
invoke the binary "test" program (whose location/path is determined by
"configure").  Patch applied to CVS ~18:08 UTC today:
   configure.in
   heartbeat/shellfuncs.in
   heartbeat/lib/BasicSanityCheck.in


-- 

:  David Lee                                I.T. Service          :
:  Senior Systems Programmer                Computer Centre       :
:                                           Durham University     :
:  http://www.dur.ac.uk/t.d.lee/            South Road            :
:                                           Durham DH1 3LE        :
:  Phone: +44 191 334 2752                  U.K.                  :
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to