Bug#1123946: python-librt: Bus error on sparc64 due to unaligned access in _write_short_int

Gregor Riepl <[email protected]> Wed, 24 Dec 2025 16:02:28 +0100
Newsgroups gmane.linux.debian.ports.sparc
Message-ID <176658854827.6427.1476292827384677807.reportbug__41030.0712844887$1766588728$gmane$org@himawari>
Source: python-librt
Version: 0.7.3-1
Severity: normal
Tags: ftbfs,upstream
Forwarded: https://github.com/mypyc/librt/issues/26
X-Debbugs-Cc: [email protected], [email protected]
User: [email protected]
Usertags: sparc64

Dear Maintainer,

python-librt currently fails to build on sparc64, because there is a memory alignment issue in _write_short_int.

The issue was already present in previous versions, so it's also causing build errors in other packages that rely on librt (notably: mypy[2]).
I tested 0.6.2, which is currently available for sparc64, but the build logs suggest that the issue was present since at least 0.3.0-1 [1].

A possible fix could be to replace the two macros _READ and _WRITE in librt_internal.c with a call to memcpy, which takes alignment into account.
Under normal conditions, it also wouldn't cause any overhead, because the compiler will optimize the function all away and replace it with direct load/store instructions.

[1] https://buildd.debian.org/status/logs.php?pkg=python-librt&arch=sparc64
[2] https://buildd.debian.org/status/package.php?p=mypy&suite=sid#problem-3


-- System Information:
Debian Release: forky/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: sparc64

Kernel: Linux 6.17.11+deb14-sparc64 (UP)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled