libbsd: Branch 'main' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 24 22:52:14 UTC 2022


 Makefile.am         |    9 +++++++--
 configure.ac        |    3 ++-
 include/Makefile.am |    2 +-
 man/Makefile.am     |    6 +++---
 man/funopen.3bsd    |    6 +++++-
 src/Makefile.am     |   28 ++++++++++++++++------------
 src/funopen.c       |    8 +-------
 test/Makefile.am    |   21 +++++++++++++--------
 8 files changed, 48 insertions(+), 35 deletions(-)

New commits:
commit e50896286cc5718898194edb73fa7262ad9a22db
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Nov 23 23:31:54 2022 +0100

    build: Do not require funopen() to be ported
    
    This function cannot be easily and (more importantly) correctly ported
    without cooperation from the libc stdio layer. We already document that
    users should be prepared to have the function not available on some
    platforms and that they should ideally switch their code to other
    more portable and better interfaces.
    
    Instead of making the build fail, and requiring porters to add
    exceptions for something that most probably cannot be ported correctly
    anyway, simply print a warning and let it build. This will not be a
    regression because on those systems libbsd would have never been built
    before.
    
    Prompted-by: Jens Finkhaeuser <jens at finkhaeuser.de>

diff --git a/configure.ac b/configure.ac
index 842f5d6..95a4be3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,6 +247,7 @@ AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
                 getauxval getentropy getexecname getline \
                 pstat_getproc sysconf])
 AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
+AM_CONDITIONAL([HAVE_FOPENCOOKIE], [test "x$ac_cv_func_fopencookie" = "xyes"])
 
 AC_SUBST([MD5_LIBS])
 AC_SUBST([LIBBSD_LIBS])
diff --git a/man/funopen.3bsd b/man/funopen.3bsd
index 6ff61fd..0f5ac06 100644
--- a/man/funopen.3bsd
+++ b/man/funopen.3bsd
@@ -170,7 +170,11 @@ The
 .Fn funopen
 function
 may not be portable to systems other than
-.Bx .
+.Bx
+and glibc-based (as the libbsd implementation is only provided when the
+system has
+.Fn fopencookie
+available).
 .Pp
 On
 .Fx ,
diff --git a/src/funopen.c b/src/funopen.c
index 1e6f43a..01b63b3 100644
--- a/src/funopen.c
+++ b/src/funopen.c
@@ -137,12 +137,6 @@ funopen(const void *cookie,
 
 	return fopencookie(cookiewrap, mode, funcswrap);
 }
-#elif defined(__MUSL__)
-/*
- * This is unimplementable on musl based systems, and upstream has stated
- * they will not add the needed support to implement it. Just ignore this
- * interface there, as it has never been provided anyway.
- */
 #else
-#error "Function funopen() needs to be ported or disabled."
+#warning "Function funopen() is not provided on this platform."
 #endif
diff --git a/test/Makefile.am b/test/Makefile.am
index 64faaec..458a4e9 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -39,7 +39,6 @@ check_PROGRAMS = \
 	explicit_bzero \
 	humanize \
 	fgetln \
-	funopen \
 	fparseln \
 	fpurge \
 	md5 \
@@ -56,6 +55,10 @@ check_PROGRAMS = \
 	vis-openbsd \
 	# EOL
 
+if HAVE_FOPENCOOKIE
+check_PROGRAMS += funopen
+endif
+
 if HAVE_LIBTESTU01
 arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
 
commit 00b538ffa3492053b03771b7bc76563d740c038d
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Nov 23 23:28:34 2022 +0100

    build: Terminate lists in variables with «# EOL»
    
    This means we can add a trailing «\» to every element, so that they
    can be removed without requiring modification of other lines, and can
    be easily sorted.
    
    Replace the old usage of $(nil) which could possibly end up with junk
    added if such variable is ever defined, in the environment.

diff --git a/Makefile.am b/Makefile.am
index b839ae1..bdb8376 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,13 +1,18 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = include man src test
+SUBDIRS = \
+	include \
+	man \
+	src \
+	test \
+	# EOL
 
 ACLOCAL_AMFLAGS = -I m4
 
 EXTRA_DIST = \
 	autogen \
 	get-version \
-	$(nil)
+	# EOL
 
 dist-hook:
 	echo $(VERSION) >$(distdir)/.dist-version
diff --git a/include/Makefile.am b/include/Makefile.am
index e6f66bd..ca0d06f 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -29,4 +29,4 @@ nobase_include_HEADERS = \
 	bsd/unistd.h \
 	bsd/vis.h \
 	bsd/wchar.h \
-	$(nil)
+	# EOL
diff --git a/man/Makefile.am b/man/Makefile.am
index 9c6ad89..961d2f5 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -2,11 +2,11 @@
 
 EXTRA_DIST = \
 	mdX.3bsd \
-	$(nil)
+	# EOL
 
 CLEANFILES = \
 	md5.3bsd \
-	$(nil)
+	# EOL
 
 SED_MD5_SUBST = -e 's/mdX/md5/g' -e 's/mdY/md4/g' -e 's/MDX/MD5/g'
 
@@ -251,4 +251,4 @@ dist_man_MANS = \
 	vis.3bsd \
 	wcslcat.3bsd \
 	wcslcpy.3bsd \
-	$(nil)
+	# EOL
diff --git a/src/Makefile.am b/src/Makefile.am
index 7cf4a09..5f803bb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,13 +5,14 @@ AM_CPPFLAGS = \
 	-isystem $(top_srcdir)/include/bsd/ \
 	-include $(top_builddir)/config.h \
 	-DLIBBSD_OVERLAY -DLIBBSD_DISABLE_DEPRECATED \
