[ClusterLabs] ocf scripts shell and local variables

Gabriele Bulfon gbulfon at sonicle.com
Mon Aug 29 08:58:11 EDT 2016


I think the main issue is the usage of the "local" operator in ocf*
I'm not an expert on this operator (never used!), don't know how hard it is to replace it with a standard version.
Happy to contribute, it still the case
Gabriele
----------------------------------------------------------------------------------------
Sonicle S.r.l.
:
http://www.sonicle.com
Music:
http://www.gabrielebulfon.com
Quantum Mechanics :
http://www.cdbaby.com/cd/gabrielebulfon
----------------------------------------------------------------------------------
Da: Kristoffer Grönlund
A: gbulfon at sonicle.com Cluster Labs - All topics related to open-source clustering welcomed
kgaillot at redhat.com Cluster Labs - All topics related to open-source clustering welcomed
Data: 29 agosto 2016 14.36.23 CEST
Oggetto: Re: [ClusterLabs] ocf scripts shell and local variables
Gabriele Bulfon
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.
Cheers,
Kristoffer
--
// Kristoffer Grönlund
// kgronlund at suse.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/users/attachments/20160829/04c3d2a9/attachment-0003.html>


More information about the Users mailing list