我的 Fedora 34 中的一个软件包出现问题,无法使用 rpmbuild --rebuild 从 Fedora 22 重新编译到 34,因为它给了我一个无法修复的错误。
eggsmclient-dbus-gnome.c: In function 'sm_client_gdbus_get_interface_info':
eggsmclient-dbus-gnome.c:80:25: error: format not a string literal and no format arguments [-Werror=format-security]
80 | g_warning(err->message);
| ^~~~~~~~~
eggsmclient-dbus-gnome.c: In function 'sm_client_dbus_gnome_end_session':
eggsmclient-dbus-gnome.c:123:17: error: format not a string literal and no format arguments [-Werror=format-security]
123 | g_warning(err->message);
| ^~~~~~~~~
eggsmclient-dbus-gnome.c: In function 'egg_sm_client_dbus_gnome_new':
eggsmclient-dbus-gnome.c:163:17: error: format not a string literal and no format arguments [-Werror=format-security]
163 | g_warning(err->message);
| ^~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [Makefile:601: libeggsmclient_la-eggsmclient-dbus-gnome.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/root/rpmbuild/BUILD/im-chooser-1.6.4/libimchooseui'
make[1]: *** [Makefile:417: all-recursive] Error 1
make[1]: Leaving directory '/root/rpmbuild/BUILD/im-chooser-1.6.4'
make: *** [Makefile:348: all] Error 2
答案1
g_warning
第一个参数是格式字符串,Fedora 34 中的构建要求这是一个常量格式字符串(以避免格式字符串漏洞);修补eggsmclient-dbus-gnome.c
,以便读取第 80、123 和 163 行
g_warning("%s", err->message);
您可能需要对其他调用应用相同的修复。