On Tue, Dec 16, 2008 at 09:27:11PM +0100, Lars Ellenberg wrote: > On Tue, Dec 16, 2008 at 06:41:45PM +0100, Dejan Muhamedagic wrote: > > Hi, > > > > On Mon, Dec 15, 2008 at 02:45:43PM +0100, Arndt Roth wrote: > > > Hi *, > > > > > > Anybody seen this before and can explain what it means? > > > > > > Dec 14 09:08:32 server lrmd: [32686]: info: RA output: > > > (resource_sysinfo:0:monitor:stderr) > > > /usr/lib/ocf/resource.d//heartbeat/SysInfo: line 244: mem-08: value too > > > great for base (error token is "08") > > > > A shell parsing problem :) Looks like it considers 08 to be an > > exponent. The script is thoroughly /bin/bash, can't find my way > > through it. > > I don't think it uses too many bash features? > it still pretends to be #!/bin/sh. > > and for example all those [ x$var = x ] tests are bogus in in bash. > and the `expr ` things are not needed in bash either. > the unit parsing should be a case statement with pattern matching. > and I'd have a couple of other remarks...
:) > but unasked for, and I don't have the time to provide a patch either, > so I better shut up. > > > I guess it would be better to use something more > > reasonable for string splitting and arithmetic, awk or perl or > > python. Or just drop the leading 0 from the offending variable. > > You can try this patch: > > > > http://hg.linux-ha.org/dev/rev/dda4a93f90a7 > > actually, sh parses numbers starting with 0 as octal, > and yes, the digit 8 is too great for base 8. > :-( > > you can either drop all leading zeros. > as in this particular case, it can only be two digits, > there can only be one leading zero, > - mem=$[mem-$mem_round] > + mem=$[mem-${mem_round#0}] > should be enough. > > or you can prepend an explicit base, like so > - mem=$[mem-$mem_round] > + mem=$[mem-10#$mem_round] > > which likely is a bash feature only. > > as an aside, > bash is able to even use base 2 to 64, so at least in bash, > echo $[2#001000001 - 64#11] is zero > ;) I'd say, shell pushed too far, but, well, no use discussing that Thanks for clarifying :) Dejan > > -- > : Lars Ellenberg > : LINBIT | Your Way to High Availability > : DRBD/HA support and consulting http://www.linbit.com > > DRBD? and LINBIT? are registered trademarks of LINBIT, Austria. > _______________________________________________ > Linux-HA mailing list > [email protected] > http://lists.linux-ha.org/mailman/listinfo/linux-ha > See also: http://linux-ha.org/ReportingProblems _______________________________________________ Linux-HA mailing list [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
