Your message dated Wed, 18 Dec 2024 11:19:37 +0000
with message-id <[email protected]>
and subject line Bug#1089695: fixed in unixodbc 2.3.12-2
has caused the Debian Bug report #1089695,
regarding unixodbc: Connecting to a database using the odbc cursor library 
fails due to missing runtime dependency
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1089695: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1089695
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: unixodbc
Version: 2.3.12-1
Severity: normal
X-Debbugs-Cc: [email protected]

In PHP, when using the following command through php-odbc:

odbc_connect(\$dsn, \$user, \$password, SQL_CUR_USE_ODBC);

I get the following error:

PHP Warning:  odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open 
cursor lib '/etc/libodbccr.so' : file not found, SQL state 01000 in SQLConnect 
in /root/reproducer.php on line 5

The missing libodbccr.so issue happens when this code runs:
https://sources.debian.org/src/unixodbc/2.3.12-1/DriverManager/SQLConnect.c/?hl=2451#L2451

Here we see that, instead of linking libodbccr2, libodbc2 opens it in runtime
with dlopen. Hence, at a first glance, libodbc2 should at least suggest
libodbccr2.

However, as shown in the error message, the file being searched for is the
unversioned shared object, provided by unixodbc-dev, and not the versioned one
provided by libodbccr2.  This happens because DEFINE_CURSOR_LIB_VER is not
defined, as shown in the following snippet:
https://sources.debian.org/src/unixodbc/2.3.12-1/DriverManager/SQLConnect.c/?hl=2451#L606.
This makes libodbc2 try loading the unversioned shared library libodbccr.so
instead of the versioned one (libodbccr.so.2).

This issue affects all supported ubuntu series.

At a first glance, we may identify 2 fixes being needed here:

1) the unixodbc package should be built with DEFINE_CURSOR_LIB_VER set so the
   runtime dlopen call looks for the versioned shared object so we do not need 
to
   depend on a -dev package in production environments; and

2) libodbc2 should depend, recommend, or at least suggest libodbccr2

The problem is the latter fix (2) would create a circular dependency since
libodbccr2 already depends on libodbc2. Interestingly, none of the binaries are
linked against the other.

In this case, an alternative solution to (2) would be

2.alternative) making php-odbc (and all other packages using the odbc cursor) 
depend on
               both libodbc2 and libodbccr2 (or at least suggest/recommend the 
libodbccr2).
               This would only make sense after fix (1) is applied.

I also wonder if libodbccr2 should really depend on libodbc2 since they are not
linked (maybe the dependency should go the other way around, which would be yet
another alternative for fix (2)). This wound need further investigation, i.e.,
we need an answer to "why does libodbccr2 depend on libodbc2?".

A reproducer for trixie using incus is attached.
#!/bin/bash

CONTAINER_NAME=php-odbc

PHP_REPRODUCER=$(mktemp)

cat > $PHP_REPRODUCER <<EOF
<?php
\$dsn = 
"Driver={SQLite3};Server=127.0.0.1;Database=odbc;uid=someuser;pwd=somepassword";
\$user = "root";
\$password = "";
\$success = odbc_connect(\$dsn, \$user, \$password, SQL_CUR_USE_ODBC);
if(\$success) {
        echo "OK\n";
} else {
        echo "Connection failure\n";
}
EOF

echo "DEBUG: Preparing container"
incus delete -f $CONTAINER_NAME > /dev/null 2>&1
incus launch images:debian/trixie $CONTAINER_NAME > /dev/null 2>&1

echo "DEBUG: Installing dependencies"
incus exec $CONTAINER_NAME -- apt update > /dev/null 2>&1
incus exec $CONTAINER_NAME -- apt install -y php php-odbc php-sqlite3 odbcinst 
libsqliteodbc > /dev/null 2>&1
echo "DEBUG: Pushing reproducer"
incus file push $PHP_REPRODUCER $CONTAINER_NAME/root/reproducer.php
rm -f $PHP_REPRODUCER
echo "DEBUG: Configuring environment"
incus exec $CONTAINER_NAME -- cp /etc/odbcinst.ini /etc/odbc.ini
echo "DEBUG: Reproducing failure"
incus exec $CONTAINER_NAME -- php reproducer.php
echo "DEBUG: Installing libodbccr2"
incus exec $CONTAINER_NAME -- apt install -y libodbccr2 > /dev/null 2>&1
echo "DEBUG: Reproducing failure with libodbccr2 installed (libodbccr.so.2 is 
present)"
incus exec $CONTAINER_NAME -- php reproducer.php
echo "DEBUG: Installing unixodbc-dev"
incus exec $CONTAINER_NAME -- apt install -y unixodbc-dev > /dev/null 2>&1
echo "DEBUG: Demonstrating success with same reproducer, now with unixodbc-dev 
installed (libodbccr.so is present)"
incus exec $CONTAINER_NAME -- php reproducer.php

