[DRBD-user] Drbd resource return 20 (unspecified)

Ian! D. Allen idallen at idallen.ca
Wed Nov 10 18:53:03 CET 2010

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


On Wed, Nov 10, 2010 at 10:04:10AM +0100, Lars Ellenberg wrote:
> $OCF_RUNNING (which is ... wait... WTF!)
> OCF_RUNNING is non-existent. And as it is empty, it will expand to nothing,
> the statement will expand to "return", and return without argument
> is equivalent to "return $?", so it will return the exit status of the
> last command, which was "drbdadm role".

Oh no!

Anyone writing and running production shell scripts should be using the
"-u" option on the script shebang line to catch the above sort of nonsense:

   #!/bin/sh -u
   ...

Never trust a script that lets typing mistakes quietly vanish.  If you
really need to check or use a variable that you expect might not even
be defined, you can simply use the syntax ${varname-}, e.g.

   if [ "${FOOBAR-}" = "" ] ; then

Please!  No scripts with secret typing mistakes in them!

-- 
| Ian! D. Allen  -  idallen at idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/



More information about the drbd-user mailing list