-	-D__REENTRANT
+	-D__REENTRANT \
+	# EOL
 
 if OS_WINDOWS
 AM_CPPFLAGS += \
 	-D_CRT_SECURE_NO_WARNINGS \
 	-D_CRT_NONSTDC_NO_WARNINGS \
-	$(nil)
+	# EOL
 endif
 
 libbsd_la_included_sources = \
@@ -23,7 +24,7 @@ libbsd_la_included_sources = \
 	getentropy_osx.c \
 	getentropy_solaris.c \
 	getentropy_win.c \
-	$(nil)
+	# EOL
 
 CLEANFILES =
 EXTRA_DIST = \
@@ -32,13 +33,13 @@ EXTRA_DIST = \
 	libbsd-ctor.pc.in \
 	libbsd-overlay.pc.in \
 	$(libbsd_la_included_sources) \
-	$(nil)
+	# EOL
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = \
 	libbsd.pc \
 	libbsd-overlay.pc \
-	$(nil)
+	# EOL
 
 lib_LTLIBRARIES = libbsd.la
 lib_LIBRARIES =
@@ -51,16 +52,19 @@ endif
 
 libbsd_la_DEPENDENCIES = \
 	$(libbsd_la_included_sources) \
-	libbsd.map
+	libbsd.map \
+	# EOL
 libbsd_la_LIBADD = \
 	$(MD5_LIBS) \
 	$(LIBBSD_LIBS) \
-	$(nil)
+	# EOL
 libbsd_la_LDFLAGS = \
-	-version-number $(LIBBSD_ABI)
+	-version-number $(LIBBSD_ABI) \
+	# EOL
 if HAVE_LINKER_VERSION_SCRIPT
 libbsd_la_LDFLAGS += \
-	-Wl,--version-script=$(srcdir)/libbsd.map
+	-Wl,--version-script=$(srcdir)/libbsd.map \
+	# EOL
 endif
 libbsd_la_SOURCES = \
 	arc4random.c \
@@ -117,12 +121,12 @@ libbsd_la_SOURCES = \
 	vis.c \
 	wcslcat.c \
 	wcslcpy.c \
-	$(nil)
+	# EOL
 
 if !HAVE_GETENTROPY
 libbsd_la_SOURCES += \
 	getentropy.c \
-	$(nil)
+	# EOL
 endif
 
 if NEED_TRANSPARENT_LIBMD
@@ -133,7 +137,7 @@ endif
 
 libbsd_ctor_a_SOURCES = \
 	setproctitle_ctor.c \
-	$(nil)
+	# EOL
 
 if NEED_TRANSPARENT_LIBMD
 TRANSPARENT_LIBMD_DEPENDS = format.ld
diff --git a/test/Makefile.am b/test/Makefile.am
index 3939583..64faaec 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,30 +4,32 @@ HEADERS_CPPFLAGS = \
 	-I$(top_builddir) \
 	-include $(top_builddir)/config.h \
 	-DLIBBSD_DISABLE_DEPRECATED \
-	-D__REENTRANT
+	-D__REENTRANT \
+	# EOL
 
 AM_CPPFLAGS = \
 	-isystem $(top_srcdir)/include/bsd/ \
 	$(HEADERS_CPPFLAGS) \
-	-DLIBBSD_OVERLAY
+	-DLIBBSD_OVERLAY \
+	# EOL
 
 AM_TESTS_ENVIRONMENT = \
 	export CC="$(CC)"; \
 	export CPPFLAGS="$(HEADERS_CPPFLAGS)"; \
 	export top_srcdir="$(top_srcdir)"; \
-	$(nil)
+	# EOL
 
 LDADD = $(top_builddir)/src/libbsd.la
 
 EXTRA_DIST = \
 	headers-overlay.sh \
 	headers-system.sh \
-	$(nil)
+	# EOL
 
 check_SCRIPTS = \
 	headers-overlay.sh \
 	headers-system.sh \
-	$(nil)
+	# EOL
 
 check_PROGRAMS = \
 	overlay \
@@ -52,7 +54,7 @@ check_PROGRAMS = \
 	strtonum \
 	vis \
 	vis-openbsd \
-	$(nil)
+	# EOL
 
 if HAVE_LIBTESTU01
 arc4random_LDADD = $(LDADD) $(TESTU01_LIBS)
@@ -65,7 +67,7 @@ proctitle_LDFLAGS = \
 	-Wl,-u,libbsd_init_func \
 	$(top_builddir)/src/libbsd-ctor.a \
 	$(top_builddir)/src/libbsd.la \
-	$(nil)
+	# EOL
 
 check_PROGRAMS += proctitle
 endif
commit 5cfa39e5cde6b64ccf3d1335cee4d4744d4ce242
Author: Guillem Jover <guillem at hadrons.org>
Date:   Wed Nov 23 23:42:49 2022 +0100

    build: Use «yes» instead of «true» for AC_CHECK_FUNCS cache value
    
    This autoconf macro sets the ac_cv_func_ cached variable to «yes» not
    «true» so we were checking for an impossible condition.

diff --git a/configure.ac b/configure.ac
index 17d113c..842f5d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -246,7 +246,7 @@ AC_LINK_IFELSE(
 AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
                 getauxval getentropy getexecname getline \
                 pstat_getproc sysconf])
-AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xtrue"])
+AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xyes"])
 
 AC_SUBST([MD5_LIBS])
 AC_SUBST([LIBBSD_LIBS])


More information about the libbsd mailing list