[Bug 2085815] Re: php8.1-odbc missing dependency to unixodbc-dev

Athos Ribeiro 2085815 at bugs.launchpad.net
Tue Nov 5 13:56:08 UTC 2024


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

A second issue, as shown by the original report, is that the missing
package is unixodbc-dev instead of 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 unbersioned shared library libodbccr.so instead of the versioned one (libodbccr.so.2).

This issue affects all supported ubuntu series.

Again, at a first look, one 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 that 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, a solution would indeed be to make php-odbc depend on both
libs (or at least suggest/recommend the libodbccr2) 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 an alternative for fix (2)). This needs further
investigation, i.e., we need an answer to "why does libodbccr2 depend on
libodbc2?"


Finally, regardless of the solution found, it would be nice to discuss this issue with Debian (both with php-odbc and unixodbc maintainers) before commiting to a fix here to avoid carrying a delta indefinitely on one or both these packages. Moreover, I am inclined to say that this change in behavior may not be fit for an SRU depending on how we define what a fix is for this case since this could break working database connections for users (this could work though IF we find out that libodbc2 should depend on libodbccr2).

Next steps here would be to file a bug in debian which would reach both
php-odbc and unixodbc maintainers and finding the answer to "why does
libodbccr2 depend on libodbc2?"

A reproducer using lxc is attached.


** Attachment added: "Bug reproducer"
   https://bugs.launchpad.net/ubuntu/+source/unixodbc/+bug/2085815/+attachment/5834802/+files/reproducer.sh

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to unixodbc in Ubuntu.
https://bugs.launchpad.net/bugs/2085815

Title:
  php8.1-odbc missing dependency to unixodbc-dev

Status in unixodbc package in Ubuntu:
  New

