smartdns icon indicating copy to clipboard operation
smartdns copied to clipboard

optware/entware control 文件中的空值会导致部分版本的 opkg 出现 segmentation fault

Open hyx0329 opened this issue 3 years ago • 3 comments

问题现象
在我自行编译的 padavan 固件上配置好 entware 环境后,手动安装 smartdns 通过 github release 分发的 ipk 软件包,会导致 opkg 发生segmentation fault。经调试发现,control 文件中的空键值是可能的原因,推测是 opkg bug。相关问题 #146 #221。

运行环境

  1. 固件型号

自行编译的 padavan(3.4.3.9-099_KEKE),来自 https://github.com/keke1023/Padavan

ZTE-E8820:/opt/home/admin # uname -a
Linux ZTE-E8820 3.4.113 #9 SMP Wed Feb 9 10:49:51 UTC 2022 mips GNU/Linux
ZTE-E8820:/opt/etc/smartdns # opkg -v
opkg version 2edcfad1bb9a32f31199d5842aa087b4d30ec6f5 (2022-01-09)

opkg 采用 http://bin.entware.net/mipselsf-k3.4/installer/generic.sh 安装。

  1. smartdns来源以及版本

github release, smartdns.1.2022.04.05-2046.mipsel-optware-all.ipk

重现步骤

使用从 github release 下载的 ipk 安装包,在 entware 环境下的命令行手动安装:

ZTE-E8820:/opt/home/admin # opkg -V99 install smartdns.1.2022.04.05-2046.mipsel-optware-all.ipk
opkg_conf_parse_file: Loading conf file /opt/etc/opkg.conf.
opkg_conf_parse_file: Supported arch all priority (100)
opkg_conf_parse_file: Supported arch mipsel-3x priority (150)
opkg_conf_parse_file: Supported arch mipsel-3.4 priority (160)
opkg_install_cmd: smartdns.1.2022.04.05-2046.mipsel-optware-all.ipk
pkg_init_from_file: applying abpkg flag to smartdns.1.2022.04.05-2046.mipsel-optware-all.ipk
Segmentation fault

在修改 control 配置后重新安装:

ZTE-E8820:/opt/home/admin # opkg -V2 install test3-smartdns.ipk
opkg_conf_parse_file: Loading conf file /opt/etc/opkg.conf.
opkg_conf_parse_file: Supported arch all priority (100)
opkg_conf_parse_file: Supported arch mipsel-3x priority (150)
opkg_conf_parse_file: Supported arch mipsel-3.4 priority (160)
pkg_hash_load_feeds:
pkg_hash_load_feeds:
pkg_hash_load_feeds:
pkg_hash_load_feeds:
pkg_hash_load_status_files:
pkg_info_preinstall_check: Updating file owner list.
Installing smartdns (1.2022.04.05-2046) to root...
pkg_run_script: Running script /opt/tmp/opkg-X3S4Zw/smartdns-6fKhok/preinst.
opkg_install_pkg: Installing maintainer scripts.
opkg_install_pkg: Installing data files for smartdns.
install_data_files: Extracting data files to /.
pkg_write_filelist: Creating //opt/lib/opkg/info/smartdns.list file for pkg smartdns.
opkg_install_pkg: Resolving conf files for smartdns
opkg_configure_packages: Configuring unpacked packages.
opkg_configure_packages: Reordering packages before configuring them...
Configuring smartdns.
pkg_run_script: Running script //opt/lib/opkg/info/smartdns.postinst.
write_status_files_if_changed: Writing status file.
pkg_write_changed_filelists: Saving changed filelists.

control配置修改前后对比如下。

Package: smartdns						Package: smartdns
Architecture: all						Architecture: all
Priority: optional						Priority: optional
Section: net							Section: net
Version: 1.2022.04.05-2046					Version: 1.2022.04.05-2046
Maintainer: pymumu						Maintainer: pymumu
Source: http://127.0.0.1/					Source: http://127.0.0.1/
Description: A smart dns server					Description: A smart dns server
Suggests: 						      <
Conflicts: 						      <
Enabled: yes							Enabled: yes

修改 control 配置后安装 smartdns,一切正常,尚未发现任何问题。

hyx0329 avatar Jul 16 '22 16:07 hyx0329

空值引发崩溃是opkg0.18或更早版本的bug,可以看一下您的opkg版本?

PikuZheng avatar Jul 16 '22 16:07 PikuZheng

@PikuZheng 我的 opkg 版本如下

ZTE-E8820:/opt/etc/smartdns # opkg -v
opkg version 2edcfad1bb9a32f31199d5842aa087b4d30ec6f5 (2022-01-09)

该版本采用 http://bin.entware.net/mipselsf-k3.4/installer/generic.sh 此处脚本安装得到

hyx0329 avatar Jul 17 '22 00:07 hyx0329

smartdns.1.2022.07.17-1007.mipsel-optware-all.zip

删除了那两个配置。

pymumu avatar Jul 17 '22 02:07 pymumu

写了个脚本,清除配置中的空值重新打包。需要fakeroot、sed。 2022-09-27 更新了一下,发现之前的脚本版本不对漏掉了打包部分。 repack.txt

hyx0329 avatar Sep 02 '22 12:09 hyx0329