Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-18228

Odd behavior of numeric comparison in MTR

    XMLWordPrintable

Details

    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
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            elenst Elena Stepanova
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.