[Rpm-maint] [PATCH 2/5] Only build bundled fts if system has a bad version that doesn't handle LFS

Gleb Fotengauer-Malinovskiy glebfm at altlinux.org
Thu Mar 23 18:21:26 UTC 2017


Older versions of glibc included an fts implementation that didn't have
Large File Support on 32-bit systems.  We worked that around by bundling
fts into rpm codebase.  Thanks to Mark Wielaard, glibc >= 2.23 has LFS
support in fts.

Unfortunately, we can't drop bundled fts because we have to support
build with other libcs which do not implement fts at all or their
implementations do not provide Large File Support.

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm at altlinux.org>
---
 build/files.c    | 11 ++++++++++-
 configure.ac     |  3 +++
 misc/Makefile.am |  5 ++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/build/files.c b/build/files.c
index 984439d..7884768 100644
--- a/build/files.c
+++ b/build/files.c
@@ -28,7 +28,16 @@
 #include <rpm/rpmbase64.h>
 
 #include "rpmio/rpmio_internal.h"	/* XXX rpmioSlurp */
-#include "misc/rpmfts.h"
+
+#ifdef HAVE_FTS_H
+# include <fts.h>
+# define Fts_open fts_open
+# define Fts_read fts_read
+# define Fts_close fts_close
+#else
+# include "misc/rpmfts.h"
+#endif
+
 #include "lib/rpmfi_internal.h"	/* XXX fi->apath */
 #include "lib/rpmug.h"
 #include "build/rpmbuild_internal.h"
diff --git a/configure.ac b/configure.ac
index bdcb741..687d58c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -717,6 +717,9 @@ AC_CHECK_FUNCS(
    [mkstemp getcwd basename dirname realpath setenv unsetenv regcomp lchown utimes],
    [], [AC_MSG_ERROR([function required by rpm])])
 
+AC_CHECK_HEADERS([fts.h])
+AM_CONDITIONAL([USE_BUNDLED_FTS_KLUDGE], [test "$ac_cv_header_fts_h" = no])
+
 AC_LIBOBJ(fnmatch)
 
 dnl check if python is requested
diff --git a/misc/Makefile.am b/misc/Makefile.am
index 31d264e..beb9bee 100644
--- a/misc/Makefile.am
+++ b/misc/Makefile.am
@@ -10,5 +10,8 @@ EXTRA_DIST = \
 
 noinst_LTLIBRARIES = libmisc.la
 
-libmisc_la_SOURCES = fts.c rpmfts.h
+libmisc_la_SOURCES =
+if USE_BUNDLED_FTS_KLUDGE
+libmisc_la_SOURCES += fts.c rpmfts.h
+endif
 libmisc_la_LIBADD = @LTLIBOBJS@

-- 
glebfm


More information about the Rpm-maint mailing list