Bug 257705 - databases/mariadb105-server: Fails to install: cannot install: MySQL versions mismatch: mysql105-client is installed and wanted version is mariadb105-client.
Summary: databases/mariadb105-server: Fails to install: cannot install: MySQL versions...
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Bernard Spil
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2021-08-09 09:38 UTC by ATAG
Modified: 2023-04-10 12:28 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brnrd)


Attachments
dmesg.boot (11.55 KB, text/plain)
2021-08-10 06:11 UTC, ATAG
no flags Details
pkg (21.12 KB, text/plain)
2021-08-10 06:11 UTC, ATAG
no flags Details
make (...) -dv output (645.11 KB, application/gzip)
2022-03-13 11:33 UTC, António Trindade
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ATAG 2021-08-09 09:38:50 UTC
root@me:/usr/ports/databases/mariadb105-server # make
/usr/local/bin/mysql: unknown variable 'promt=\u@\h [\d\]>\_'
/usr/local/bin/mysql: unknown variable 'promt=\u@\h [\d\]>\_'
===>  mariadb105-server-10.5.12 cannot install: MySQL versions mismatch:
mysql105-client is installed and wanted version is mariadb105-client.
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mariadb105-server


Of course, i have mariadb105-client installed, but it detekts wrong?
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-08-10 01:57:18 UTC
Thank you for your report. Could you please include additional information, including:

