Bug 1561400

Summary: Test case failure: /CoreOS/unixODBC/mysql-simple
Product: Red Hat Enterprise Linux 7 Reporter: Karel Volný <kvolny>
Component: mysql-connector-odbcAssignee: Michal Schorm <mschorm>
Status: CLOSED ERRATA QA Contact: Karel Volný <kvolny>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5-AltCC: acaringi, databases-maint, hhorak, jjanco, mmuzila, praiskup, vdanek
Target Milestone: pre-dev-freeze   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: mysql-connector-odbc-5.2.5-8.el7 Doc Type: Bug Fix
Doc Text:
Cause: Unnecessary linking of odbc library to the driver. Consequence: On architecture s390x running a trivial query using isql leads to unexpected error: Could not SQLConnect Fix: Drops the linking of odbc library to the driver. Result: Command finish successfully.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:11:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1534323    
Attachments:
Description Flags
Patch to fix the problem in s390x arch none

Description Karel Volný 2018-03-28 09:29:37 UTC
Filed from caserun https://tcms.engineering.redhat.com/run/328473/#caserun_17084424

Version-Release number of selected component (if applicable):
rhel-7

Steps to Reproduce: 
run the test /CoreOS/unixODBC/mysql-simple


Actual results: 
:: [ 12:13:18 ] :: [  BEGIN   ] :: Run a trivial query using isql :: actually running '/usr/bin/isql MySQL root -v &> test.out <<EOF
select 123 * 456;
quit
EOF'
:: [ 12:13:18 ] :: [   FAIL   ] :: Run a trivial query using isql (Expected 0, got 1)
[ISQL]ERROR: Could not SQLConnect



running the test manually, pausing around the isql command and trying to connect via mysql client, there is no problem, the server is running, database 'test' exists ...



putting

Setup           = /usr/lib64/libodbcmyS.so

explicitly to odbcinst.ini doesn't help


note that this issue is observed on s390x and aarch64 only (not expressed in the Hardware filed of Bugzilla as it doesn't allow to specify multiple choices)

Comment 3 Karel Volný 2018-04-10 07:10:48 UTC
switching to mysql-connector-odbc as per acaringi's email which I quote below:


    In the end, the root cause is the same as described by Pavel here:

    https://bugzilla.redhat.com/show_bug.cgi?id=1029454

    A difference in behavior of s390x dynamic linker compared with other
architectures.

    I'll give a simplified example:

    The Driver Manager (unixODBC) has 3 different SQLConnect functions:

    $ nm -D /usr/lib64/libodbc.so|grep SQLConnect
    00000000000103e0 T SQLConnect
    0000000000011210 T SQLConnectA
    000000000002cfe0 T SQLConnectW

    And the driver (mysql connector odbc) has only one (this is not a
problem):

    $ nm -D /usr/lib64/libmyodbc5w.so|grep SQLConnect
    0000000000057780 T SQLConnectW

    In x86_64, when the driver manager dlopen the driver, it sets some
pointers like that:

    sqlConnect = NULL
    sqlConnectA = NULL
    sqlConnectW = SQLConnectW

    The driver manager uses a blacklist table, as explained by Pavel, to
not point the pointers to their own functions (with same names as the
driver functions).

    But this is not working on s390x due to differences in linker behavior
(related to the addresses of functions).

    So, the result was:

    sqlConnect = SQLConnect (wrongly, from Driver Manager)
    sqlConnectA = SQLConnectA (wrongly, from Driver Manager)
    sqlConnectW = SQLConnectW (from driver)

    This was happening also because the driver was being linked
against libodbc.so (which is not needed).

    So, the simplest way to fix the problem is just drop the linking with
this library from mysql connector odbc.

    In upstream and in version of mysql connector odbc in Fedora 27
(5.3.10), this is already fixed.

Comment 5 Augusto Caringi 2018-04-11 16:18:39 UTC
Created attachment 1420467 [details]
Patch to fix the problem in s390x arch

Comment 10 errata-xmlrpc 2018-10-30 10:11:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3116

Comment 11 Honza Horak 2020-07-15 06:07:38 UTC
*** Bug 1550611 has been marked as a duplicate of this bug. ***