Skip to content
Snippets Groups Projects
Commit ca75c92b authored by Simon McVittie's avatar Simon McVittie
Browse files

Add patch to fix FTBFS caused by an implicit declaration

Closes: #1066531
Thanks: Michael Biebl
parent 3bce9abf
No related branches found
No related tags found
No related merge requests found
From: Michael Biebl <biebl@debian.org>
Date: Sat, 16 Mar 2024 16:02:26 +0100
Subject: Turn local modifications of mocklibc into patches and apply them via
diff_files
The local copy of mocklibc was changed in
63ee649bd14c5dfa7985840061097bbac01ab721
5b8cd1a38696e7398e91863565dcfba792cbc744
0d78d1e4bf5ab3ce11678005b220aac0cfc5bee5
Turn those into patches and apply them via the diff_files mechanism.
This requires Meson 0.63.0, so bump the version accordingly.
https://mesonbuild.com/Wrap-dependency-system-manual.html#diff-files
Bug: https://github.com/polkit-org/polkit/issues/182
Bug-Debian: https://bugs.debian.org/1066531
Forwarded: https://github.com/polkit-org/polkit/pull/436
---
meson.build | 2 +-
subprojects/mocklibc.wrap | 2 ++
subprojects/packagefiles/0001.patch | 32 ++++++++++++++++++++
subprojects/packagefiles/0002.patch | 23 ++++++++++++++
subprojects/packagefiles/0003.patch | 60 +++++++++++++++++++++++++++++++++++++
5 files changed, 118 insertions(+), 1 deletion(-)
create mode 100644 subprojects/packagefiles/0001.patch
create mode 100644 subprojects/packagefiles/0002.patch
create mode 100644 subprojects/packagefiles/0003.patch
diff --git a/meson.build b/meson.build
index 2f81c90..c25cabd 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project(
'prefix=/usr',
'cpp_std=c++17',
],
- meson_version: '>= 0.50.0',
+ meson_version: '>= 0.63.0',
)
pk_version = meson.project_version()
diff --git a/subprojects/mocklibc.wrap b/subprojects/mocklibc.wrap
index af82298..6b1467c 100644
--- a/subprojects/mocklibc.wrap
+++ b/subprojects/mocklibc.wrap
@@ -8,3 +8,5 @@ source_hash = b2236a6af1028414783e9734a46ea051916ec226479d6a55a3bb823bff68f120
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 = 0001.patch, 0002.patch, 0003.patch
diff --git a/subprojects/packagefiles/0001.patch b/subprojects/packagefiles/0001.patch
new file mode 100644
index 0000000..d08c5f1
--- /dev/null
+++ b/subprojects/packagefiles/0001.patch
@@ -0,0 +1,32 @@
+commit 63ee649bd14c5dfa7985840061097bbac01ab721
+Author: Miloslav Trmač <mitr@redhat.com>
+Date: Sat Apr 13 03:19:17 2013 +0200
+
+ Fix various memory leaks.
+
+ The XML_ParserCreate_MM one was found by Florian Weimer in
+ https://bugzilla.redhat.com/show_bug.cgi?id=888728 .
+
+ This should cover everything found by valgrind on the JS authority
+ test, augmented with a call to
+ polkit_backend_authority_enumerate_actions() to verify the
+ XML_ParserCreate_MM case.
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=63492
+
+diff --git a/src/netgroup.c b/test/mocklibc/src/netgroup.c
+index f2ee857..bc99555 100644
+--- a/src/netgroup.c
++++ b/src/netgroup.c
+@@ -122,7 +122,10 @@ struct netgroup *netgroup_parse_all() {
+ char * line = NULL;
+ ssize_t line_size = getline(&line, &line_alloc, stream);
+ if (line_size == -1)
+- break;
++ {
++ free(line);
++ break;
++ }
+
+ struct netgroup *nextgroup = netgroup_parse_line(line);
+ free(line);
diff --git a/subprojects/packagefiles/0002.patch b/subprojects/packagefiles/0002.patch
new file mode 100644
index 0000000..c3c0829
--- /dev/null
+++ b/subprojects/packagefiles/0002.patch
@@ -0,0 +1,23 @@
+commit 5b8cd1a38696e7398e91863565dcfba792cbc744
+Author: Colin Walters <walters@verbum.org>
+Date: Wed Jun 3 16:31:12 2015 -0400
+
+ tests: Correct boundary test for overflow
+
+ The offset has to be strictly less than the max.
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=87716
+
+diff --git a/src/netgroup.c b/test/mocklibc/src/netgroup.c
+index bc99555..06a8a89 100644
+--- a/src/netgroup.c
++++ b/src/netgroup.c
+@@ -326,7 +326,7 @@ struct entry *netgroup_iter_next(struct netgroup_iter *iter) {
+
+ // Grow the stack
+ iter->depth++;
+- if (iter->depth > NETGROUP_MAX_DEPTH) {
++ if (iter->depth >= NETGROUP_MAX_DEPTH) {
+ iter->depth = -1;
+ return NULL; // Too much recursion
+ }
diff --git a/subprojects/packagefiles/0003.patch b/subprojects/packagefiles/0003.patch
new file mode 100644
index 0000000..11f9b13
--- /dev/null
+++ b/subprojects/packagefiles/0003.patch
@@ -0,0 +1,60 @@
+commit 0d78d1e4bf5ab3ce11678005b220aac0cfc5bee5
+Author: Vincent Mihalkovic <vmihalko@redhat.com>
+Date: Fri Mar 8 14:04:33 2024 +0100
+
+ mocklibc: move the print_indent function to the file where it is used
+
+ 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
+
+diff --git a/src/netgroup-debug.c b/src/netgroup-debug.c
+index 81d6e72..46e5b25 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 06a8a89..e16e451 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
......@@ -12,10 +12,10 @@ Bug-Debian: https://bugs.debian.org/1042880
1 file changed, 1 deletion(-)
diff --git a/data/polkit.service.in b/data/polkit.service.in
index 2113ff7..dbd1ef7 100644
index e6db351..44b68db 100644
--- a/data/polkit.service.in
+++ b/data/polkit.service.in
@@ -17,7 +17,6 @@ LockPersonality=yes
@@ -15,7 +15,6 @@ LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
PrivateDevices=yes
......
02_gettext.patch
08_chdir_root.patch
Turn-local-modifications-of-mocklibc-into-patches-and-app.patch
debian/01_pam_polkit.patch
debian/50-default.rules-Replace-wheel-group-with-sudo-group.patch
debian/Don-t-use-PrivateNetwork-yes-for-the-systemd-unit.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment