Bug 1474362 - python ldb bindings are bundled in samba python bindings
python ldb bindings are bundled in samba python bindings
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: samba (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Guenther Deschner
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-24 09:00 EDT by Lukas Slebodnik
Modified: 2017-07-24 16:17 EDT (History)
10 users (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-24 09:49:34 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)

  None (edit)
Description Lukas Slebodnik 2017-07-24 09:00:50 EDT
Description of problem:
I tried to find out users of library libpyldb-util.so.1 in rawhide and I found out it is used by python2-ldb and samba python bindings
  sh# dnf repoquery --whatrequires 'libpyldb-util.so.1()(64bit)'
  Last metadata expiration check: 2:14:58 ago on Mon 24 Jul 2017 12:30:47 PM CEST.
  python2-ldb-devel-0:1.2.0-2.fc27.x86_64
  python3-samba-2:4.7.0-0.6.rc1.fc27.x86_64
  samba-python-2:4.7.0-0.6.rc1.fc27.x86_64

Further investigation showed that python ldb bindings are bundled in samba python bindings

sh#  find /usr/lib64/ -name "*.so*" | while read file; do echo ----$file---; objdump -p $file | grep libpyldb-util; done | grep -B1 "NEEDED.*libpyldb-util"
----/usr/lib64/python3.6/site-packages/ldb.cpython-36m-x86_64-linux-gnu.so---
  NEEDED               libpyldb-util.cpython-36m-x86-64-linux-gnu.so.1
--
----/usr/lib64/python3.6/site-packages/samba/_ldb.cpython-36m-x86_64-linux-gnu.so---
  NEEDED               libpyldb-util.so.1
--
----/usr/lib64/python3.6/site-packages/samba/auth.cpython-36m-x86_64-linux-gnu.so---
  NEEDED               libpyldb-util.cpython-36m-x86-64-linux-gnu.so.1
--
----/usr/lib64/python2.7/site-packages/ldb.so---
  NEEDED               libpyldb-util.so.1
--
----/usr/lib64/python2.7/site-packages/samba/_ldb.so---
  NEEDED               libpyldb-util.so.1
--
----/usr/lib64/python2.7/site-packages/samba/auth.so---
  NEEDED               libpyldb-util.so.1
--
----/usr/lib64/python2.7/site-packages/samba/dsdb.so---
  NEEDED               libpyldb-util.so.1
--
----/usr/lib64/python2.7/site-packages/samba/dsdb_dns.so---
  NEEDED               libpyldb-util.so.1 

Version-Release number of selected component (if applicable):
 rpm -qf /usr/lib64/python3.6/site-packages/ldb.cpython-36m-x86_64-linux-gnu.so  /usr/lib64/python3.6/site-packages/samba/_ldb.cpython-36m-x86_64-linux-gnu.so /usr/lib64/python3.6/site-packages/samba/auth.cpython-36m-x86_64-linux-gnu.so /usr/lib64/python2.7/site-packages/ldb.so /usr/lib64/python2.7/site-packages/samba/_ldb.so /usr/lib64/python2.7/site-packages/samba/auth.so /usr/lib64/python2.7/site-packages/samba/dsdb.so /usr/lib64/python2.7/site-packages/samba/dsdb_dns.so
python3-ldb-1.2.0-2.fc27.x86_64
python3-samba-4.7.0-0.6.rc1.fc27.x86_64
python3-samba-4.7.0-0.6.rc1.fc27.x86_64
python2-ldb-1.2.0-2.fc27.x86_64
samba-python-4.7.0-0.6.rc1.fc27.x86_64
samba-python-4.7.0-0.6.rc1.fc27.x86_64
samba-python-4.7.0-0.6.rc1.fc27.x86_64
samba-python-4.7.0-0.6.rc1.fc27.x86_64

How reproducible:
Deterministic

Steps to Reproduce:
1. dnf install -y python3-samba samba-python
2. rpm -ql python3-samba samba-python | grep "ldb"

Actual results:
/usr/lib64/python3.6/site-packages/samba/_ldb.cpython-36m-x86_64-linux-gnu.so
/usr/lib64/python2.7/site-packages/samba/_ldb.so

Expected results:
empty output. Which woudl mean that there is not bundled python ldb bindings

Additional info:
Comment 1 Andreas Schneider 2017-07-24 09:28:58 EDT
krikkit:~ # rpm -q python3-ldb
python3-ldb-1.2.1-1.fc26.x86_64
krikkit:~ # rpm -ql python3-ldb | grep _ldb.so                           
krikkit:~ # 

I do not see that file in a ldb package.
Comment 2 Lukas Slebodnik 2017-07-24 09:49:34 EDT
explanation is simple ldb.so and samba._ldb.so are two different classes.
One extend another

sh$ python2 -c 'import ldb; help(ldb)' | grep class
    Control = class control(__builtin__.object)
    class Dn(__builtin__.object)
    class Ldb(__builtin__.object)
    class LdbError(exceptions.Exception)
    class Message(__builtin__.object)
    class MessageElement(__builtin__.object)
    Module = class LdbModule(__builtin__.object)
    class Tree(__builtin__.object)

sh$ python2 -c 'import samba._ldb; help(samba._ldb)' | grep class
    class Ldb(ldb.Ldb)

So it is not a bug just a little bit confusing.
Comment 3 Lukas Slebodnik 2017-07-24 09:54:15 EDT
BTW it is a little bit interesting that libpyldb-util.so.1 is used by more python2 modules thenpython3

python2:
  samba/_ldb.so samba/auth.so samba/dsdb_dns.so samba/dsdb.so

python3:
  samba/_ldb.*.so samba/auth.*.so

I thought then samba was completely converted to python3.
Comment 4 Alexander Bokovoy 2017-07-24 16:17:23 EDT
No, samba is not completely converted to Python 3. You can consult with Petr Viktorin. He has a spread sheet outlining what modules were converted and which weren't yet.

I tried to run 'samba-tool' under Python 3, and the tool immediately failed as there are still some incompatibilities there.

However, 4.7.0-RC3 (to be released this week) should have enough Python 3 modules to enable FreeIPA to run with Python 3 and AD trust. You'd need some small patches which weren't yet pushed to FreeIPA git master, but samba is ready to support Python 3 conversion of FreeIPA already.

We'll cover Python 3 in Samba AD components eventually. It is like with MIT Kerberos support in Samba -- while smbd and client libraries were working with MIT Kerberos for a long time, Samba AD side was lagging.

We can get samba/dsdb_dns.so samba/dsdb.so added to Python 3 build but we cannot yet get to the point where we can reliably test them under Python 3. So improving on the basics (samba-tool itself) would be one of earlier priorities.

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