- full build log (as an attachment, compressed if necessary)
- pkg version -v output (as an attachment)
- /var/run/dmesg.boot (as an attachment)
- /etc/make.conf contents (as an attachment), if not empty
Comment 2 ATAG 2021-08-10 06:11:30 UTC
Created attachment 227071 [details]
dmesg.boot
Comment 3 ATAG 2021-08-10 06:11:57 UTC
Created attachment 227072 [details]
pkg
Comment 4 ATAG 2021-08-10 06:12:50 UTC
make.conf isempty,there is no build log, because build can't start.
Comment 5 António Trindade 2022-03-08 15:03:47 UTC
I'd like to report it also happens to me.
MariaDB 10.6 ports are also affected.
Comment 6 Bernard Spil freebsd_committer freebsd_triage 2022-03-09 19:25:07 UTC
(In reply to António Trindade from comment #5)

There was an error in CONFLICTS for 10.6 that was fixed with https://cgit.freebsd.org/ports/commit/databases/mariadb106-server/Makefile?id=823a87f4bb14b5bb454e175e250414742988378f

Does the issue persist?
Comment 7 Bernard Spil freebsd_committer freebsd_triage 2022-03-09 19:29:06 UTC
(In reply to ATAG from comment #0)

Is your tree up-to-date? When you have mariadb105-client is installed, the conflict message from Mk/Uses/mysql.mk should reflect that e.g.:

> mariadb106-client is installed and wanted version is mariadb103-client

`make -V_MYSQL_FLAVOUR` in the -server dir would show that.
Comment 8 António Trindade 2022-03-11 11:42:59 UTC
Hi,

I just updated my ports tree and tried again.

# pkg info | grep mariadb
mariadb105-server-10.5.13      Multithreaded SQL database (server)
mariadb106-client-10.6.7_1     Multithreaded SQL database (client)

The output from portmaster:

# portmaster -o databases/mariadb106-server databases/mariadb105-server

===>>> Currently installed version: mariadb105-server-10.5.13
===>>> Port directory: /usr/ports/databases/mariadb106-server

===>>> Gathering distinfo list for installed ports

===>>> Launching 'make checksum' for databases/mariadb106-server in background
===>>> Gathering dependency list for databases/mariadb106-server from ports
===>>> Initial dependency check complete for databases/mariadb106-server


===>>> Starting build for databases/mariadb106-server <<<===

===>>> All dependencies are up to date

===>  Cleaning for mariadb106-server-10.6.7_1
===>  mariadb106-server-10.6.7_1 cannot install: MySQL versions mismatch:
mysql106-client is installed and wanted version is mariadb106-client.
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mariadb106-server

As you can check, pkgdb has mariadb106-client installed, but the ports tree detect it as mysql106-client.

Regards
Comment 9 Stefan Eßer freebsd_committer freebsd_triage 2022-03-11 14:57:56 UTC
(In reply to António Trindade from comment #8)

# pkg info | grep mariadb
mariadb105-server-10.5.13      Multithreaded SQL database (server)
mariadb106-client-10.6.7_1     Multithreaded SQL database (client)

This looks good - you have the latest MariaDB client and a backlevel server, which you want to upgrade.

But you get:

===>  mariadb106-server-10.6.7_1 cannot install: MySQL versions mismatch:
mysql106-client is installed and wanted version is mariadb106-client.

This seems to indicate that the installed mariadb106-client has been mistaken for a MySQL client by /usr/ports/Mk/Uses/mysql.mk . But I tried and failed to reproduce this issue on my system.

There is no mysql106-client - therefore the error message is bogus.

You may want to look at the variables used in mysql.mk and test there value with "make -V", e.g.:

$ cd databases/mariadb106-client
$ make -V _MYSQL_VER -V MYSQL_VER -V _WANT_MYSQL_VER

Try to determine where the wrong value is assigned ...

As mentioned above, I cannot reproduce the issue on my system at all.
Comment 10 António Trindade 2022-03-11 18:31:37 UTC
When I execute that make command in the mariadb106-client, I get three empty lines (no output).

When executed in the mariadb106-server, I get the following output:
106
106m
106m

I have no mention of MySQL or MariaDB versions in my /etc/make.conf.
Comment 11 Stefan Eßer freebsd_committer freebsd_triage 2022-03-11 19:29:34 UTC
(In reply to António Trindade from comment #10)

You report that "make -V _MYSQL_VER -V MYSQL_VER -V _WANT_MYSQL_VER" in the mariadb106-server directory returns the following output:

106 <<=== this is wrong
106m
106m

For some reason _MYSQL_VER comes out as plain "106" without the "m".
The following is the relevant part of mysql.mk:

# Setting/finding MySQL version we want.                                                                                                                                                                  
.if exists(${LOCALBASE}/bin/mysql)
_MYSQL!=        ${LOCALBASE}/bin/mysql_config --version | ${SED} -e 's/\([0-9]\{1,2\}\)\.\([0-9]*\).*/\1\2/'
_PERCONA!=      ${LOCALBASE}/bin/mysql --version | ${GREP} Percona | wc -l
_MARIADB!=      ${LOCALBASE}/bin/mysql --version | ${GREP} MariaDB | wc -l

.if ${_PERCONA} == 1
_MYSQL_VER=     ${_MYSQL}p
_MYSQL_FLAVOUR= percona
.elif ${_MARIADB} == 1
_MYSQL_VER=     ${_MYSQL}m
_MYSQL_FLAVOUR= mariadb
.else
_MYSQL_VER=     ${_MYSQL}
_MYSQL_FLAVOUR= mysql
.endif
.endif

_MYSQL_FLAVOUR is only set to mariadb and the "m" is only added to _MYSQL_VER if ${LOCALBASE}/bin/mysql exists.
This file belongs to mariadb106-client (or any other MySQL type client) - does it exist on your system?

The dependency logic should ensure that ${LOCALBASE}/bin/mysql exists before the database server is built.

If ${LOCALBASE}/bin/mysql exists then check the output of "mysql --version" - should contain "MariaDB", e.g.:

$ mysql --version
mysql  Ver 15.1 Distrib 10.6.7-MariaDB, for FreeBSD14.0 (amd64) using  EditLine wrapper

Please check and report the output of this command on your system ...
Comment 12 António Trindade 2022-03-12 10:36:59 UTC
The output from the "mysql --version" is:
mysql  Ver 15.1 Distrib 10.6.7-MariaDB, for FreeBSD13.0 (amd64) using  EditLine wrapper
Comment 13 Bernard Spil freebsd_committer freebsd_triage 2022-03-12 11:58:20 UTC
I think I've found something :'(

MariaDB 10.6
> mysql  Ver 151

MySQL 5.7
> mysql  Ver 1414

MySQL 8.0
> mysql  Ver 80

Ergo: version detection in Mk/Uses/mysql.mk is broken for most versions of MySQL

Objective is to extract the product and version from the output.

> sed -E 's/.*[^0-9]([0-9]+)\.([0-9]+)\.[0-9]+.*/\1\2/'

seems to do the trick: Assume Semantic Versioning 1.2.3 and extract the major and minor version (not patch).
Comment 14 Bernard Spil freebsd_committer freebsd_triage 2022-03-12 12:22:47 UTC
(In reply to Bernard Spil from comment #13)

Scrap that. Uses mysql_config, not mysql command
Comment 15 Bernard Spil freebsd_committer freebsd_triage 2022-03-12 12:48:10 UTC
(In reply to Stefan Eßer from comment #11)

> 106 <<=== this is wrong
> 106m
> 106m

Hi Stefan, that's not wrong, that's the intended behavior.

MySQL:   MajorMinor
MariaDB: MajorMinorm
Percona: MajorMinorp

(In reply to António Trindade from comment #12)

https://cgit.freebsd.org/ports/tree/Mk/Uses/mysql.mk#n129 is what creates the text output.

> ${_MYSQL_FLAVOUR}${_MYSQL_VER:C/[mpw]//}-client

it displays if _MYSQL_VER != MYSQL_VER 

_MYSQL_FLAVOUR should be set to 'mariadb' in https://cgit.freebsd.org/ports/tree/Mk/Uses/mysql.mk#n90

Please provide make -dv output as attachment

> make -V_MYSQL_FLAVOUR -V_MYSQL_VER -VMYSQL_FLAVOUR -VMYSQL_VER -dv 2>&1 > make-dv.out

(or use script to generate a log file.)
Comment 16 Stefan Eßer freebsd_committer freebsd_triage 2022-03-12 21:37:00 UTC
(In reply to Bernard Spil from comment #15)

>> 106 <<=== this is wrong
>> 106m
>> 106m
>
>Hi Stefan, that's not wrong, that's the intended behavior.
>
>MySQL:   MajorMinor
>MariaDB: MajorMinorm
>Percona: MajorMinorp

Yes, I know the encoding of the various mysql alike variants, but that's not what the make command returned.

The command was "make -V _MYSQL_VER -V MYSQL_VER -V _WANT_MYSQL_VER" and the output thus is:

_MYSQL_VER=106
MYSQL_VER=106m
_WANT_MYSQL_VER=106m

The following test for MariaDB should have succeeded:

_MARIADB!=      ${LOCALBASE}/bin/mysql --version | ${GREP} MariaDB | wc -l

And then:

if ${_PERCONA} == 1
_MYSQL_VER=     ${_MYSQL}p
_MYSQL_FLAVOUR= percona
.elif ${_MARIADB} == 1
_MYSQL_VER=     ${_MYSQL}m
_MYSQL_FLAVOUR= mariadb
.else
_MYSQL_VER=     ${_MYSQL}
_MYSQL_FLAVOUR= mysql
.endif
.endif

With ${_PERCONA} == 0 and ${_MARIADB} == 1 (as should have been set if the "mysql --version" output contained "MariaDB") the value of ${_MYSQL_VER} should have become "106m", not "106".

But it is "106" - and that can only happen if "mysql --version" does not output a line containing MariaDB.

That's the reason I have asked for the output of "mysql --version", and why I have provided the line generated by the MariaDB client built on my system for reference.

The output of "mysql --version" given in comment 12 does contain MariaDB, though:

>mysql  Ver 15.1 Distrib 10.6.7-MariaDB, for FreeBSD13.0 (amd64) using  EditLine wrapper

And that output should have caused ${_MARIADB} to be set to "1" and thus ${_MYSQL_VER} to "106m".
Comment 17 António Trindade 2022-03-13 11:32:17 UTC
As requested by Bernard in comment #15, I uploaded the output of the
make -V_MYSQL_FLAVOUR -V_MYSQL_VER -VMYSQL_FLAVOUR -VMYSQL_VER -dv 2>&1 > make-dv.out
command.
Comment 18 António Trindade 2022-03-13 11:33:20 UTC
Created attachment 232423 [details]
make (...) -dv output
Comment 19 Bernard Spil freebsd_committer freebsd_triage 2023-04-10 12:28:38 UTC
Guess the issue is in the first 2 response lines from make in the opening post.

> /usr/local/bin/mysql: unknown variable 'promt=\u@\h [\d\]>\_'

should be

> /usr/local/bin/mysql: unknown variable 'prompt=\u@\h [\d\]>\_'

that breaks mysql output and cascades into whatever you're seeing.