On Thu, Apr 26, 2007 at 04:42:13PM +0100, David Lee wrote:
> On Thu, 26 Apr 2007, Dejan Muhamedagic wrote:
> 
> > On Thu, Apr 26, 2007 at 10:00:10AM +0200, Andrew Beekhof wrote:
> > > On 4/26/07, Simon Horman <[EMAIL PROTECTED]> wrote:
> > > >----- Forwarded message from Simon Horman <[EMAIL PROTECTED]> -----
> > > >
> > > >[...]
> > > >On Fri, Apr 20, 2007 at 08:38:59PM +0200, Erich Schubert wrote:
> > > >> Package: heartbeat-2
> > > >> Version: 2.0.7-2
> > > >> Severity: normal
> > > >>
> > > >> The IPAddr2 script contains bashisms.
> > > >> /usr/lib/ocf/resource.d/heartbeat/IPaddr2:
> > > >>
> > > >>
> > > >IF_MAC=${IF_MAC:0:2}:${IF_MAC:2:2}:${IF_MAC:4:2}:${IF_MAC:6:2}:${IF_MAC:8:2}:${IF_MAC:10:2}
> > > >>
> > > >> Hotfix: replace /bin/sh in the first line by /bin/bash
> > > >> Other scripts might be affected as well.
> > > >
> > > >Thanks, I'll get this fixed. Please let me know if you find any more.
> > >
> > > i'll push up a fix momentarily
> >
> > Since IPaddr2 is Linux specific, I guess it's OK to have it run by
> > bash.
> 
> 
> Executive summary of what follows: a cautious agreement with that:
>   "Since IPaddr2 is Linux specific, I guess it's OK to have ... bash."
> 
> 
> Now the waffle: feel free to hit delete:
> 
> A personal view (coming from a portability angle and a Solaris angle):
> 
> In general, I would usually argue for Bourne-only, avoiding bash where
> reasonably possible, in line with GNU portability recommendations.
> 
> But if IPaddr2 really is Linux specific then I'd be OK with bash in this
> defined instance, if it makes the insides of the script significantly
> cleaner and clearer (more understandable and more maintainable).
> 
> 
> The GNU portability purists would argue for Bourne, and discourage bash,
> based on the fact that every UN*X-like OS has Bourne, but only some have
> bash.  Personally, I try to follow that where reasonably possible, to keep
> things portable, including in heartbeat.
> 
> As a counter-example: They would also argue against using shell functions
> because (apparently) some Bournes lack them.  Personally, I don't bother
> following that one, including in heartbeat, because most "real world"
> Bournes these days seem to have shell functions.  Indeed, I've added some
> myself to heartbeat down the years (and in an email earlier this week, I
> suggested adding another).
> 
> 
> Solaris?  When I started with heartbeat, Solaris versions of the time
> lacked native bash.  These days, Solaris distributions include bash,
> (although not necessarily within the default installation set but at least
> these days it's easily installable).
> 
> So in the heartbeat context nowadays, I would usually continue to advise
> against bash-isms where reasonably possible (for OSes that may still lack
> native (or natively available) bash) but in favour of shell functions
> (because they tend to add significant clarity, with no apparent loss to
> likely OSes).  In the case of a known Linux-only script, then bash is
> probably OK if its use adds value (clarity, maintainability, etc.).
> 
> (Hope you don't mind that rambling piece of background waffle!)

No, not at all. I think that this is important and I'd second your
opinion.

This is not meant as an argument, but I don't even understand the
line above, just guess that it's something about splitting
something into something. However, that script is, I believe,
useable just on Linux.

One thing which I'm really missing is variables local to a
function (typeset or local). On the one hand, it is easy to mix up
variable names and on the other very tedious to keep track of all
the variables in a long script.

It is not clear which standard should be followed. I think that
there's also something like POSIX shell, but no idea how
widespread.

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

-- 
Dejan
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to