Control: tag -1 + patch fixed-upstream

On Wed, Feb 25, 2026 at 10:19:30PM +0100, Till Kamppeter wrote:
> Problem fixed in upstream GIT, Issue:
> 
> https://github.com/alexpevzner/sane-airscan/issues/390

Hi, Thorsten and other contributors.

Seems one more commit is needed to really fix this issue.

Attaching a commit including patches for the  two relevant upstream commits. 

Thorsten, seems that this git repo is not dgit clean, although some
years ago dgit was used, so I sending this as quilt3 patches.

Hope this helps,

Regards,

-- 
Agustin
>From 4a6135239bd0960e0ce29da4f914fcc859ccefb0 Mon Sep 17 00:00:00 2001
From: Agustin Martin Domingo <[email protected]>
Date: Thu, 26 Feb 2026 16:09:46 +0100
Subject: [PATCH] Fix FTBFS with glibc 2.43 due to ISO C23 const return types

Closes: # 1128747
---
 ...01_airscan-http.c_Fix-C23+glibc-2.43.patch | 75 +++++++++++++++++++
 ...02_airscan-http.c_Fix-C23+glibc-2.43.patch | 26 +++++++
 debian/patches/series                         |  2 +
 3 files changed, 103 insertions(+)
 create mode 100644 debian/patches/0001_airscan-http.c_Fix-C23+glibc-2.43.patch
 create mode 100644 debian/patches/0002_airscan-http.c_Fix-C23+glibc-2.43.patch
 create mode 100644 debian/patches/series

diff --git a/debian/patches/0001_airscan-http.c_Fix-C23+glibc-2.43.patch b/debian/patches/0001_airscan-http.c_Fix-C23+glibc-2.43.patch
new file mode 100644
index 0000000..7517571
--- /dev/null
+++ b/debian/patches/0001_airscan-http.c_Fix-C23+glibc-2.43.patch
@@ -0,0 +1,75 @@
+From 7d6bf424705acc2d8c3a49ef2caff631e2d1219e Mon Sep 17 00:00:00 2001
+From: Alexander Pevzner <[email protected]>
+Date: Wed, 25 Feb 2026 11:08:57 +0300
+Subject: Fixed compilation with ISO C23-capable compiler (fixes #390)
+Origin: upstream, https://github.com/alexpevzner/sane-airscan/commit/7d6bf424705acc2d8c3a49ef2caff631e2d1219e
+Upstream-Bug: https://github.com/alexpevzner/sane-airscan/issues/390
+Debian-Bug: https://bugs.debian.org/1128747
+
+sane-airscan failed to compile with glibc 2.43.
+
+Quote from the original bug report:
+
+    The issue is due to ISO C23 declaration of bsearch, memchr, strchr,
+    strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr,
+    which now returns a pointer to a const-qualified type when the input
+    argument is a pointer to a const-qualified type [2].
+
+This change fixes this issue by properly treating memchr/strstr return
+types as const char* where appropriate.
+---
+ airscan-http.c | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/airscan-http.c b/airscan-http.c
+index 41335b3..89b47c0 100644
+--- a/airscan-http.c
++++ b/airscan-http.c
+@@ -662,7 +662,7 @@ http_uri_str_equal(const char *beg, const char *end, const char *pattern)
+ /* Find 1st occurrence of the character in the string,
+  * defined by begin and end pointers
+  */
+-static char *
++static const char *
+ http_uri_str_chr(const char *beg, const char *end, char c)
+ {
+     return memchr(beg, c, end - beg);
+@@ -737,8 +737,8 @@ http_uri_remove_dot_segments (char *path, char *end)
+          *     the next "/" character or the end of the input buffer.
+          */
+         } else {
+-            char   *s = http_uri_str_chr(input + 1, end, '/');
+-            size_t sz = s ? s - input : end - input;
++            const char *s = http_uri_str_chr(input + 1, end, '/');
++            size_t     sz = s ? s - input : end - input;
+ 
+             memmove(path_end, input, sz);
+             path_end += sz;
+@@ -1783,13 +1783,14 @@ http_data_set_content_type (http_data *data, const char *content_type)
+     if (content_type == NULL) {
+         content_type = str_dup("text/plain");
+     } else {
+-        char *s;
++        char *content_type2 = str_dup_tolower(content_type);
++        char *s = strchr(content_type, ';');
+ 
+-        content_type = str_dup_tolower(content_type);
+-        s = strchr(content_type, ';');
+         if (s != NULL) {
+             *s = '\0';
+         }
++
++        content_type = content_type2;
+     }
+ 
+     data->content_type = content_type;
+@@ -2156,7 +2157,8 @@ http_query_free (http_query *q)
+ static void
+ http_query_set_host (http_query *q)
+ {
+-    char                  *host, *end, *buf;
++    const char            *host, *end;
++    char                  *buf;
+     size_t                len;
+     const struct sockaddr *addr = http_uri_addr(q->uri);
+ 
diff --git a/debian/patches/0002_airscan-http.c_Fix-C23+glibc-2.43.patch b/debian/patches/0002_airscan-http.c_Fix-C23+glibc-2.43.patch
new file mode 100644
index 0000000..7a3f092
--- /dev/null
+++ b/debian/patches/0002_airscan-http.c_Fix-C23+glibc-2.43.patch
@@ -0,0 +1,26 @@
+From 4b1383f66cc986dfa538243589e5441bb98a186c Mon Sep 17 00:00:00 2001
+From: Alexander Pevzner <[email protected]>
+Date: Wed, 25 Feb 2026 15:18:49 +0300
+Subject: Fixed SIGSEGV in http_data_set_content_type() (fixes #391)
+Origin: upstream, https://github.com/alexpevzner/sane-airscan/commit/4b1383f66cc986dfa538243589e5441bb98a186c
+Upstream-Bug: https://github.com/alexpevzner/sane-airscan/issues/391
+Debian-Bug: https://bugs.debian.org/1128747
+
+The bug was introduced by the previous commit...
+---
+ airscan-http.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/airscan-http.c b/airscan-http.c
+index 89b47c0..0c25e57 100644
+--- a/airscan-http.c
++++ b/airscan-http.c
+@@ -1784,7 +1784,7 @@ http_data_set_content_type (http_data *data, const char *content_type)
+         content_type = str_dup("text/plain");
+     } else {
+         char *content_type2 = str_dup_tolower(content_type);
+-        char *s = strchr(content_type, ';');
++        char *s = strchr(content_type2, ';');
+ 
+         if (s != NULL) {
+             *s = '\0';
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..0e42673
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+0001_airscan-http.c_Fix-C23+glibc-2.43.patch
+0002_airscan-http.c_Fix-C23+glibc-2.43.patch
-- 
2.51.0

Reply via email to