Bug description:
  unixodbc is used with freetds to connect to mssql databases with PHP.

  The following PHP connect string is used:
  odbc_connect(DSN, USER, PASSWORD, SQL_CUR_USE_ODBC);

  SQL_CUR_USE_ODBC is used to speed up database access. The following
  error occurs:

  ##################
  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
  Error: >>[unixODBC][Driver Manager]Can't open cursor lib ‘/etc/libodbccr.so’ : file not found<<
  ##################

  When you install unixodbc-dev, a symbolic link /usr/lib/x86_64-linux-
  gnu/libodbccr.so -> libodbccr.so.2.0.0 is installed by the package,
  which fixes the problem.

  So I think that php8.1-odbc should have a dependency on unixodbc-dev.

  ##################################

  ProblemType: Bug
  ApportVersion: 2.20.11-0ubuntu82.6
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Tue Oct 29 09:40:54 2024
  Dependencies:
   adduser 3.118ubuntu5
   apt 2.4.13
   apt-utils 2.4.13
   ca-certificates 20240203~22.04.1
   coreutils 8.32-4.1ubuntu1.2
   debconf 1.5.79ubuntu1
   debconf-i18n 1.5.79ubuntu1
   dpkg 1.21.1ubuntu2.3
   gcc-12-base 12.3.0-1ubuntu1~22.04
   gpgv 2.2.27-3ubuntu2.1
   libacl1 2.3.1-1
   libapt-pkg6.0 2.4.13
   libattr1 1:2.5.1-1build1
   libaudit-common 1:3.0.7-1build1
   libaudit1 1:3.0.7-1build1
   libbz2-1.0 1.0.8-5build1
   libc6 2.35-0ubuntu3.8
   libcap-ng0 0.7.9-2.2build3
   libcap2 1:2.44-1ubuntu0.22.04.1
   libcom-err2 1.46.5-2ubuntu1.2
   libcrypt1 1:4.4.27-1
   libdb5.3 5.3.28+dfsg1-0.8ubuntu3
   libffi8 3.4.2-4
   libgcc-s1 12.3.0-1ubuntu1~22.04
   libgcrypt20 1.9.4-3ubuntu3
   libgmp10 2:6.2.1+dfsg-3ubuntu1
   libgnutls30 3.7.3-4ubuntu1.5
   libgpg-error0 1.43-3
   libgssapi-krb5-2 1.19.2-2ubuntu0.4
   libhogweed6 3.7.3-1build2
   libidn2-0 2.3.2-2build1
   libk5crypto3 1.19.2-2ubuntu0.4
   libkeyutils1 1.6.1-2ubuntu3
   libkrb5-3 1.19.2-2ubuntu0.4
   libkrb5support0 1.19.2-2ubuntu0.4
   liblocale-gettext-perl 1.07-4build3
   libltdl7 2.4.6-15build2
   liblz4-1 1.9.3-2build2
   liblzma5 5.2.5-2ubuntu1
   libnettle8 3.7.3-1build2
   libnsl2 1.3.0-2build2
   libodbc2 2.3.9-5ubuntu0.1
   libp11-kit0 0.24.0-6build1
   libpam-modules 1.4.0-11ubuntu2.4
   libpam-modules-bin 1.4.0-11ubuntu2.4
   libpam0g 1.4.0-11ubuntu2.4
   libpcre2-8-0 10.39-3ubuntu0.1
   libseccomp2 2.5.3-2ubuntu2
   libselinux1 3.3-1build2
   libsemanage-common 3.3-1build2
   libsemanage2 3.3-1build2
   libsepol2 3.3-1build1
   libssl3 3.0.2-0ubuntu1.18
   libstdc++6 12.3.0-1ubuntu1~22.04
   libsystemd0 249.11-0ubuntu3.12
   libtasn1-6 4.18.0-4build1
   libtext-charwidth-perl 0.04-10build3
   libtext-iconv-perl 1.7-7build3
   libtext-wrapi18n-perl 0.06-9
   libtinfo6 6.3-2ubuntu0.1
   libtirpc-common 1.3.2-2ubuntu0.1
   libtirpc3 1.3.2-2ubuntu0.1
   libudev1 249.11-0ubuntu3.12
   libunistring2 1.0-1
   libxxhash0 0.8.1-1
   libzstd1 1.4.8+dfsg-3build1
   openssl 3.0.2-0ubuntu1.18
   passwd 1:4.8.1-2ubuntu2.2
   perl-base 5.34.0-3ubuntu1.3
   php-common 2:92ubuntu1
   php8.1-common 8.1.2-1ubuntu2.19
   psmisc 23.4-2build3
   sensible-utils 0.0.17
   tar 1.34+dfsg-1ubuntu0.1.22.04.2
   ubuntu-keyring 2021.03.26
   ucf 3.0043
   zlib1g 1:1.2.11.dfsg-2ubuntu9.2
  DistroRelease: Ubuntu 22.04
  NonfreeKernelModules: bmhook tmhook
  Package: php8.1-odbc 8.1.2-1ubuntu2.19
  PackageArchitecture: amd64
  ProcCpuinfoMinimal:
   processor	: 3
   vendor_id	: GenuineIntel
   cpu family	: 6
   model		: 63
   model name	: Intel(R) Xeon(R) Gold 6354 CPU @ 3.00GHz
   stepping	: 0
   microcode	: 0xd0003b9
   cpu MHz		: 2992.968
   cache size	: 39936 KB
   physical id	: 6
   siblings	: 1
   core id		: 0
   cpu cores	: 1
   apicid		: 6
   initial apicid	: 6
   fpu		: yes
   fpu_exception	: yes
   cpuid level	: 13
   wp		: yes
   flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt arat md_clear flush_l1d arch_capabilities
   bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit mmio_stale_data retbleed bhi
   bogomips	: 5985.93
   clflush size	: 64
   cache_alignment	: 64
   address sizes	: 43 bits physical, 48 bits virtual
   power management:
  ProcEnviron:
   LANGUAGE=
   TERM=linux
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=de_DE.UTF-8
   SHELL=/bin/bash
  ProcVersionSignature: Ubuntu 5.15.0-122.132-generic 5.15.163
  SourcePackage: php8.1
  Tags:  jammy
  Uname: Linux 5.15.0-122-generic x86_64
  UpgradeStatus: No upgrade log present (probably fresh install)
  _MarkForUpload: True

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unixodbc/+bug/2085815/+subscriptions




More information about the foundations-bugs mailing list