blob: 8e73e077049df1e8d9789e1f26b7c190874c17aa [file] [log] [blame]
Patrick Williams73bd93f2024-02-20 08:07:48 -06001From 1b3a182f38895de5ea8dda5a77867345845fb967 Mon Sep 17 00:00:00 2001
2From: Panu Matilainen <pmatilai@redhat.com>
3Date: Mon, 18 Dec 2023 12:25:04 +0200
4Subject: [PATCH] Fix unconditional dependency on non-POSIX GLOB_ONLYDIR flag
5
6This regressed when we axed our internal glob copy in commit
766fa46c006bae0f28d93238b8f7f1c923645eee5. Luckily GLOB_ONLYDIR is only
8an optimization so we can just skip it if not available.
9
10Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/57f3711846f44da0f37cbc5dd66e8fba80a3bee1]
11Signed-off-by: Alexander Kanavin <alex@linutronix.de>
12---
13 CMakeLists.txt | 1 +
14 config.h.in | 1 +
15 rpmio/rpmglob.c | 2 ++
16 3 files changed, 4 insertions(+)
17
18diff --git a/CMakeLists.txt b/CMakeLists.txt
19index d0ea565f3..0a474106e 100644
20--- a/CMakeLists.txt
21+++ b/CMakeLists.txt
22@@ -351,6 +351,7 @@ if (LIBDW_FOUND)
23 set(HAVE_LIBDW 1)
24 endif()
25
26+check_symbol_exists(GLOB_ONLYDIR "glob.h" HAVE_GLOB_ONLYDIR)
27 check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
28 if (NOT MAJOR_IN_SYSMACROS)
29 check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
30diff --git a/config.h.in b/config.h.in
31index cb97827d0..ab1757a9a 100644
32--- a/config.h.in
33+++ b/config.h.in
34@@ -100,6 +100,7 @@
35 #cmakedefine HAVE_ZSTD @HAVE_ZSTD@
36 #cmakedefine HAVE___PROGNAME @HAVE___PROGNAME@
37 #cmakedefine HAVE___SECURE_GETENV @HAVE___SECURE_GETENV@
38+#cmakedefine HAVE_GLOB_ONLYDIR @HAVE_GLOB_ONLYDIR@
39 #cmakedefine MAJOR_IN_MKDEV @MAJOR_IN_MKDEV@
40 #cmakedefine MAJOR_IN_SYSMACROS @MAJOR_IN_SYSMACROS@
41 #cmakedefine RUNDIR @rundir@
42diff --git a/rpmio/rpmglob.c b/rpmio/rpmglob.c
43index 8276eddb4..243568766 100644
44--- a/rpmio/rpmglob.c
45+++ b/rpmio/rpmglob.c
46@@ -84,8 +84,10 @@ int rpmGlobPath(const char * pattern, rpmglobFlags flags,
47 gflags |= GLOB_BRACE;
48 if (home != NULL && strlen(home) > 0)
49 gflags |= GLOB_TILDE;
50+#if HAVE_GLOB_ONLYDIR
51 if (dir_only)
52 gflags |= GLOB_ONLYDIR;
53+#endif
54 if (flags & RPMGLOB_NOCHECK)
55 gflags |= GLOB_NOCHECK;
56