Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-21744

package_regex in get_package_from_available() can match wrong pkg

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 2.5.2
    • 2.6.0
    • ambari-server
    • None

    Description

      Due to the issue with regex (missing ^ and $ boundaries), resource_management.libraries.script.script.Script#get_package_from_available may return wrong package.

      >>> list=['hbase_3_0_0_0_229-master', 'hbase_3_0_0_0_229']
      >>> if re.match('hbase_(\d|_)+', 'hbase_3_0_0_0_229-master'):
      ...    print 'YES'
      ...
      YES
      >>> if re.match('hbase_(\d|_)+', 'hbase_3_0_0_0_229'):
      ...    print 'YES'
      ...
      YES
      

      In this case, the first package name from a list of available packages will be returned.
      The impact of bug is that we may install a wrong package if it's simillary named and goes first at list. Patch is a single-line fix.

      Attachments

        1. AMBARI-21744.patch
          0.8 kB
          Dmitry Lysnichenko

        Issue Links

          Activity

            People

              dmitriusan Dmitry Lysnichenko
              dmitriusan Dmitry Lysnichenko
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: