I think I've got a fix, by changing the test for a negative number to
use [[ ]] and a regex to check for only positive numbers (with or
without a decimal), and not zero (matching non-zero real numbers in one
regex was getting messy). Using this:

if ! [[ "$i" != "0" && "$i" =~ ^[0-9]+([.][0-9]+)?$ ]]

It will match non-numbers, double-decimals (2.5.3), and any negative
signs, and 0. It will also match decimal numbers without a leading zero
like .5 , but maybe that's good enough.

It will let fancontrol work with a floating point/decimal INTERVAL
without the error message.

I'll attach a patch file for the fancontrol script (not sure if the file
names/paths at the top are correct though)

(Another idea was to change the sed call when INTERVAL is assigned, but
that wouldn't allow error checking/reporting)


** Attachment added: "Patch to match non-numbers, negative numbers, and 0, but 
allow positive floating point/decimal numbers"
   
https://bugs.launchpad.net/ubuntu/+source/lm-sensors/+bug/1572777/+attachment/4641123/+files/patch-fancontrol-positive-decimal-number

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1572777

Title:
  fancontrol Error message if INTERVAL not an integer, bug if INTERVAL a
  negative non-integer

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lm-sensors/+bug/1572777/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to