Control: tags -1 patch

I also bumped into this whilst rebuilding src:policykit-1 yesterday.

There is an upstream patch[1], but it doesn't fix the build for me; I think it
is patching the wrong files.The problem appears to be multiple copies of
mocklibc. AFAICS ./test/mocklibc is not used in favour of a meson subproject.

The pkla-compat tarball also has mocklibc, but that is also patched already.

Getting the multiple layers of quilt and meson patches to work was
unpleasant. So the attached patch may save you some time.

HTH

Mark

[1]  
https://github.com/polkit-org/polkit/commit/0d78d1e4bf5ab3ce11678005b220aac0cfc5bee5

>From f50131bcb98802a66dcc1ee4cc952ca1cc9f8ff4 Mon Sep 17 00:00:00 2001
From: Mark Hindley <m...@hindley.org.uk>
Date: Wed, 13 Mar 2024 09:13:27 +0000
Subject: [PATCH] Import upstream patch to fix embedded mocklibc subproject
 FTBFS with gcc 14.

---
 ...e-print_indent-function-to-the-file-.patch | 91 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 92 insertions(+)
 create mode 100644 debian/patches/06-embedded-mocklibc-move-the-print_indent-function-to-the-file-.patch

diff --git a/debian/patches/06-embedded-mocklibc-move-the-print_indent-function-to-the-file-.patch b/debian/patches/06-embedded-mocklibc-move-the-print_indent-function-to-the-file-.patch
new file mode 100644
index 00000000..184161b7
--- /dev/null
+++ b/debian/patches/06-embedded-mocklibc-move-the-print_indent-function-to-the-file-.patch
@@ -0,0 +1,91 @@
+--- a/subprojects/mocklibc.wrap
++++ b/subprojects/mocklibc.wrap
+@@ -8,3 +8,5 @@
+ patch_url = https://wrapdb.mesonbuild.com/v1/projects/mocklibc/1.0/2/get_zip
+ patch_filename = mocklibc-1.0-2-wrap.zip
+ patch_hash = 0280f96a2eeb3c023e5acf4e00cef03d362868218d4a85347ea45137c0ef6c56
++diff_files = mocklibc-move-the-print_indent-function-to-the-file.patch
++
+--- /dev/null
++++ b/subprojects/packagefiles/mocklibc-move-the-print_indent-function-to-the-file.patch
+@@ -0,0 +1,69 @@
++From 0d78d1e4bf5ab3ce11678005b220aac0cfc5bee5 Mon Sep 17 00:00:00 2001
++From: Vincent Mihalkovic <vmiha...@redhat.com>
++Date: Fri, 8 Mar 2024 14:04:33 +0100
++Subject: [PATCH] mocklibc: move the print_indent function to the file where it
++ is used
++MIME-Version: 1.0
++Content-Type: text/plain; charset=UTF-8
++Content-Transfer-Encoding: 8bit
++
++This fixes build error with GCC >= 14 and clang >= 17,
++failing on:
++```
++../subprojects/mocklibc-1.0/src/netgroup-debug.c:25:3: error: implicit declaration of function ‘print_indent’ [-Wimplicit-function-declaration]
++   25 |   print_indent(stream, indent);
++      |   ^~~~~~~~~~~~
++```
++
++Closes: #6
++---
++ src/netgroup-debug.c | 11 +++++++++++
++ src/netgroup.c       | 11 -----------
++ 2 files changed, 11 insertions(+), 11 deletions(-)
++
++diff --git a/src/netgroup-debug.c b/src/netgroup-debug.c
++index 81d6e728..46e5b25f 100644
++--- a/src/netgroup-debug.c
+++++ b/src/netgroup-debug.c
++@@ -21,6 +21,17 @@
++ #include <stdio.h>
++ #include <stdlib.h>
++
+++/**
+++ * Print a varaible indentation to the stream.
+++ * @param stream Stream to print to
+++ * @param indent Number of indents to use
+++ */
+++static void print_indent(FILE *stream, unsigned int indent) {
+++  int i;
+++  for (i = 0; i < indent; i++)
+++    fprintf(stream, "  ");
+++}
+++
++ void netgroup_debug_print_entry(struct entry *entry, FILE *stream, unsigned int indent) {
++   print_indent(stream, indent);
++
++diff --git a/src/netgroup.c b/src/netgroup.c
++index 06a8a894..e16e4519 100644
++--- a/src/netgroup.c
+++++ b/src/netgroup.c
++@@ -71,17 +71,6 @@ static char *parser_copy_word(char **cur) {
++   return result;
++ }
++
++-/**
++- * Print a varaible indentation to the stream.
++- * @param stream Stream to print to
++- * @param indent Number of indents to use
++- */
++-void print_indent(FILE *stream, unsigned int indent) {
++-  int i;
++-  for (i = 0; i < indent; i++)
++-    fprintf(stream, "  ");
++-}
++-
++ /**
++  * Connect entries with 'child' type to their child entries.
++  * @param headentry Head of list of entries that need to be connected
++--
++2.39.2
+--- a/meson.build
++++ b/meson.build
+@@ -7,7 +7,7 @@
+     'prefix=/usr',
+     'cpp_std=c++17',
+   ],
+-  meson_version: '>= 0.50.0',
++  meson_version: '>= 0.63.0',
+ )
+ 
+ pk_version = meson.project_version()
diff --git a/debian/patches/series b/debian/patches/series
index ddbec3c1..24156d33 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+06-embedded-mocklibc-move-the-print_indent-function-to-the-file-.patch
 04-fix-pkexec-fails-with-GDBus.Error-org.freedesktop.Po.patch
 01_devuan-pkexec-pass-gtk-vars.patch
 02_gettext.patch
-- 
2.39.2

Reply via email to