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

./mysql-test/mysql-test-run.pl not identifying mariadb version

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 5.5.32
    • 5.5.34
    • None
    • None
    • 5.5.32-MariaDB-1~wheezy for debian-linux-gnu on x86_64

    Description

      I followed the following steps after having an apt sources like for mariadb

      apt-get build-dep mariadb-5.5
      apt-get install cmake libaio1 libaio-dev fakeroot valgrind
      apt-get source mariadb-5.5
      cd mariadb-5.5*

      edited debian/control and debian/rules as per https://kb.askmonty.org/en/how-to-produce-a-full-stack-trace-for-mysqld-the-mariadb-server/#comment_359 (except using 5.5 as version number)
      edit debian/rules added -DCMAKE_BUILD_TYPE=Debug to cmake as per https://kb.askmonty.org/en/compiling-mariadb-for-debugging/

      dpkg-buildpackage -us -uc (http://www.debian.org/doc/manuals/maint-guide/build.en.html)

      resulted in error:
      "mysql-test-run: *** ERROR: Could not find version of MariaDB"

      added "mtr_report("List: ", join("\n", @list));" before the mtr_error in ./mysql-test/mysql-test-run.pl rerunnign with dpkg-buildpackage -nc -us -uc revealed:
      "List: /home/danblack/mariadb-5.5-5.5.32+maria/builddir/sql/mysqld Ver 5.5.32-MariaDB-1~wheezy for debian-linux-gnu on x86_64 (mariadb.org binary distribution)..."

      A quick tests shows the regex not matching:

      perl
      $a="/home/danblack/mariadb-5.5-5.5.32+maria/builddir/sql/mysqld Ver 5.5.32-MariaDB-1~wheezy for debian-linux-gnu on x86_64 (mariadb.org binary distribution)";
      $exe_mysqld="/home/danblack/mariadb-5.5-5.5.32+maria/builddir/sql/mysqld";
      $a =~ /^$exe_mysqld\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/;
      print "0=$0 1=$1 2=$2 ";
      0=- 1= 2=

      Attachments

        Activity

          danblack Daniel Black created issue -

          Hi Daniel,

          The regex does not find a match because you have a '+' in your file path. The logic might be worth fixing, but as a workaround, could you please try to remove it?

          elenst Elena Stepanova added a comment - Hi Daniel, The regex does not find a match because you have a '+' in your file path. The logic might be worth fixing, but as a workaround, could you please try to remove it?
          elenst Elena Stepanova made changes -
          Field Original Value New Value
          Assignee Elena Stepanova [ elenst ]
          danblack Daniel Black added a comment -

          Yes renaming works. Thanks for identifying the obvious regex fault.

          Logging: ./mysql-test-run.pl --force
          Using suites: main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,handler-,heap-,innodb-,maria-,optimizer_unfixed_bugs-,oqgraph-,parts-,percona-,perfschema-,plugins-,rpl-,sphinx-,sys_vars-,unit-,vcol-
          vardir: /home/danblack/mariadb-5.5-5.5.32_maria/builddir/mysql-test/var
          Removing old var directory...
          Creating var directory '/home/danblack/mariadb-5.5-5.5.32_maria/builddir/mysql-test/var'...
          Checking supported features...
          MariaDB Version 5.5.32-MariaDB-1~wheezy

          Given the standard "apt-get source mariadb-5.5" creates this directory name I still think its worth fixing.

          danblack Daniel Black added a comment - Yes renaming works. Thanks for identifying the obvious regex fault. Logging: ./mysql-test-run.pl --force Using suites: main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,handler-,heap-,innodb-,maria-,optimizer_unfixed_bugs-,oqgraph-,parts-,percona-,perfschema-,plugins-,rpl-,sphinx-,sys_vars-,unit-,vcol- vardir: /home/danblack/mariadb-5.5-5.5.32_maria/builddir/mysql-test/var Removing old var directory... Creating var directory '/home/danblack/mariadb-5.5-5.5.32_maria/builddir/mysql-test/var'... Checking supported features... MariaDB Version 5.5.32-MariaDB-1~wheezy Given the standard "apt-get source mariadb-5.5" creates this directory name I still think its worth fixing.
          danblack Daniel Black added a comment -

          Since exe_mysqld isn't a regex escape everything that makes it look like one.

          so add:
          $exe_mysqld =~ s/([\\.+*{}()[\]])/\\\1/g;

          before: mtr_error("Could not find version of MariaDB")

          to test:
          perl e '$a="/home/danblack/maria
          db
          ()5.5-5.5.32+m[]a*ria"; $a =~ s/([\\.+*{}()[\]])/\\\1/g; print "$a\n";'
          /home/danblack/maria\\db-()5\.5-5\.5\.32+m[]a*ria

          danblack Daniel Black added a comment - Since exe_mysqld isn't a regex escape everything that makes it look like one. so add: $exe_mysqld =~ s/([\\.+*{}() [\]] )/\\\1/g; before: mtr_error("Could not find version of MariaDB") to test: perl e '$a="/home/danblack/maria db ()5.5-5.5.32+m[]a*ria"; $a =~ s/([\\.+*{}() [\]] )/\\\1/g; print "$a\n";' /home/danblack/maria\\db-()5\.5-5\.5\.32+m[]a*ria

          I don't feel quite safe modifying exe_mysqld, it might happen that it's used somewhere else. On the other hand, there seems no good reason to match the line with the complete path to mysqld, it should be enough to start with the file name, something like:

          === modified file 'mysql-test/mysql-test-run.pl'
          — mysql-test/mysql-test-run.pl 2013-07-16 17:09:54 +0000
          +++ mysql-test/mysql-test-run.pl 2013-09-05 23:35:53 +0000
          @@ -1889,8 +1889,9 @@
          $list =~ s/\n

          {22}

          (\S)/ $1/g;

          my @list= split '\n', $list;
          + my $bn = basename($exe_mysqld);
          mtr_error("Could not find version of MariaDB")

          • unless shift(@list) =~ /^$exe_mysqld\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/;
            + unless shift(@list) =~ /$bn\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/;
            $mysql_version_id= $1*10000 + $2*100 + $3;
            $mysql_version_extra= $4;
            mtr_report("MariaDB Version $1.$2.$3$4");

          I'll pass it to serg to decide.

          elenst Elena Stepanova added a comment - I don't feel quite safe modifying exe_mysqld, it might happen that it's used somewhere else. On the other hand, there seems no good reason to match the line with the complete path to mysqld, it should be enough to start with the file name, something like: === modified file 'mysql-test/mysql-test-run.pl' — mysql-test/mysql-test-run.pl 2013-07-16 17:09:54 +0000 +++ mysql-test/mysql-test-run.pl 2013-09-05 23:35:53 +0000 @@ -1889,8 +1889,9 @@ $list =~ s/\n {22} (\S)/ $1/g; my @list= split '\n', $list; + my $bn = basename($exe_mysqld); mtr_error("Could not find version of MariaDB") unless shift(@list) =~ /^$exe_mysqld\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/; + unless shift(@list) =~ /$bn\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/; $mysql_version_id= $1*10000 + $2*100 + $3; $mysql_version_extra= $4; mtr_report("MariaDB Version $1.$2.$3$4"); I'll pass it to serg to decide.
          elenst Elena Stepanova made changes -
          Fix Version/s 5.5.33 [ 13300 ]
          Assignee Elena Stepanova [ elenst ] Sergei Golubchik [ serg ]
          danblack Daniel Black added a comment -

          > I don't feel quite safe modifying exe_mysqld, it might happen that it's used somewhere else.

          It was a local variable that wasn't used again.

          > On the other hand, there seems no good reason to match the line with the complete path to mysqld, it should be enough to start with the file name, something like:

          It can get the incorrect version if a exe_mysql contains for example "/test/mysqld Ver 5.6.5/mariadb-5.5-5.5.32+maria/builddir/sql/mysqld"

          danblack Daniel Black added a comment - > I don't feel quite safe modifying exe_mysqld, it might happen that it's used somewhere else. It was a local variable that wasn't used again. > On the other hand, there seems no good reason to match the line with the complete path to mysqld, it should be enough to start with the file name, something like: It can get the incorrect version if a exe_mysql contains for example "/test/mysqld Ver 5.6.5/mariadb-5.5-5.5.32+maria/builddir/sql/mysqld"

          You are right of course, sorry, blame late night for that. Assigning back to myself to take another look.

          elenst Elena Stepanova added a comment - You are right of course, sorry, blame late night for that. Assigning back to myself to take another look.
          elenst Elena Stepanova made changes -
          Assignee Sergei Golubchik [ serg ] Elena Stepanova [ elenst ]

          Hi Sergei,

          See the original suggestion by Daniel here: https://mariadb.atlassian.net/browse/MDEV-4977?focusedCommentId=34410&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-34410 .

          If the standard installation procedure creates a path which is not further recognized by MTR, I think it should be fixed.

          elenst Elena Stepanova added a comment - Hi Sergei, See the original suggestion by Daniel here: https://mariadb.atlassian.net/browse/MDEV-4977?focusedCommentId=34410&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-34410 . If the standard installation procedure creates a path which is not further recognized by MTR, I think it should be fixed.
          elenst Elena Stepanova made changes -
          Assignee Elena Stepanova [ elenst ] Sergei Golubchik [ serg ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13500 ]
          Fix Version/s 5.5.33 [ 13300 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 5.5.34 [ 13700 ]
          Fix Version/s 5.5.33a [ 13500 ]
          danblack Daniel Black added a comment -

          Patch added for clarity

          danblack Daniel Black added a comment - Patch added for clarity
          danblack Daniel Black made changes -
          Attachment mdev-4977.patch [ 23610 ]
          serg Sergei Golubchik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          danblack Daniel Black added a comment -

          Nice use of \Q\E in regex, thanks Sergei

          danblack Daniel Black added a comment - Nice use of \Q\E in regex, thanks Sergei
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 28800 ] MariaDB v2 [ 44660 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 44660 ] MariaDB v3 [ 61820 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 61820 ] MariaDB v4 [ 147005 ]

          People

            serg Sergei Golubchik
            danblack Daniel Black
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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