Package: crossfire-server
Version: 1.75.0-5+b2
Severity: important

Dear Maintainer,

It seems crossfire-server was compiled using the 
PyUnicode_EncodeRawUnicodeEscape workaround for Python 3.3 - 3.9 which is 
deprecated in Python 3.11.

On each start crossfire-server logs the following error message in 
/var/log/crossfire/logfile:
23/08/03 16:56:50 [II] plugins: loading cfanim.so
23/08/03 16:56:50 [II] plugins: loading cfcitybell.so
23/08/03 16:56:50 [II] plugins: loading cfpython.so
23/08/03 16:56:50 [EE] Error trying to load 
/usr/lib/x86_64-linux-gnu/crossfire/plugins/cfpython.so: 
/usr/lib/x86_64-linux-gnu/crossfire/plugins/cfpython.so: undefined symbol: 
PyUnicode_EncodeRawUnicodeEscape

Subsequently game functions that require a python script do not work. Instead 
errors are logged like:
[EE] The requested plugin doesn't exist: Python at 11/23 in map Old City
[EE] The requested plugin doesn't exist: Python at 5/34 in map world_105_115
[EE] The requested plugin doesn't exist: Python at 11/7 in map Starting House
[EE] The requested plugin doesn't exist: Python at 1/3 in map apartments

However, nm -gD cfpython.so | grep PyUnicode finds the symbol in 
/usr/lib/crossfire/plugins/cfpython.so:
                 U PyUnicode_AsUnicode
                 U PyUnicode_AsUTF8
                 U PyUnicode_AsUTF8String
                 U PyUnicode_DecodeUnicodeEscape
                 U PyUnicode_EncodeRawUnicodeEscape
                 U PyUnicode_FromString

but it is missing from libpython3.11.so (in Debian bookworm). It was still 
available in libpython3.9 in Debian buster.

I found this in the upstream source in plugins/cfpython/cjson.c :
if (PyUnicode_Check(string)) {
        // PyUnicode_EncodeRawUnicodeEscape() is deprecated as of Python 3.3, 
scheduled for removal in Python 3.11
#ifndef IS_PY3K3
        /* HACK: Workaround for crash bug in Python3's 
PyUnicode_AsRawUnicodeEscapeString... */
        str = PyUnicode_EncodeRawUnicodeEscape(PyUnicode_AS_UNICODE(string),
                                               PyUnicode_GET_SIZE(string));
#else
        // The Python docs recommend using PyUnicode_AsRawUnicodeEscapeString() 
or PyUnicode_AsEncodedString() over PyUnicode_EncodeRawUnicodeEscape().
        str = PyUnicode_AsRawUnicodeEscapeString(string);
#endif

So it seems IS_PY3K3 was #defined at compile time, even though it should not be 
for Python 3.11?

Kind regards

Oliver


-- System Information:
Debian Release: 12.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-10-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de_DE:de
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages crossfire-server depends on:
ii  bzip2                1.0.8-5+b1
ii  crossfire-common     1.75.0-5
ii  crossfire-maps       1.75.0+dfsg1-1
ii  init-system-helpers  1.65.2
ii  libc6                2.36-9+deb12u1
ii  libcrypt1            1:4.4.33-2
ii  libcurl3-gnutls      7.88.1-10+deb12u1
ii  libpython3.11        3.11.2-6
ii  python3              3.11.2-1+b1
ii  python3-bsddb3       6.2.9-2+b4

crossfire-server recommends no packages.

crossfire-server suggests no packages.

-- Configuration Files:
/etc/crossfire/dm_file changed [not included]

-- no debconf information

Reply via email to