--- End Message ---
--- Begin Message ---
Source: unixodbc
Source-Version: 2.3.12-2
Done: Hugh McMaster <[email protected]>

We believe that the bug you reported is fixed in the latest version of
unixodbc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Hugh McMaster <[email protected]> (supplier of updated unixodbc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 17 Dec 2024 22:34:56 +1100
Source: unixodbc
Architecture: source
Version: 2.3.12-2
Distribution: unstable
Urgency: medium
Maintainer: Hugh McMaster <[email protected]>
Changed-By: Hugh McMaster <[email protected]>
Closes: 1089695
Changes:
 unixodbc (2.3.12-2) unstable; urgency=medium
 .
   * debian/control:
     + libodbc2 now Recommends libodbccr2.
     + libodbccr2 no longer Depends on libodbc2.
     + libodbccr2 Enhances libodbc2.
     + Raise Standards-Version to 4.7.0 from 4.6.2 (no changes needed).
   * debian/copyright: Update for 2024.
   * debian/patches: Add 0001-configure-ac-cursor-lib.patch to enable a
     versioned cursor library (Closes: #1089695, LP: #2085815).
   * debian/rules: Pass --enable-cursor-ver to configure.
Checksums-Sha1:
 2636c2916ba49d7f6b772b20a6dcc5871e2b97c4 2228 unixodbc_2.3.12-2.dsc
 5b64bfd29b71d3d75115add09bbe159cdd2d68f0 17468 unixodbc_2.3.12-2.debian.tar.xz
 1b5a4c5df15ff40e78631ec0d612d4fab6a9e007 5888 
unixodbc_2.3.12-2_source.buildinfo
Checksums-Sha256:
 3bbee2b01af0fe0e48097c07d5154b0758d61515073032c8e732aab4ab9a648a 2228 
unixodbc_2.3.12-2.dsc
 5f81c0ae66711b90d9896d9baffacf2f6aa7538697fe0f6bf576806f1d86b069 17468 
unixodbc_2.3.12-2.debian.tar.xz
 0865758842f4c8f8c1c12b1898c9b1835009df6ec8ef222adc02377f904b0f51 5888 
unixodbc_2.3.12-2_source.buildinfo
Files:
 66ad7e8ae3189171bced1a02b789ff4b 2228 libs optional unixodbc_2.3.12-2.dsc
 ab9979c8c8e014f078507ec0653dd81c 17468 libs optional 
unixodbc_2.3.12-2.debian.tar.xz
 8668952cd74da76667126e0853229ce2 5888 libs optional 
unixodbc_2.3.12-2_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEEOiCBPKV5RoaMUVIRWsYQdMXoG8QFAmdiqh4PHGhtY0BkZWJp
YW4ub3JnAAoJEFrGEHTF6BvEtmcQAJ/q63iMBmwYojrQKlmEXnB4eEObaNwhf09l
PsRPI1rpgFxahdPFRh97a4CaiODzFp3DPUJsq0QBJznd2gU2K6cCRIk2/7IHjFNG
Bov0i3weMswKoXdHsZIyLRP5veUwQtjOC66aJnGA7UChaGPNHDLHrTrsVpPOQGqw
pga71ekdX8s1nVZX43zPl7NZ2NHpMMTKu+owEAS5ARRU8cVss1+bhZuhmb5/wIIE
vgB8FBbig9EYzzFpKJQmOzWh9fn8Xw5ZX7HwUiiJXb94LS8kl4K8DYeNyuw0wc8P
kWxksWhS7Int5lUiR5hIhq44Iqt9N8uCPBb00SZFpI3tvCCzkgM4jZb8BOMAsAhY
r5thGK2b4TKUXO4NN89CAKDIAC0NuXmYL7PFHDOSEeLlX0lTAnCeHpCKLAs8QOoL
ffVm97KxrlDczSc5rGfiHZE4t58vaEDf+P5FVcrtxOmULUQUQMisFVNy6KKCil6+
FE6Ns2d/qDjJYjMFCV/3H0WqAtX9VEtOHysQji52TONTez+RVZJ+TvyREfU7Di3y
fMoRZlSBeBzs50xy5GITjNluL4x5aCJH26uu8UAx3E4tywK1ypTtMxXxjEwUmqU8
qJRQ52Fcoz+4QBWCKULqmAjrT03Fb2P2wnQULz2AN3NyYpsNoq0Q0BEb43dFmn8X
pGix4EW8
=XlWU
-----END PGP SIGNATURE-----

Attachment: pgpgQIZ1TOrJY.pgp
Description: PGP signature


--- End Message ---

Reply via email to