[MDEV-18228] Odd behavior of numeric comparison in MTR Created: 2019-01-14  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Scripts & Clients, Tests
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: upstream


 Description   

The main concern here is that the comparison might be used in regression tests, and the wrong behavior will cause false negatives – that is, regressions might stay unnoticed.

Run the test as

CHECK_NUMBER=<number of your choosing> perl ./mtr testname

MTR test

if ($CHECK_NUMBER < 1)
{
  echo # $CHECK_NUMBER is less than 1;
}
if ($CHECK_NUMBER > 1)
{
  echo # $CHECK_NUMBER is greater than 1;
}
if ($CHECK_NUMBER == 1)
{
  echo # $CHECK_NUMBER is equal to 1;
}

Results (on 10.2, but they appear the same everywhere):

# 2147483647 is greater than 1
# 2147483648 is less than 1
# 100000000000 is greater than 1
# 1000000000000 is less than 1


Generated at Thu Feb 08 08:42:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.