2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-05 20:47:57 +00:00

Run on a Python that has no crypt module

crypt left the standard library in 3.13 and both imports of it here are
unconditional, so the server does not start on a 3.13 distro that ships no
crypt shim of its own.

legacycrypt and crypt_r both reach the same libcrypt call, tried in that
order because legacycrypt is pure ctypes while crypt_r wants a compiler.
Both were checked byte for byte against the stdlib for the $6$ salts used
here, and a hash written under the stdlib verifies under either, so stored
crypted.* attributes keep working.

Recommends rather than Requires, and only above 3.12: el9 and el10 still
ship the stdlib module, and some 3.13 distros package no candidate at all,
where a hard dependency would make the rpm uninstallable.
This commit is contained in:
Markus Hilger
2026-09-01 05:21:59 +02:00
parent 7ba1798848
commit 0d2b23de2f
3 changed files with 24 additions and 2 deletions
@@ -69,7 +69,15 @@ import confluent.netutil as netutil
import confluent.exceptions as exc
import confluent.log
import copy
import crypt
try:
import crypt
except ImportError:
# crypt left the stdlib in 3.13. Both of these reach the same libcrypt
# call and give the same hash; distros package one, the other, or neither.
try:
import legacycrypt as crypt
except ImportError:
import crypt_r as crypt
try:
import cPickle
except ModuleNotFoundError:
+9 -1
View File
@@ -15,7 +15,15 @@ import confluent.discovery.core as disco
import base64
import hmac
import hashlib
import crypt
try:
import crypt
except ImportError:
# crypt left the stdlib in 3.13. Both of these reach the same libcrypt
# call and give the same hash; distros package one, the other, or neither.
try:
import legacycrypt as crypt
except ImportError:
import crypt_r as crypt
import json
import os
import tempfile
@@ -17,6 +17,12 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Requires: confluent_vtbufferd
%if 0%{?python3_version_nodots} >= 313
# 3.13 removed crypt from the stdlib, and stored credentials are hashed with
# it. Recommends rather than Requires: some 3.13 distros package no candidate
# at all, where a hard dependency would make the rpm uninstallable.
Recommends: python3-legacycrypt
%endif
%if "%{dist}" == ".el9"
Requires: python3-asyncssh, python3-cryptography, confluent_client == %{version}, python3-pyparsing, python3-webauthn, python3-netifaces, python3-pyasn1 >= 0.2.3, python3-pysnmp >= 4.3.4, python3-lxml, python3-eficompressor, python3-setuptools, python3-dateutil, python3-cffi, python3-pyOpenSSL python3-msgpack python3-libarchive-c python3-yaml python3-yarl python3-aiohttp openssl iproute
%else