[Linux-ha-dev] 2.0.x: shell-script non-portability
alanr at unix.sh
Sat Nov 12 17:08:11 MST 2005
Xun Sun wrote:
> On 11/12/05, David Lee <t.d.lee at durham.ac.uk> wrote:
>> On Thu, 10 Nov 2005, David Lee wrote:
>>> I'm at the point of trying CVS/HEAD on Solaris. I have encountered several
>>> run-time issues in "resources" shell scripts; these are generally to do with
>>> the (false) assumption that "/bin/sh" is "bash": thus they would affect any
>>> OS (probably the vast majority of non-Linux) for which this assumption is
>>> false. I've started bugzilla 953 as the "placeholder".
>>> Other issues creeping out include:
>>> o invalidity of 'export X=str' (instead need: 'X=str; export X') ;
>>> o non-availability of '[ -e ... ]' ; o need to quote variables in
>>> '[ -z ... ]' (and similar) ;
>>> o prudence to replace '[ $var ... str]' with '[ x"$var" ... x"str" ]' .
>> Another one has emerged: invalidity of the "!" in:
>> if ! command then <1> ; else <2> ; fi
>> if ! command then ... fi
>> The nearest I can get to this, that works in Bourne and bash, is:
>> if command then <2> ; else <1> ; fi
>> if command then : ; else ... fi
>> That is, removing the "!" and reversing the then/else clauses (and using a
>> null ":" if the original "else" (new "then") was empty).
>> This emerged for me (on Solaris, non-bash) with "OCF/IPaddr". I did a
>> quick look (grep, eyeball) around that area for similar things and found a
>> small number. So I propose applying the attached patch on Monday.
>> If someone with 2.0.x running on Linux could check over the details to
>> ensure that my fix hasn't introduced any breakages that would be good!
> These fixes are straightforward, and should not break anything from my
> point of view. Personally I would like to let them in. However, I am
> not sure these changes are proper for this code-freezing time, execpt
> for that the fix for resources/heartbeat/Xinetd.in is for bug 327.
If you can do them by Monday afternoon Beijing time, then I can deal
Alan Robertson <alanr at unix.sh>
"Openness is the foundation and preservative of friendship... Let me
claim from you at all times your undisguised opinions." - William
More information about the Linux-HA-Dev