From 4e44f0ffefd7ff9a2154de4130a48843d31961ce Mon Sep 17 00:00:00 2001 From: wenyuzifang Date: Tue, 28 Oct 2025 18:10:09 +0800 Subject: [PATCH] Update code from upstream --- ...ixed-missed-include-stdlib.h-see-305.patch | 26 +++++++++++++++ ...-recent-versions-of-libxml2-fixes-30.patch | 33 +++++++++++++++++++ sane-airscan.spec | 13 ++++++-- 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 0001-Fixed-missed-include-stdlib.h-see-305.patch create mode 100644 0002-Fixed-build-with-recent-versions-of-libxml2-fixes-30.patch diff --git a/0001-Fixed-missed-include-stdlib.h-see-305.patch b/0001-Fixed-missed-include-stdlib.h-see-305.patch new file mode 100644 index 0000000..af82992 --- /dev/null +++ b/0001-Fixed-missed-include-stdlib.h-see-305.patch @@ -0,0 +1,26 @@ +From c042a6895fe6f663d4bcb8c27d1c7b34fbd68b48 Mon Sep 17 00:00:00 2001 +From: Alexander Pevzner +Date: Sat, 2 Dec 2023 21:49:40 +0300 +Subject: [PATCH 1/2] Fixed missed #include (see #305) + +This code used to compile on everywhere, but explicit #include +was actually missed. Seems that sometimes it can cause problems. +--- + airscan-xml.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/airscan-xml.c b/airscan-xml.c +index f376f31..5071ca9 100644 +--- a/airscan-xml.c ++++ b/airscan-xml.c +@@ -9,6 +9,7 @@ + #include "airscan.h" + + #include ++#include + + #include + #include +-- +2.43.0 + diff --git a/0002-Fixed-build-with-recent-versions-of-libxml2-fixes-30.patch b/0002-Fixed-build-with-recent-versions-of-libxml2-fixes-30.patch new file mode 100644 index 0000000..74681a7 --- /dev/null +++ b/0002-Fixed-build-with-recent-versions-of-libxml2-fixes-30.patch @@ -0,0 +1,33 @@ +From 144e7d4187c73566ffc2780ac91ab7e1826826e0 Mon Sep 17 00:00:00 2001 +From: Alexander Pevzner +Date: Sat, 2 Dec 2023 22:29:55 +0300 +Subject: [PATCH 2/2] Fixed build with recent versions of libxml2 (fixes #305) + +libxml2 recently changed a prototype of the xmlStructuredErrorFunc callback, +adding const modifier to the second parameter. + +Adding an explicit cast seems to fix the problem (but I will not be surprised, if +this fix will not work equally well on all distros). + +Found for a first time and fixed on Arch linux on about 2 Dec 2023 (Arch is rolling +release, so there is no explicit release number) +--- + airscan-xml.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/airscan-xml.c b/airscan-xml.c +index 5071ca9..10f290c 100644 +--- a/airscan-xml.c ++++ b/airscan-xml.c +@@ -124,7 +124,7 @@ xml_rd_parse (xmlDoc **doc, const char *xml_text, size_t xml_len) + goto DONE; + } + +- ctxt->sax->serror = xml_rd_error_callback; ++ ctxt->sax->serror = (xmlStructuredErrorFunc) xml_rd_error_callback; + + /* Parse the document */ + if (xmlCtxtResetPush(ctxt, xml_text, xml_len, NULL, NULL)) { +-- +2.43.0 + diff --git a/sane-airscan.spec b/sane-airscan.spec index 1e36aee..692ee63 100644 --- a/sane-airscan.spec +++ b/sane-airscan.spec @@ -1,17 +1,19 @@ -%define anolis_release 1 +%define anolis_release 2 # the package gets input from scanner devices from network # can be possibly dangerous if an attacker camouflages himself # as a scanner %global _hardened_build 1 Name: sane-airscan -Version: 0.99.27 +Version: 0.99.27 Release: %{anolis_release}%{dist} Summary: SANE backend for AirScan (eSCL) and WSD document scanners # the exception is defined in LICENSE, meant for SANE project in most cases License: GPLv2+ with exceptions URL: https://github.com/alexpevzner/sane-airscan -Source: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz +Source0: https://github.com/alexpevzner/sane-airscan/archive/0.99.27/sane-airscan-0.99.27.tar.gz +Patch1: 0002-Fixed-build-with-recent-versions-of-libxml2-fixes-30.patch +Patch2: 0001-Fixed-missed-include-stdlib.h-see-305.patch # backported from upstream @@ -34,6 +36,8 @@ BuildRequires: pkgconf-pkg-config # package is meant to be as one of SANE backends - it uses SANE API for handling # devices, strings, words (bytes) and backend itself BuildRequires: sane-backends-devel +BuildRequires: gcc-c++ +BuildRequires: meson # needs shared library implementing the backend Requires: libsane-airscan = %{version}-%{release} @@ -108,5 +112,8 @@ mkdir -p %{buildroot}/ %doc README.md %changelog +* Tue Oct 28 2025 wenyuzifang - 0.99.27-2 +- Fix compilation errors with recent libxml2 versions to ensure successful builds on modern systems. +- Ensure portable and reliable compilation by explicitly including necessary standard library headers. * Mon Mar 20 2023 Zhongling He - 0.99.27-1 - Init package from upstream -- Gitee