Debian Patches

Status for ceph/18.2.4+ds-13

Patch Description Author Forwarded Bugs Origin Last update
0001-enable-strsignal.patch This defines HAVE_REENTRANT_STRSIGNAL as sys_siglist no longer exists with glibc 2.32 and all programs should use strsignal instead.

diff -Naurp ceph.orig/CMakeLists.txt ceph/CMakeLists.txt
James Page <james.page@ubuntu.com> no
0002-update-java-source-target-flags.patch use --release 7 instead of -source/-target (Closes: LP:1756854, LP: 1766998) Instead of -source/-target ceph should be build with --release for OpenJDK 9
or later so that the bootclasspath is also set, as per JEP-247, otherwise it
risks incurring into binary incompatibility when run with an earlier OpenJDK.
.
OpenJDK 21 minimum compatibility release has been updated to 8.

diff -Naurp ceph.orig/src/java/CMakeLists.txt ceph/src/java/CMakeLists.txt
Tiago Stürmer Daitx <tiago.daitx@ubuntu.com> no
0003-disable-crypto.patch Using qat/isal optimizations on amd64 architecture only.
diff -Naurp ceph.orig/src/os/CMakeLists.txt ceph/src/os/CMakeLists.txt
James Page <james.page@ubuntu.com> no
0004-civetweb-755-1.8-somaxconn-configurable_conf.patch Adds max_connections to reference configuration. Jesse Williamson <jesse.williamson@canonical.com> yes upstream upstream, https://github.com/civetweb/civetweb/pull/776/commits/3b8eb36676f70d06f8918ccf62029207c49cdda0
0005-civetweb-755-1.8-somaxconn-configurable.patch Makes SOMAXCONN user-configurable. Jesse Williamson <jesse.williamson@canonical.com> yes upstream upstream, https://github.com/civetweb/civetweb/pull/776/commits/febab7dc38c9671577603425c54c20f841e27f97
0006-civetweb-755-1.8-somaxconn-configurable_test.patch Adds max_connections to test display. Jesse Williamson <jesse.williamson@canonical.com> yes upstream upstream, https://github.com/civetweb/civetweb/pull/776/commits/3b8eb36676f70d06f8918ccf62029207c49cdda0
0007-debian-armel-armhf-buildflags.patch =================================================================== no
0008-fix-bash-completion-location.patch no
0009-32bit-fixes.patch Misc fixes for 32 bit architecture builds.
===================================================================
James Page <james.page@ubuntu.com> no
0010-add-option-to-disable-ceph-dencoder.patch =================================================================== no
0011-riscv64-link-pthread.patch Link with -pthread instead of -lpthread to fix FTBFS on riscv64
===================================================================
no 2020-03-01
0012-fix-ceph-osd-systemd-target.patch Fix systemd ceph-osd.target This helps when rebooting.

===================================================================
Thomas Goirand <zigo@debian.org> no 2021-01-28
0013-fix-CheckCxxAtomic-riscv64.patch Fix CheckCxxAtomic to detect more accurately Some platforms like riscv64 does not have full support for atomic primitives,
yet passes the test. Adding operator++ fixes this issue.
===================================================================
Eric Long <i@hack3r.moe> no 2022-08-30
0014-try-fix-fmt-call.patch Try fix fmt call Otherwise, FTBFS.

===================================================================
Thomas Goirand <zigo@debian.org> no 2023-09-22
0015-add-mips-support-to-toku-time.patch Add mips support to toku_time.h Thomas Goirand <zigo@debian.org> no 2023-10-04
0016-build-Bump-boost-to-1.82.patch build: Bump boost to 1.82
Needed to fix coroutine detection under Clang
"Adam C. Emerson" <aemerson@redhat.com> no 2023-05-15
0017-cmake-fix-Finduring.cmake.patch cmake: fix Finduring.cmake
liburing-devel package provides `/usr/lib64/liburing.so`. without this
fix, `find_package(uring)` failed with this `CMAKE_FIND_DEBUG_MODE`
output:
```
find_library considered the following locations:

/home/cbodley/ceph/build/virtualenv/bin//(lib)liburing.a(\.so|\.a)
/home/cbodley/ceph/build/virtualenv/bin/(lib)liburing.a(\.so|\.a)
/usr/local/bin//(lib)liburing.a(\.so|\.a)
/usr/local/bin/(lib)liburing.a(\.so|\.a)
/usr/local/sbin//(lib)liburing.a(\.so|\.a)
/usr/local/sbin/(lib)liburing.a(\.so|\.a)
/usr/bin//(lib)liburing.a(\.so|\.a)
/usr/bin/(lib)liburing.a(\.so|\.a)
/usr/sbin//(lib)liburing.a(\.so|\.a)
/usr/sbin/(lib)liburing.a(\.so|\.a)
/usr/local/lib64//(lib)liburing.a(\.so|\.a)
/usr/local/lib64/(lib)liburing.a(\.so|\.a)
/usr/local/lib//(lib)liburing.a(\.so|\.a)
/usr/local/lib/(lib)liburing.a(\.so|\.a)
/usr/local//(lib)liburing.a(\.so|\.a)
/usr/local/(lib)liburing.a(\.so|\.a)
/usr/lib64//(lib)liburing.a(\.so|\.a)
/usr/lib64/(lib)liburing.a(\.so|\.a)
/usr/lib//(lib)liburing.a(\.so|\.a)
/usr/lib/(lib)liburing.a(\.so|\.a)
/usr//(lib)liburing.a(\.so|\.a)
/usr/(lib)liburing.a(\.so|\.a)
/lib64//(lib)liburing.a(\.so|\.a)
/lib64/(lib)liburing.a(\.so|\.a)
/lib//(lib)liburing.a(\.so|\.a)
/lib/(lib)liburing.a(\.so|\.a)
/opt//(lib)liburing.a(\.so|\.a)
/opt/(lib)liburing.a(\.so|\.a)
/usr/lib64/X11//(lib)liburing.a(\.so|\.a)
/usr/lib64/X11/(lib)liburing.a(\.so|\.a)
```
Casey Bodley <cbodley@redhat.com> no 2023-03-31
0018-cmake-populate-liburing-include-and-library-paths-do.patch cmake: populate liburing include and library paths down to rocksdb external project

There are two problems:

1) The librocksdb does not use the built liburing if present.
2) You cannot turn off rocksdb's use of liburing with WITH_LIBURING=OFF.

This is to fix errors like:

FAILED: bin/ceph_test_keyvaluedb_iterators
: && /opt/rh/gcc-toolset-11/root/usr/bin/g++ -Og -g -rdynamic -pie src/test/ObjectMap/CMakeFiles/ceph_test_keyvaluedb_iterators.dir/test_keyvaluedb_iterators.cc.o src/test/ObjectMap/CMakeFiles/ceph_test_keyvaluedb_iterators.dir/KeyValueDBMemory.cc.o -o bin/ceph_test_keyvaluedb_iterators -Wl,-rpath,/home/pdonnell/scratch/build/lib lib/libos.a lib/libgmock_maind.a lib/libgmockd. a lib/libgtestd.a -lpthread -ldl lib/libglobal.a -ldl /usr/lib64/librt.so -lresolv -ldl lib/libblk.a /lib64/libaio.so src/liburing/src/liburing.a lib/libkv.a lib/libheap_profiler.a /lib64/libtcmalloc.so src/rocksdb/librocksdb.a /lib64/libsnappy.so /usr/lib64/liblz4.so /usr/lib64/libz.so /usr/lib64/libfuse.so lib/libceph-common.so.2 src/opentelemetry-cpp/sdk/src/trace/libopentelemetry_trace.a src/opentelemetry-cpp/sdk/src/resource/libopentelemetry_resources.a src/opentelemetry-cpp/sdk/src/common/libopentelemetry_common.a src/opentelemetry-cpp/exporters/jaeger/libopentelemetry_exporter_jaeger_trace.a src/opentelemetry-cpp/ext/src/http/client/curl/libopentelemetry_http_client_curl.a /usr/lib64/libcurl.so /usr/lib64/libthrift.so lib/libjson_spirit.a lib/libcommon_utf8.a lib/liberasure_code.a lib/libextblkdev.a -lcap boost/lib/libboost_thread.a boost/lib/libboost_chrono.a boost/lib/libboost_atomic.a boost/lib/libboost_system.a boost/lib/libboost_random.a boost/lib/libboost_program_options.a boost/lib/libboost_date_time.a boost/lib/libboost_iostreams.a boost/lib/libboost_regex.a lib/libfmtd.a /usr/lib64/libblkid.so -lpthread /usr/lib64/libcrypto.so /usr/lib64/libudev.so /usr/lib64/libz.so -ldl -lresolv -Wl,--as-needed -latomic && :
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(fs_posix.cc.o): in function `io_uring_wait_cqe_nr':
/home/pdonnell/scratch/build/src/liburing/src/include/liburing.h:494: undefined reference to `__io_uring_get_cqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(fs_posix.cc.o): in function `rocksdb::(anonymous namespace)::PosixFileSystem::AbortIO(std::vector<void*, std::allocator<void*> >&)':
/home/pdonnell/ceph/src/rocksdb/env/fs_posix.cc:1125: undefined reference to `io_uring_get_sqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /home/pdonnell/ceph/src/rocksdb/env/fs_posix.cc:1134: undefined reference to `io_uring_submit'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(fs_posix.cc.o): in function `rocksdb::CreateIOUring()':
/home/pdonnell/ceph/src/rocksdb/env/io_posix.h:272: undefined reference to `io_uring_queue_init'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(io_posix.cc.o): in function `io_uring_wait_cqe_nr':
/home/pdonnell/scratch/build/src/liburing/src/include/liburing.h:494: undefined reference to `__io_uring_get_cqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(io_posix.cc.o): in function `rocksdb::PosixRandomAccessFile::MultiRead(rocksdb::FSReadRequest*, unsigned long, rocksdb::IOOptions const&, rocksdb::IODebugContext*)':
/home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:674: undefined reference to `io_uring_get_sqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:684: undefined reference to `io_uring_submit_and_wait'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: src/rocksdb/librocksdb.a(io_posix.cc.o): in function `rocksdb::PosixRandomAccessFile::ReadAsync(rocksdb::FSReadRequest&, rocksdb::IOOptions const&, std::function<void (rocksdb::FSReadRequest const&, void*)>, void*, void**, std::function<void (void*)>*, rocksdb::IODebugContext*)':
/home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:901: undefined reference to `io_uring_get_sqe'
/opt/rh/gcc-toolset-11/root/usr/bin/ld: /home/pdonnell/ceph/src/rocksdb/env/io_posix.cc:910: undefined reference to `io_uring_submit'
collect2: error: ld returned 1 exit status

(cherry picked from commit 8addb3598701410002688ce8ca8bdfcde2026ece)
Patrick Donnelly <pdonnell@redhat.com> no 2023-10-16
0019-cmake-promote-uring-package-search-to-top-level.patch cmake: promote uring package search to top-level
For use by multiple projects, rocksdb in particular.

(cherry picked from commit 3438de58f2af599901a19cf984e2e7cb1e9f6944)
Patrick Donnelly <pdonnell@redhat.com> no 2023-10-17
0020-cmake-rocksdb-make-sure-dependencies-build-before-ro.patch cmake/rocksdb: make sure dependencies build before rocksdb
some of rocksdb's dependencies may not have built by the time its
ExternalProject starts, so it can fail with missing headers or
libraries. for example, `uring::uring` may itself be an ExternalProject,
and its include directory won't exist until it starts building:

```
[89/1345] Performing configure step for 'rocksdb_ext'
...
CMake Error in CMakeLists.txt:
Imported target "uring::uring" includes non-existent path

"build/src/liburing/src/include"

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

* The path was deleted, renamed, or moved to another location.

* An install or uninstall procedure did not complete successfully.

* The installation package was faulty and references files it does not
provide.
...
[91/1345] Performing download step (git clone) for 'liburing_ext'
Cloning into 'liburing'...
```

use `add_dependencies(rocksdb_ext)` to make sure all of its dependencies
are available before starting the build

(cherry picked from commit 353360581a0b802435ecf4273ba79f53deb710e6)
Casey Bodley <cbodley@redhat.com> no 2023-11-23
0021-remove-usage-of-distutils.patch Remove usage of distutils distutils is gone from Python 3.12, but there are replacements for all of
its API. This patch fixes the situation, as Debian is moving toward the
Python 3.12 interpreter.

===================================================================
Thomas Goirand <zigo@debian.org> no 2024-04-24
0022-fix-for-cmake-3.29.2.patch Fix for CMake 3.29.2
===================================================================
Thomas Goirand <zigo@debian.org> no 2024-04-25
0024-fix-ftbfs-with-gcc-14_1.patch [PATCH] tracing: Fix C type errors in librados tracing
This fixes type errors like this:

In file included from /usr/include/lttng/tracepoint-event.h:69,
from …-build/include/tracing/librados.h:4143,
from …/src/tracing/librados.c:6
:
…-build/include/tracing/librados.h:
In function ‘lttng_ust__event_probe__librados___rados_mon_command_exit’:
…-build/include/tracing/librados.h:477:9: error: initialization of ‘size_t’ {aka ‘long unsigned int’} from ‘size_t *’ {aka ‘long unsigned int *’} makes integer from pointer without a cast
477 | ceph_ctf_integerp(size_t, outslen, outslen)
| ^~~~~~~~~~~~~~~~~

GCC 14 will likely treat these type mismatches as an error
and fail the build.
Florian Weimer <fweimer@redhat.com> no 2023-12-20
0025-fix-ftbfs-with-gcc-14_2.patch [PATCH] pybind: Fix C type errors in Cython-generated Python bindings
Several Ceph APIs use bool * types, which correspond to
libcpp.bool * types in Cython. The bint type has an incorrect
size 4 and cannot be used as a replacement.

This prevents a compilation failure with future compilers:

…-build/src/pybind/rbd/rbd.c: In function ‘__pyx_pf_3rbd_3RBD_104namespace_exists’:
…-build/src/pybind/rbd/rbd.c:42165:76: error: passing argument 3 of ‘rbd_namespace_exists’ from incompatible pointer type
42165 | __pyx_v_ret = rbd_namespace_exists(__pyx_v__ioctx, __pyx_v__name, (&__pyx_v__exists));
| ~^~~~~~~~~~~~~~~~~
| |
| int *
In file included from …-build/src/pybind/rbd/rbd.c:1268:
…/src/include/rbd/librbd.h:1496:45: note: expected ‘_Bool *’ but argument is of type ‘int *’
1496 | bool *exists);
| ^
Florian Weimer <fweimer@redhat.com> no 2023-12-20
0026-fix-ftbfs-with-gcc-14_3.patch [PATCH] common/dout: fix FTBFS on GCC 14
The following problem has been reported by Kaleb Keithley:

```
/builddir/build/BUILD/ceph-18.2.1/src/osd/osd_types.h: In lambda function:
/builddir/build/BUILD/ceph-18.2.1/src/common/dout.h:184:73: error: call to non-‘constexpr’ function ‘virtual unsigned int DoutPrefixProvider::get_subsys() const’
184 | dout_impl(pdpp->get_cct(), ceph::dout::need_dynamic(pdpp->get_subsys()), v) \
| ~~~~~~~~~~~~~~~~^~
/builddir/build/BUILD/ceph-18.2.1/src/common/dout.h:155:58: note: in definition of macro ‘dout_impl’
155 | return (cctX->_conf->subsys.template should_gather<sub, v>()); \
| ^~~
/builddir/build/BUILD/ceph-18.2.1/src/osd/osd_types.h:3617:3: note: in expansion of macro ‘ldpp_dout’
3617 | ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl;
| ^~~~~~~~~
```

For details of the problem and the idea behind the fix,
please refer to the comment this commit brings to `dout.h`.

The minimized replicator that the facilitated Goldbot-based
investigation:

```cpp
namespace ceph::dout {

template<typename T>
struct dynamic_marker_t {
T value;
// constexpr ctor isn't needed as it's an aggregate type
constexpr operator T() const { return value; }
};

template<typename T>
constexpr dynamic_marker_t<T> need_dynamic(T&& t) {
return dynamic_marker_t<T>{ std::forward<T>(t) };
}

template<typename T>
struct is_dynamic : public std::false_type {};

template<typename T>
struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {};

} // ceph::dout

struct subsys_t {
template <unsigned SubV, int LvlV>
bool should_gather() const {
return true;
}
bool should_gather(const unsigned sub, int level) const {
return false;
}
};

static subsys_t subsys;

do { \
const bool should_gather = [&](const auto cctX) { \
if constexpr (ceph::dout::is_dynamic<decltype(sub)>::value || \
ceph::dout::is_dynamic<decltype(v)>::value) { \
std::cout << "the dynamic path" << std::endl; \
return subsys.should_gather(sub, v); \
} else { \
/* The parentheses are **essential** because commas in angle \
* brackets are NOT ignored on macro expansion! A language's \
* limitation, sorry. */ \
std::cout << "the static path" << std::endl; \
/*return subsys.should_gather(sub, v);*/ \
return (subsys.template should_gather<sub, v>()); \
} \
}(cct); \
} while (0)

if (decltype(auto) pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for 'this' */ \
dout_impl(42, sub, v)

if (decltype(auto) pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for 'this' */ \
dout_impl(42, ceph::dout::need_dynamic(42), v)

int main() {
std::random_device dev;
std::mt19937 rng(dev());
std::uniform_int_distribution<std::mt19937::result_type> dist6(1,6); // distribution in range [1, 6]

int sub = dist6(rng);
ldpp_dout("mocked out", sub);
//ldpp_subdout("mocked out", 4, 3);
}
```
Radoslaw Zarzynski <rzarzyns@redhat.com> no 2024-01-24
0027-udev-luks-on-rbd.patch udev rules for rbd to activate LUKS volumes (Closes: #1064970)
diff -Naurp ceph.orig/udev/50-rbd.rules ceph/udev/50-rbd.rules
Daniel Schreiber <daniel.schreiber@hrz.tu-chemnitz.de> no
0028-cephadm-do-not-write-logrotate.patch Avoid having cephadm writing its own logrotate copy of what is already in ceph-common (Closes: #1041092).
.
This is not ideal and needs proper fix later on because if cephadm is used
without ceph-common, no logrotate is in place. However, having cephadm
writing the file even worse, so with disabling it we're still better off.

diff -Naurp ceph.orig/src/cephadm/cephadm.py ceph/src/cephadm/cephadm.py
Daniel Baumann <daniel@debian.org> no
0029-fix-ftbfs-loongson64.patch Fixing FTBFS on loong64 (Closes: #1055047, #1069022).
diff -Naurp ceph.orig/src/rocksdb/CMakeLists.txt ceph/src/rocksdb/CMakeLists.txt
Dandan Zhang <zhangdandan@loongson.cn> no
0030-fix-ftbfs-with-fmt10.patch Fixing FTBFS with fmt10 (Closes: #1086564).
diff -Naurp ceph.orig/src/common/LogEntry.h ceph/src/common/LogEntry.h
Daniel Baumann <daniel@debian.org> no
0031-CVE-2024-48916.patch [PATCH] [CVE-2024-48916] rgw/sts: fix to disallow unsupported JWT algorithms while authenticating AssumeRoleWithWebIdentity using JWT obtained
from an external IDP.
Pritha Srivastava <prsrivas@redhat.com> no 2024-11-05
py313-compat/0001-mgr-stop-using-deprecated-API-to-initialize-Python.patch [PATCH 1/9] mgr: stop using deprecated API to initialize Python
Py_SetProgramName() is deprecated since CPython 3.11, see
https://docs.python.org/3/c-api/init_config.html .
`Py_InitializeFromConfig()` and friends were introduced by CPython 3.8,
but we still need to support CPython 3.6 which is shipped by CentOS8.
so we have to be backward compatible with the older Python versions.

so let's use new machinary to initialize the Python interpretor if the
tree is compiled with CPython 3.8 and up, i.e., PY_VERSION_HEX >= 0x03080000.
so that this piece of code can be tested on ubuntu:jammy, which ships
Python 3.10, see https://packages.ubuntu.com/jammy/amd64/python3

this change addresses following compiling warning:

```
[428/753] Building CXX object src/mgr/CMakeFiles/ceph-mgr.dir/PyModuleRegistry.cc.o
/var/ssd/ceph/src/mgr/PyModuleRegistry.cc: In member function ‘void PyModuleRegistry::init()’:
/var/ssd/ceph/src/mgr/PyModuleRegistry.cc:49:20: warning: ‘void Py_SetProgramName(const wchar_t*)’ is deprecated [-Wdeprecated-declarations]
49 | Py_SetProgramName(const_cast<wchar_t*>(WCHAR(MGR_PYTHON_EXECUTABLE)));
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.12/Python.h:94,
from /var/ssd/ceph/src/mgr/PyModule.h:22,
from /var/ssd/ceph/src/mgr/PyModuleRegistry.h:18,
from /var/ssd/ceph/src/mgr/PyModuleRegistry.cc:14:
/usr/include/python3.12/pylifecycle.h:37:38: note: declared here
37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
| ^~~~~~~~~~~~~~~~~`
```
Kefu Chai <tchaikov@gmail.com> no 2024-02-03
py313-compat/0002-mgr-set-argv-for-python-in-PyModuleRegistry.patch [PATCH 2/9] mgr: set argv for python in PyModuleRegistry
before this change, we setup the progname for Python interpreter,
but setup the argv for it in PyModule. and we are using deprecated
API to initialize Python interpreter.

in this change, let's do this in a single place for better
maintainability. also, take this opportunity, to use the non-deprecated
API to initialize interpreter on Python >= 3.8.

this silence the warning when compiling ceph-mgr with CPython 3.12:
```
/var/ssd/ceph/src/mgr/PyModule.cc: In member function ‘int PyModule::load(PyThreadState*)’:
/var/ssd/ceph/src/mgr/PyModule.cc:363:20: warning: ‘void PySys_SetArgv(int, wchar_t**)’ is deprecated [-Wdeprecated-declarations]
363 | PySys_SetArgv(1, (wchar_t**)argv);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.12/Python.h:96,
from /var/ssd/ceph/src/mgr/BaseMgrModule.h:4,
from /var/ssd/ceph/src/mgr/PyModule.cc:14:
/usr/include/python3.12/sysmodule.h:13:38: note: declared here
13 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
| ^~~~~~~~~~~~~
```
Kefu Chai <tchaikov@gmail.com> no 2024-02-03
py313-compat/0003-mgr-add-site-package-paths-in-PyModuleRegistry.patch [PATCH 3/9] mgr: add site package paths in PyModuleRegistry
before this change, we add the paths of site packages to sys.path
when starting subinterpretors for each of the mgr modules. this
works just fine. but in Python 3.11, it deprecates `PySys_SetPath()`
in favor of PyConfig machinary, which sets the module search paths
in PyConfig, before calling `Py_InitializeFromConfig()`. so, to
set the module search paths with the new machinary, we need to do
this in `PyModuleRegistry`, where we initialize the global Python
interpretor using the new PyConfig machinary. and since we've
switched to the new PyConfig machinary when compiling with Python 3.8
and up.

in this change, to unify the implementation of pre and post Python 3.8,
we set the module search paths in PyModuleRegistry. because PyConfig
imports the site packages by default, and we are allowed to append
a new path to the existing search paths, we just append the configured
`mgr_module_path` when compiling with Python 3.8 and up. and when it
comes to lower versions of Python, the existing behavior is preserved.

this change should silence the compiling warning like:

```
/var/ssd/ceph/src/mgr/PyModule.cc:368:20: warning: ‘void PySys_SetPath(const wchar_t*)’ is deprecated [-Wdeprecated-declarations]
368 | PySys_SetPath(const_cast<wchar_t*>(sys_path.c_str()));
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/python3.12/sysmodule.h:15:38: note: declared here
15 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
| ^~~~~~~~~~~~~
```
Kefu Chai <tchaikov@gmail.com> no 2024-02-03
py313-compat/0004-Revert-Merge-pull-request-55436-from-tchaikov-mgr-py.patch [PATCH 4/9] Revert "Merge pull request #55436 from tchaikov/mgr-python-3.12"

This reverts commit 8dffa8707dc665eb7ca6e2f48fa34e0fa8ac5b51, reversing
changes made to 80374da12bcc708d1fa306484842b3f97ac42acb.

This commit broke the import of the "mgr_module" module
within the python modules in the mgr at least on python 3.6.8
that we currently use in our centos 8 stream based containers

Failures would look like (removing beginning of log lines)

Loading python module 'alerts'
Module not found: 'mgr_module'
Class not found in module 'alerts'
Error loading module 'alerts': (22) Invalid argument
Adam King <adking@redhat.com> no 2024-04-02
py313-compat/0005-mgr-do-not-require-NOTIFY_TYPES-in-python-modules.patch [PATCH 5/9] mgr: do not require NOTIFY_TYPES in python modules
Many python mgr modules lack a NOTIFY_TYPES member apparently without
any downsides beyond an annoying message in the logs. This includes
commonly used mgr modules like 'volumes' and 'cephadm'. Stop emitting
an error for missing NOTIFY_TYPES by not assuming all mgr modules in
python should provide it. The return code is also changed to indicate
that this is not an error but the return from this function is never
checked and so it should have no impact. However, if someone started
using the return value in the future this would match the log change.
John Mulligan <jmulligan@redhat.com> no 2024-04-26
py313-compat/0006-mgr-allow-specifying-module-option-level.patch [PATCH 6/9] mgr: allow specifying module option level
Some are for development purposes and should be filtered out by the dashboard.
Patrick Donnelly <pdonnell@redhat.com> no 2024-04-19
py313-compat/0007-mgr-stop-using-deprecated-API-to-initialize-Python.patch [PATCH 7/9] mgr: stop using deprecated API to initialize Python
Py_SetProgramName() is deprecated since CPython 3.11, see
https://docs.python.org/3/c-api/init_config.html .
`Py_InitializeFromConfig()` and friends were introduced by CPython 3.8,
but we still need to support CPython 3.6 which is shipped by CentOS8.
so we have to be backward compatible with the older Python versions.

so let's use new machinary to initialize the Python interpretor, since
the minimal supported Python version is now CPython 3.9 which comes with
CentOS 9.

this change addresses following compiling warning:

```
[428/753] Building CXX object src/mgr/CMakeFiles/ceph-mgr.dir/PyModuleRegistry.cc.o
/var/ssd/ceph/src/mgr/PyModuleRegistry.cc: In member function ‘void PyModuleRegistry::init()’:
/var/ssd/ceph/src/mgr/PyModuleRegistry.cc:49:20: warning: ‘void Py_SetProgramName(const wchar_t*)’ is deprecated [-Wdeprecated-declarations]
49 | Py_SetProgramName(const_cast<wchar_t*>(WCHAR(MGR_PYTHON_EXECUTABLE)));
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.12/Python.h:94,
from /var/ssd/ceph/src/mgr/PyModule.h:22,
from /var/ssd/ceph/src/mgr/PyModuleRegistry.h:18,
from /var/ssd/ceph/src/mgr/PyModuleRegistry.cc:14:
/usr/include/python3.12/pylifecycle.h:37:38: note: declared here
37 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) Py_SetProgramName(const wchar_t *);
| ^~~~~~~~~~~~~~~~~`
```
Kefu Chai <tchaikov@gmail.com> no 2024-02-03
py313-compat/0008-mgr-set-argv-for-python-in-PyModuleRegistry.patch [PATCH 8/9] mgr: set argv for python in PyModuleRegistry
before this change, we setup the progname for Python interpreter,
but setup the argv for it in PyModule. and we are using deprecated
API to initialize Python interpreter.

in this change, let's do this in a single place for better
maintainability. also, take this opportunity, to use the non-deprecated
API to initialize interpreter on Python >= 3.8.

this silence the warning when compiling ceph-mgr with CPython 3.12:
```
/var/ssd/ceph/src/mgr/PyModule.cc: In member function ‘int PyModule::load(PyThreadState*)’:
/var/ssd/ceph/src/mgr/PyModule.cc:363:20: warning: ‘void PySys_SetArgv(int, wchar_t**)’ is deprecated [-Wdeprecated-declarations]
363 | PySys_SetArgv(1, (wchar_t**)argv);
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.12/Python.h:96,
from /var/ssd/ceph/src/mgr/BaseMgrModule.h:4,
from /var/ssd/ceph/src/mgr/PyModule.cc:14:
/usr/include/python3.12/sysmodule.h:13:38: note: declared here
13 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
| ^~~~~~~~~~~~~
```
Kefu Chai <tchaikov@gmail.com> no 2024-02-03
py313-compat/0009-mgr-add-site-package-paths-in-PyModuleRegistry.patch [PATCH 9/9] mgr: add site package paths in PyModuleRegistry
before this change, we add the paths of site packages to sys.path
when starting subinterpretors for each of the mgr modules. this
works just fine. but in Python 3.11, it deprecates `PySys_SetPath()`
in favor of PyConfig machinary, which sets the module search paths
in PyConfig, before calling `Py_InitializeFromConfig()`. so, to
set the module search paths with the new machinary, we need to do
this in `PyModuleRegistry`, where we initialize the global Python
interpretor using the new PyConfig machinary. and since we've
switched to the new PyConfig machinary when compiling with Python 3.8
and up.

in this change, we set the module search paths in PyModuleRegistry.
because PyConfig imports the site packages by default, and we are
allowed to append a new path to the existing search paths, we just
append the configured `mgr_module_path`.

this change should silence the compiling warning like:

```
/var/ssd/ceph/src/mgr/PyModule.cc:368:20: warning: ‘void PySys_SetPath(const wchar_t*)’ is deprecated [-Wdeprecated-declarations]
368 | PySys_SetPath(const_cast<wchar_t*>(sys_path.c_str()));
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/python3.12/sysmodule.h:15:38: note: declared here
15 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
| ^~~~~~~~~~~~~
```

Fixes https://tracker.ceph.com/issues/66399
Kefu Chai <tchaikov@gmail.com> no 2024-02-03

All known versions for source package 'ceph'

Links