Bug 2290343

Summary: python-django-auth-ldap: FTBFS in Fedora Rawhide: RuntimeError: slapd exited before opening port
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-django-auth-ldapAssignee: Orphan Owner <extras-orphan>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: aekoroglu, fti-bugs, gk
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
URL: https://koschei.fedoraproject.org/package/python-django-auth-ldap
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-08-23 13:03:27 UTC Type: ---
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: 2260875, 2260877, 2300529, 2244836    

Description Karolina Surma 2024-06-04 08:54:01 UTC
Description of problem:
Package python-django-auth-ldap fails to build from source in Fedora Rawhide.

Version-Release number of selected component (if applicable):
4.1.0-8.fc40

Steps to Reproduce:
koji build --scratch f41 python-django-auth-ldap-4.1.0-8.fc40.src.rpm

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/python-django-auth-ldap

Reproducible: Always

Actual Results:  
+ /usr/bin/python3 -m tox --current-env -q --recreate -e py312
/usr/lib/python3.12/site-packages/django/conf/__init__.py:241: RemovedInDjango50Warning: The default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior.
  warnings.warn(
Found 89 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
E
======================================================================
ERROR: setUpClass (tests.tests.LDAPTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/python-django-auth-ldap-4.1.0-build/django-auth-ldap-4.1.0/tests/tests.py", line 140, in setUpClass
    cls.server.start()
  File "/usr/lib64/python3.12/site-packages/slapdtest/_slapdtest.py", line 449, in start
    self._start_slapd()
  File "/usr/lib64/python3.12/site-packages/slapdtest/_slapdtest.py", line 423, in _start_slapd
    raise RuntimeError("slapd exited before opening port")
RuntimeError: slapd exited before opening port
----------------------------------------------------------------------
Ran 0 tests in 0.271s
FAILED (errors=1)

Comment 1 Karolina Surma 2024-06-12 15:01:06 UTC
*** Bug 2291674 has been marked as a duplicate of this bug. ***

Comment 2 Fedora Fails To Install 2024-06-19 20:00:01 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

This package fails to install and maintainers are advised to take one of the following actions:

 - Fix this bug and close this bugzilla once the update makes it to the repository.
   (The same script that posted this comment will eventually close this bugzilla
   when the fixed package reaches the repository, so you don't have to worry about it.)

or

 - Move this bug to ASSIGNED if you plan on fixing this, but simply haven't done so yet.

or

 - Orphan the package if you no longer plan to maintain it.


If you do not take one of these actions, the process at https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs will continue.
This package may be orphaned in 7+ weeks.
This is the first reminder (step 3) from the policy.

Don't hesitate to ask for help on https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ if you are unsure how to fix this bug.

Comment 3 Fedora Fails To Install 2024-07-13 08:02:24 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

This package fails to install and maintainers are advised to take one of the following actions:

 - Fix this bug and close this bugzilla once the update makes it to the repository.
   (The same script that posted this comment will eventually close this bugzilla
   when the fixed package reaches the repository, so you don't have to worry about it.)

or

 - Move this bug to ASSIGNED if you plan on fixing this, but simply haven't done so yet.

or

 - Orphan the package if you no longer plan to maintain it.


If you do not take one of these actions, the process at https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs will continue.
This package may be orphaned in 4+ weeks.
This is the second reminder (step 4) from the policy.

Don't hesitate to ask for help on https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ if you are unsure how to fix this bug.

Comment 4 Fedora Fails To Install 2024-08-13 00:02:41 UTC
This package has been orphaned.

You can pick it up at https://src.fedoraproject.org/rpms/python-django-auth-ldap by clicking button "Take". If nobody picks it up, it will be retired and removed from a distribution.

Comment 5 Fedora Admin user for bugzilla script actions 2024-08-22 18:41:29 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 6 Miro Hrončok 2024-08-23 13:03:27 UTC
Automation has figured out the package is retired in rawhide.

If you like it to be unretired, please open a ticket at https://pagure.io/releng/new_issue?template=package_unretirement

Comment 7 Red Hat Bugzilla 2024-12-22 04:25:15 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days

Comment 8 gk 2025-03-14 14:50:27 UTC
The build fails because the slapd daemon for some reason does not start on the koji build system. The test passes fine on my fedora 41 system so the failure seems to be related to the koji build system setup.

```
$ head /etc/os-release
NAME="Fedora Linux"
VERSION="41 (Workstation Edition)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=41
VERSION_CODENAME=""
PLATFORM_ID="platform:f41"
PRETTY_NAME="Fedora Linux 41 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
[ .. ]

$ tox
ruff: find interpreter for spec PythonSpec(path=/usr/bin/python3)
ruff: proposed PythonInfo(spec=CPython3.13.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]', encoding_fs_io=utf-8-utf-8)
ruff: commands[0]> ruff check .
All checks passed!
ruff: exit 0 (0.01 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> ruff check . pid=771178
ruff: OK ✔ in 0.04 seconds
docs: find interpreter for spec PythonSpec(path=/usr/bin/python3)
docs: proposed PythonInfo(spec=CPython3.13.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]', encoding_fs_io=utf-8-utf-8)
.pkg: find interpreter for spec PythonSpec(path=/usr/bin/python3)
.pkg: proposed PythonInfo(spec=CPython3.13.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]', encoding_fs_io=utf-8-utf-8)
.pkg: _optional_hooks> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: exit None (0.07 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta pid=771206
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: exit None (0.14 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta pid=771209
.pkg: build_sdist> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: exit None (0.20 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python /usr/lib/python3.13/site-packages/pyproject_api/_backend.py True setuptools.build_meta pid=771220
docs: install_package> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/19/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz
docs: exit 0 (1.84 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/19/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz pid=771231
docs: commands[0]> make -C docs html
make: Entering directory '/home/gk/tmp/python-django-auth-ldap/django-auth-ldap/docs'
Running Sphinx v8.2.3
loading translations [en]... done
Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`.
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
reading sources...
looking for now-outdated files... none found
no targets are out of date.
preparing documents... done
copying assets...
copying static files...
Writing evaluated template result to /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/docs/_build/html/_static/basic.css
Writing evaluated template result to /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/docs/_build/html/_static/documentation_options.js
Writing evaluated template result to /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/docs/_build/html/_static/language_data.js
Writing evaluated template result to /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/docs/_build/html/_static/classic.css
Writing evaluated template result to /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/docs/_build/html/_static/sidebar.js
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
generating indices... genindex py-modindex done
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.
make: Leaving directory '/home/gk/tmp/python-django-auth-ldap/django-auth-ldap/docs'
docs: exit 0 (0.43 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> make -C docs html pid=771254
docs: OK ✔ in 2.8 seconds
django42: find interpreter for spec PythonSpec(path=/usr/bin/python3)
django42: proposed PythonInfo(spec=CPython3.13.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]', encoding_fs_io=utf-8-utf-8)
django42: install_package> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/20/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz
django42: exit 0 (2.07 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/20/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz pid=771292
django42: commands[0]> .tox/django42/bin/python -Wa -b -m django test --settings tests.settings
/home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/django42/lib/python3.13/site-packages/django/conf/__init__.py:241: RemovedInDjango50Warning: The default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior.
  warnings.warn(
Found 94 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..............................................................................................
----------------------------------------------------------------------
Ran 94 tests in 1.042s

OK
Destroying test database for alias 'default'...
django42: exit 0 (1.33 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/django42/bin/python -Wa -b -m django test --settings tests.settings pid=771315
django42: commands[1]> .tox/django42/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py'
.
----------------------------------------------------------------------
Ran 1 test in 0.090s

OK
django42: exit 0 (0.15 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/django42/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py' pid=771441
django42: OK ✔ in 3.55 seconds
django50: find interpreter for spec PythonSpec(path=/usr/bin/python3)
django50: proposed PythonInfo(spec=CPython3.13.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]', encoding_fs_io=utf-8-utf-8)
django50: install_package> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/21/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz
django50: exit 0 (1.85 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/21/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz pid=771445
django50: commands[0]> .tox/django50/bin/python -Wa -b -m django test --settings tests.settings
Found 94 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..............................................................................................
----------------------------------------------------------------------
Ran 94 tests in 0.957s

OK
Destroying test database for alias 'default'...
django50: exit 0 (1.26 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/django50/bin/python -Wa -b -m django test --settings tests.settings pid=771468
django50: commands[1]> .tox/django50/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py'
.
----------------------------------------------------------------------
Ran 1 test in 0.107s

OK
django50: exit 0 (0.18 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/django50/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py' pid=771619
django50: OK ✔ in 3.3 seconds
django51: find interpreter for spec PythonSpec(path=/usr/bin/python3)
django51: proposed PythonInfo(spec=CPython3.13.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]', encoding_fs_io=utf-8-utf-8)
django51: install_package> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/22/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz
django51: exit 0 (1.86 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/22/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz pid=771623
django51: commands[0]> .tox/django51/bin/python -Wa -b -m django test --settings tests.settings
Found 94 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..............................................................................................
----------------------------------------------------------------------
Ran 94 tests in 1.044s

OK
Destroying test database for alias 'default'...
django51: exit 0 (1.33 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/django51/bin/python -Wa -b -m django test --settings tests.settings pid=771647
django51: commands[1]> .tox/django51/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py'
.
----------------------------------------------------------------------
Ran 1 test in 0.093s

OK
django51: exit 0 (0.16 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/django51/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py' pid=771774
django51: OK ✔ in 3.36 seconds
djangomain: find interpreter for spec PythonSpec(path=/usr/bin/python3)
djangomain: proposed PythonInfo(spec=CPython3.13.2.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)]', encoding_fs_io=utf-8-utf-8)
djangomain: install_package> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/23/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz
djangomain: exit 0 (1.94 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> python -I -m pip install --force-reinstall --no-deps /home/gk/tmp/python-django-auth-ldap/django-auth-ldap/.tox/.tmp/package/23/django_auth_ldap-5.1.1.dev1+g16ea6fd.tar.gz pid=771778
djangomain: commands[0]> .tox/djangomain/bin/python -Wa -b -m django test --settings tests.settings
Found 94 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..............................................................................................
----------------------------------------------------------------------
Ran 94 tests in 1.097s

OK
Destroying test database for alias 'default'...
djangomain: exit 0 (1.42 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/djangomain/bin/python -Wa -b -m django test --settings tests.settings pid=771801
djangomain: commands[1]> .tox/djangomain/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py'
.
----------------------------------------------------------------------
Ran 1 test in 0.094s

OK
djangomain: exit 0 (0.16 seconds) /home/gk/tmp/python-django-auth-ldap/django-auth-ldap> .tox/djangomain/bin/python -Wa -b -m unittest discover --pattern '*_test_without_django.py' pid=771927
  ruff: OK (0.04=setup[0.03]+cmd[0.01] seconds)
  docs: OK (2.80=setup[2.38]+cmd[0.43] seconds)
  django42: OK (3.55=setup[2.08]+cmd[1.33,0.15] seconds)
  django50: OK (3.30=setup[1.85]+cmd[1.26,0.18] seconds)
  django51: OK (3.36=setup[1.87]+cmd[1.33,0.16] seconds)
  djangomain: OK (3.53=setup[1.95]+cmd[1.42,0.16] seconds)
  congratulations :) (16.62 seconds)
$
```

Comment 9 gk 2025-03-17 19:46:49 UTC
Found the reason why the test fails.

The unix daemon socket path created by the build system is longer than the allowed 108 characters (https://www.man7.org/linux/man-pages/man7/unix.7.html)

```
67d850b7.07396695 0x7f47bebec980 daemon: domain socket path (/builddir/build/BUILD/python-django-auth-ldap-5.1.0-build/django-auth-ldap-5.1.0/python-ldap-test-38535/ldapi) too long in URLE
```

which is from the OpenLDAP server code:

https://github.com/winlibs/openldap/blob/master/servers/slapd/daemon.c#L1152C1-L1165C8

We need to get slapdtest to use another socket path. Its code does this:

```
    TMPDIR = os.environ.get('TMP', os.getcwd())
```

So we need to set TMP before calling tox, this fixes it:

```
$ cat tox_set_tmp_env.patch
--- a/tox.ini
+++ b/tox.ini
@@ -25,6 +25,8 @@
     django50: Django>=5.0,<5.1
     django51: Django>=5.1b1,<5.2
     djangomain: https://github.com/django/django/archive/main.tar.gz
+setenv:
+    TMP=/tmp

 [testenv:ruff]
 deps = ruff
(sysctl_f41)$

$ git diff
diff --git a/python-django-auth-ldap.spec b/python-django-auth-ldap.spec
index c2b0e72..37f8018 100644
--- a/python-django-auth-ldap.spec
+++ b/python-django-auth-ldap.spec
@@ -8,13 +8,14 @@
 %global srcname django-auth-ldap

 Name:           python-%{srcname}
-Version:        4.1.0
-Release:        8%{?dist}
+Version:        5.1.0
+Release:        1%{?dist}
 Summary:        Django LDAP authentication backend

 License:        BSD
 URL:            https://pypi.org/project/django-auth-ldap
 Source:         %{pypi_source}
+Patch0:         tox_set_tmp_env.patch

 BuildArch:      noarch
```