Bug 1470133 - mariadb library upgrade to 10.2 causes libnss-mysql FTBFS
mariadb library upgrade to 10.2 causes libnss-mysql FTBFS
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: libnss-mysql (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jan ONDREJ
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 1467297
  Show dependency treegraph
 
Reported: 2017-07-12 08:32 EDT by Augusto Caringi
Modified: 2017-07-21 04:16 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-21 04:16:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to allow compilation of libnss-mysql with MariaDB 10.2 (889 bytes, patch)
2017-07-12 08:32 EDT, Augusto Caringi
no flags Details | Diff

  None (edit)
Description Augusto Caringi 2017-07-12 08:32:35 EDT
Created attachment 1296944 [details]
Patch to allow compilation of libnss-mysql with MariaDB 10.2

Trying to build libnss-mysql with the new version of MariaDB 10.2 causes a build error:

mysql.c:241:14: error: 'MYSQL {aka struct st_mysql}' has no member named 'reconnect'
       ci.link.reconnect = 0; /* Safety: We can't let MySQL assume socket is
              ^

In this new version of the library the reconnect field was moved to another struct. I think that the best approach is to set it through API. I attached a patch proposal to fix the problem.

We are tracking all the possible problems regarding this MariaDB upgrade in the bug 1467297.

Copr build: https://copr.fedorainfracloud.org/coprs/g/db-sig/mariadb-10.2/package/libnss-mysql/
Comment 1 Jan ONDREJ 2017-07-15 11:43:27 EDT
Thank you for a patch. Planning to apply it and rebuild. Just currently I see, that mysql_options is deprecated. There is a replacement mysql_optionsv:

https://mariadb.com/kb/en/mariadb/mysql_optionsv/

According to documentation, it's possible to set value also as constant, not needed to define my_bool variable. I am not a good C programmer, so can you confirm, that I can do it in one line patch?

mysql_optionsv(&ci.link, MYSQL_OPT_RECONNECT, 1);

or may be:

mysql_optionsv(&ci.link, MYSQL_OPT_RECONNECT, (my_bool *)1);
Comment 2 Augusto Caringi 2017-07-17 06:36:35 EDT
The best approach is to submit the patch to upstream, to not have to keep applying a downstream patch forever.

So, the ideal patch must work with both MariaDB and MySQL, and as far as I know, the function mysql_options is not deprecated in MySQL. For this reason I think that's a good idea to talk to upstream to find out what's the best solution regarding this question.

About the another question (one line patch), I don't think so. The example in the link is:

my_bool reconnect= 1; /* enable reconnect */
mysql_optionsv(mysql, MYSQL_OPT_RECONNECT, (void *)&reconnect);

Because it's not possible to pass a literal to a function that expects a pointer.

Well, actually maybe it's possible using some C99 construct like is showed here:

https://stackoverflow.com/questions/1564701/pointer-to-literal-value

But I think that it's not worth using this.
Comment 3 Jan ONDREJ 2017-07-20 13:25:30 EDT
Upstream is more than 10 years without response.

Building with your original patch.

Thank you for help.

Note You need to log in before you can comment on or make changes to this bug.