summaryrefslogtreecommitdiff
path: root/app-arch/rpm/files/rpm-4.19.1-musl-compat.patch
blob: ca9f97257c70efbc2347d630b1875c7452f97be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
musl doesn't implement GLOB_BRACE, simply disable it.

https://bugs.gentoo.org/922286
https://github.com/rpm-software-management/rpm/issues/2844
--- a/rpmio/rpmglob.c
+++ b/rpmio/rpmglob.c
@@ -33,6 +33,10 @@
 
 #include "debug.h"
 
+#ifndef GLOB_BRACE
+#define GLOB_BRACE 0
+#endif
+
 /* Return 1 if pattern contains a magic char, see glob(7) for a list */
 static int ismagic(const char *pattern)
 {

From 57f3711846f44da0f37cbc5dd66e8fba80a3bee1 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 18 Dec 2023 12:25:04 +0200
Subject: [PATCH] Fix unconditional dependency on non-POSIX GLOB_ONLYDIR flag

This regressed when we axed our internal glob copy in commit
66fa46c006bae0f28d93238b8f7f1c923645eee5. Luckily GLOB_ONLYDIR is only
an optimization so we can just skip it if not available.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -350,6 +350,7 @@ if (LIBDW_FOUND)
 	set(HAVE_LIBDW 1)
 endif()
 
+check_symbol_exists(GLOB_ONLYDIR "glob.h" HAVE_GLOB_ONLYDIR)
 check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
 if (NOT MAJOR_IN_SYSMACROS)
 	check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
--- a/config.h.in
+++ b/config.h.in
@@ -100,6 +100,7 @@
 #cmakedefine HAVE_ZSTD @HAVE_ZSTD@
 #cmakedefine HAVE___PROGNAME @HAVE___PROGNAME@
 #cmakedefine HAVE___SECURE_GETENV @HAVE___SECURE_GETENV@
+#cmakedefine HAVE_GLOB_ONLYDIR @HAVE_GLOB_ONLYDIR@
 #cmakedefine MAJOR_IN_MKDEV @MAJOR_IN_MKDEV@
 #cmakedefine MAJOR_IN_SYSMACROS @MAJOR_IN_SYSMACROS@
 #cmakedefine RUNDIR @rundir@
--- a/rpmio/rpmglob.c
+++ b/rpmio/rpmglob.c
@@ -84,8 +84,10 @@ int rpmGlobPath(const char * pattern, rpmglobFlags flags,
     gflags |= GLOB_BRACE;
     if (home != NULL && strlen(home) > 0) 
 	gflags |= GLOB_TILDE;
+#if HAVE_GLOB_ONLYDIR
     if (dir_only)
 	gflags |= GLOB_ONLYDIR;
+#endif
     if (flags & RPMGLOB_NOCHECK)
 	gflags |= GLOB_NOCHECK;