[MDEV-4977] ./mysql-test/mysql-test-run.pl not identifying mariadb version Created: 2013-09-02  Updated: 2013-11-13  Resolved: 2013-11-12

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.32
Fix Version/s: 5.5.34

Type: Bug Priority: Minor
Reporter: Daniel Black Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

5.5.32-MariaDB-1~wheezy for debian-linux-gnu on x86_64


Attachments: File mdev-4977.patch    

 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=



 Comments   
Comment by Elena Stepanova [ 2013-09-03 ]

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?

Comment by Daniel Black [ 2013-09-03 ]

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.

Comment by Daniel Black [ 2013-09-03 ]

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

Comment by Elena Stepanova [ 2013-09-06 ]

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.

Comment by Daniel Black [ 2013-09-06 ]

> 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"

Comment by Elena Stepanova [ 2013-09-06 ]

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

Comment by Elena Stepanova [ 2013-09-06 ]

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.

Comment by Daniel Black [ 2013-09-23 ]

Patch added for clarity

Comment by Daniel Black [ 2013-11-13 ]

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

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