From d5f6398da456b65f8cf332a45b7921079c62a3a7 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 22 Aug 2026 18:34:46 +0000 Subject: [PATCH] test suite: add workaround for Debian Trixie Python interpreter bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Debian Trixie Python interpreter (v3.13.5) crashes on exit after executing scripts that write signed transactions (`mmgen-txsign` and `mmgen-txsend`) for certain tests in the test suite. This bug is unlikely to be observed under normal usage and in any case won’t prevent users from signing and sending transactions. Nonetheless, users running Debian Trixie may wish to compile Python from source just to be safe and use the locally compiled Python to run MMGen Wallet. For instructions on how to do this, see the ‘Build Python from Source’ wiki page. --- mmgen/util.py | 5 +++++ test/cmdtest_d/base.py | 8 ++++++-- test/cmdtest_d/main.py | 10 ++++++---- test/cmdtest_d/swap.py | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/mmgen/util.py b/mmgen/util.py index 72d8c971..138ec38d 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -480,6 +480,11 @@ def have_sudo(*, silent=False): except: return False +def distro_codename(): + if os.path.exists('/etc/os-release'): + with open('/etc/os-release') as fh: + return next(line for line in fh if line.startswith('VERSION_CODENAME=')).rstrip().split('=', 1)[1] + def in_nix_environment(): for path in os.getenv('PATH').split(':'): if path.startswith('/nix/store/'): diff --git a/test/cmdtest_d/base.py b/test/cmdtest_d/base.py index 1cec2938..f7248dee 100755 --- a/test/cmdtest_d/base.py +++ b/test/cmdtest_d/base.py @@ -20,10 +20,10 @@ test.cmdtest_d.base: Base class for the cmdtest.py test suite """ -import os +import sys, os from mmgen.cfg import gc -from mmgen.util import msg +from mmgen.util import msg, distro_codename from mmgen.color import gray, purple, yellow from ..include.common import write_to_file, read_from_file, imsg @@ -68,6 +68,10 @@ class CmdTestBase: self.spawn_env['MMGEN_TEST_SUITE_ENABLE_COLOR'] = '1' if self.color else '' else: self.spawn_env = {} # placeholder + self.has_segfault_on_exit_bug = ( + self.coin in ('btc', 'bch') + and distro_codename() == 'trixie' + and sys.version_info[:2] == (3, 13)) def get_altcoin_pfx(self, coin, cashaddr=True): coin = coin.lower() diff --git a/test/cmdtest_d/main.py b/test/cmdtest_d/main.py index 8c9820fa..adc5a84d 100755 --- a/test/cmdtest_d/main.py +++ b/test/cmdtest_d/main.py @@ -776,7 +776,8 @@ class CmdTestMain(CmdTestBase, CmdTestShared): add_output_args = ['hexdata:' + 'ee' * self.proto.max_op_return_data_len]) def txsign1(self, *args, **kwargs): - return self.txsign(*args, **kwargs) + t = self.txsign(*args, **kwargs) + return 'ok' if self.has_segfault_on_exit_bug else t def txbump1(self, txfile, prepend_args=[], seed_args=[]): if not self.proto.cap('rbf'): @@ -815,7 +816,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): def txsend1(self, sigfile, extra_opts=[]): t = self.spawn('mmgen-txsend', extra_opts + ['-d', self.tmpdir, sigfile], no_passthru_opts=['coin']) self.txsend_ui_common(t, view='t', add_comment='') - return t + return 'ok' if self.has_segfault_on_exit_bug else t def txdo1(self, addrfile, wallet): t = self.txcreate_common(sources=['1'], ss_args=[wallet]) @@ -974,7 +975,7 @@ class CmdTestMain(CmdTestBase, CmdTestShared): t.view_tx('n') t.passphrase(wcls.desc, self.cfgs[cnum]['wpasswd']) self.txsign_end(t, cnum) - return t + return 'ok' if self.has_segfault_on_exit_bug else t # this segfaults only with --bech32 def export_mnemonic2(self, wf): return self.export_mnemonic(wf) @@ -1128,4 +1129,5 @@ class CmdTestMain(CmdTestBase, CmdTestShared): tweaks = ['confirm_non_mmgen']) def txsign6(self, wf, txf): - return self.txsign5(wf, txf, bad_vsize=False, add_opts=['--vsize-adj=1.08']) + t = self.txsign5(wf, txf, bad_vsize=False, add_opts=['--vsize-adj=1.08']) + return 'ok' if self.has_segfault_on_exit_bug else t diff --git a/test/cmdtest_d/swap.py b/test/cmdtest_d/swap.py index 11bf80ae..8fe280a8 100755 --- a/test/cmdtest_d/swap.py +++ b/test/cmdtest_d/swap.py @@ -526,7 +526,8 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded): return self._data_tx_sign() def data_tx1_send(self): - return self._data_tx_send() + t = self._data_tx_send() + return 'ok' if self.has_segfault_on_exit_bug else t def data_tx1_chk(self): return self._data_tx_chk(sample1.encode().hex())