Qtodotxt+PyQt5在Fedora40/41中核心转储问题排查
问题描述
在Fedora 40和41的多台设备上,执行test.sh脚本会触发核心转储。相关脚本、依赖及执行输出如下:
test.sh脚本(注意会删除./tmp目录及pip缓存)
cat /etc/os-release python --version which python md5sum $(which python) rm -rf ./tmp mkdir -p ./tmp cd ./tmp mkdir -p venv python -m venv venv . ./venv/bin/activate pip cache purge pip install -r ../piplibraries.txt qtodotxt
piplibraries.txt内容
PyQt5==5.15.11 PyQt5-Qt5==5.15.15 PyQt5_sip==12.15.0 python-dateutil==2.9.0.post0 qtodotxt==1.9.0 six==1.16.0
Fedora 41执行输出
stdout
NAME="Fedora Linux" VERSION="41 (Workstation Edition)" RELEASE_TYPE=stable ID=fedora VERSION_ID=41 VERSION_CODENAME="" PLATFORM_ID="platform:f41" PRETTY_NAME="Fedora Linux 41 (Workstation Edition)" ANSI_COLOR="0;38;2;60;110;180" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:41" DEFAULT_HOSTNAME="fedora" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f41/system-administrators-guide/" SUPPORT_URL="https://ask.fedoraproject.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=41 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=41 SUPPORT_END=2025-12-15 VARIANT="Workstation Edition" VARIANT_ID=workstation Python 3.13.0 /usr/bin/python b754f86375e105b86bb4392d88580ae1 /usr/bin/python Files removed: 46 Collecting PyQt5==5.15.11 (from -r ../piplibraries.txt (line 1)) Downloading PyQt5-5.15.11-cp38-abi3-manylinux_2_17_x86_64.whl.metadata (2.1 kB) Collecting PyQt5-Qt5==5.15.15 (from -r ../piplibraries.txt (line 2)) Downloading PyQt5_Qt5-5.15.15-py3-none-manylinux2014_x86_64.whl.metadata (536 bytes) Collecting PyQt5_sip==12.15.0 (from -r ../piplibraries.txt (line 3)) Downloading PyQt5_sip-12.15.0.tar.gz (104 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting python-dateutil==2.9.0.post0 (from -r ../piplibraries.txt (line 4)) Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB) Collecting qtodotxt==1.9.0 (from -r ../piplibraries.txt (line 5)) Downloading qtodotxt-1.9.0.tar.gz (278 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting six==1.16.0 (from -r ../piplibraries.txt (line 6)) Downloading six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB) Downloading PyQt5-5.15.11-cp38-abi3-manylinux_2_17_x86_64.whl (8.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.2/8.2 MB 2.0 MB/s eta 0:00:00 Downloading PyQt5_Qt5-5.15.15-py3-none-manylinux2014_x86_64.whl (59.8 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.8/59.8 MB 2.2 MB/s eta 0:00:00 Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB) Downloading six-1.16.0-py2.py3-none-any.whl (11 kB) Building wheels for collected packages: PyQt5_sip, qtodotxt Building wheel for PyQt5_sip (pyproject.toml): started Building wheel for PyQt5_sip (pyproject.toml): finished with status 'done' Created wheel for PyQt5_sip: filename=PyQt5_sip-12.15.0-cp313-cp313-linux_x86_64.whl size=83179 sha256=0a7fa349c5b7f375408571f6d161fcce222abd976d5124318089e7e26ee63596 Stored in directory: /home/odmi/.cache/pip/wheels/5b/f2/f6/93f2f74948dd23880023d3700802befd25cc8228408e85510a Building wheel for qtodotxt (pyproject.toml): started Building wheel for qtodotxt (pyproject.toml): finished with status 'done' Created wheel for qtodotxt: filename=qtodotxt-1.9.0-py3-none-any.whl size=293510 sha256=63d5bc8a7d2a36ea0c60fbf14ae5f06347ad794a866dd7fd7c598067afea5c15 Stored in directory: /home/odmi/.cache/pip/wheels/a4/49/eb/2c2d44093981564419bd54a992860ba93260007ae762433b45 Successfully built PyQt5_sip qtodotxt Installing collected packages: qtodotxt, PyQt5-Qt5, six, PyQt5_sip, python-dateutil, PyQt5 Successfully installed PyQt5-5.15.11 PyQt5-Qt5-5.15.15 PyQt5_sip-12.15.0 python-dateutil-2.9.0.post0 qtodotxt-1.9.0 six-1.16.0
stderr
[notice] A new release of pip is available: 24.2 -> 24.3.1 [notice] To update, run: pip install --upgrade pip Traceback (most recent call last): File "/home/odmi/projects/dev/testpyqt5/tmp/venv/lib64/python3.13/site-packages/qtodotxt/ui/views/tasks_search_view.py", line 41, in resizeEvent self.clearButton.move(self.rect().right() - frameWidth - sz.width(), ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (self.rect().bottom() + 1 - sz.height()) / 2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: arguments did not match any overloaded call: move(self, a0: QPoint): argument 1 has unexpected type 'int' move(self, ax: int, ay: int): argument 2 has unexpected type 'float' test.sh: line 15: 137507 Aborted (core dumped) qtodotxt
复现方式
使用toolbox容器复现:
toolbox create testqtodotxt --release=f40 toolbox run --container testqtodotxt sudo dnf install -y $(cat ${PWD}/systemlibraries.txt) toolbox run --container testqtodotxt sh ${PWD}/test.sh
systemlibraries.txt内容:
libglvnd-glx tk-devel xcb-util-wm xcb-util-image xcb-util-keysyms xcb-util-renderutil libxkbcommon-x11
尝试过替换tk-devel为python3-qt5-devel、移除tk-devel(出现Qt平台插件加载错误)、安装python3-pyside6,问题均未解决。补充:stderr显示核心转储,但未找到核心转储文件。
原因分析
- Python 3.13除法行为变化:Python 3.13中,整数除法
/返回float类型,而qtodotxt 1.9.0的代码直接将该结果传给QWidget.move()方法。move()要求第二个参数是整数,浮点数参数触发TypeError。 - 未捕获异常导致崩溃:Qt应用中未捕获的Python异常会直接终止程序并触发核心转储,这就是出现
Aborted (core dumped)的原因。 - 核心转储文件缺失:Fedora默认可能关闭了核心转储功能,或转储文件被限制在
/var/lib/systemd/coredump/等特定目录,需检查ulimit -c设置或systemd的coredump配置。
解决方法
方法一:修复qtodotxt代码中的除法问题
找到虚拟环境中qtodotxt/ui/views/tasks_search_view.py文件的第41行,将除法改为整数除法//:
self.clearButton.move( self.rect().right() - frameWidth - sz.width(), (self.rect().bottom() + 1 - sz.height()) // 2 )
修改后保存,重新运行qtodotxt即可。
方法二:使用兼容Python 3.13的qtodotxt版本
检查qtodotxt是否有更新版本,新版本通常会修复Python版本兼容性问题。修改piplibraries.txt中的版本号为最新兼容版,例如:
qtodotxt==1.10.0 # 假设该版本已修复问题
重新执行脚本安装即可。
方法三:切换到Python 3.12版本
在Fedora中安装Python 3.12,并用它创建虚拟环境:
sudo dnf install python3.12 python3.12 -m venv venv . ./venv/bin/activate
再执行后续的pip安装和qtodotxt启动命令。Python 3.12及更早版本中,整数间的/运算在结果为整数时会返回整数,不会触发该错误。
关于核心转储文件
若需要查看核心转储文件:
- 临时开启核心转储:执行
ulimit -c unlimited,重新运行脚本后,转储文件会生成在当前目录。 - 查看systemd管理的转储:用
coredumpctl list列出所有转储,coredumpctl info <pid>查看详细信息。
内容的提问来源于stack exchange,提问作者Olivier
相关产品推荐
相关产品推荐

