[ClusterLabs] ocf scripts shell and local variables

Kristoffer Grönlund kgronlund at suse.com
Mon Aug 29 08:36:23 EDT 2016

Gabriele Bulfon <gbulfon at sonicle.com> writes:

> Hi Ken,
> I have been talking with the illumos guys about the shell problem.
> They all agreed that ksh (and specially the ksh93 used in illumos) is absolutely Bourne-compatible, and that the "local" variables used in the ocf shells is not a Bourne syntax, but probably a bash specific.
> This means that pointing the scripts to "#!/bin/sh" is portable as long as the scripts are really Bourne-shell only syntax, as any Unix variant may link whatever Bourne-shell they like.
> In this case, it should point to "#!/bin/bash" or whatever shell the script was written for.
> Also, in this case, the starting point is not the ocf-* script, but the original RA (IPaddr, but almost all of them).
> What about making the code base of RA and ocf-* portable?
> It may be just by changing them to point to bash, or with some kind of configure modifier to be able to specify the shell to use.
> Meanwhile, changing the scripts by hands into #!/bin/bash worked like a charm, and I will start patching.
> Gabriele

Hi Gabriele,

Yes, your observation is correct: The resource scripts are not fully
POSIX compatible in this respect. We have been fixing these issues as
they come up, but since we all use bash-like shells it has never become
a pressing issue (IIRC Debian did have some of the same issues since
/bin/sh there is dash, which is also not fully bash-compatible).

It would be fantastic if you could file issues or submit patches at
https://github.com/ClusterLabs/resource-agents for the resource agents
where you still find these problems.


// Kristoffer Grönlund
// kgronlund at suse.com

More information about the Users mailing list