Skip to contentSkip to conversation

lvm2: Portable fixes for fixing compile with musl

PATCH In review Khem Raj 2 participants 5 messages Jan 20, 2016 – Feb 1, 2016

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 lvm2: Portable fixes for fixing compile with musl

---
 meta-oe/recipes-support/lvm2/lvm2.inc              |   6 +-
 ...01-implement-libc-specific-_reopen_stream.patch | 139 +++++++++++++++++++++
 ..._MUTEX_RECURSIVE-instead-of-PTHREAD_MUTEX.patch |  44 +++++++
 ...0003-Guard-use-of-mallinfo-with-__GLIBC__.patch |  30 +++++
 ...cntl.h-for-O_-defines-and-fcntl-signature.patch |  29 +++++
 5 files changed, 247 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/lvm2/lvm2/0001-implement-libc-specific-_reopen_stream.patch
 create mode 100644 meta-oe/recipes-support/lvm2/lvm2/0002-use-PTHREAD_MUTEX_RECURSIVE-instead-of-PTHREAD_MUTEX.patch
 create mode 100644 meta-oe/recipes-support/lvm2/lvm2/0003-Guard-use-of-mallinfo-with-__GLIBC__.patch
 create mode 100644 meta-oe/recipes-support/lvm2/lvm2/0004-include-fcntl.h-for-O_-defines-and-fcntl-signature.patch
meta-oe/recipes-support/lvm2/lvm2.inc +5 -1
index c4d1b19..a891950 100644
@@ -8,7 +8,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
 S = "${WORKDIR}/LVM2.${PV}"
 SRC_URI = "ftp://sources.redhat.com/pub/lvm2/old/LVM2.${PV}.tgz \
            file://lvm.conf \
-          "
+           file://0001-implement-libc-specific-_reopen_stream.patch \
+           file://0002-use-PTHREAD_MUTEX_RECURSIVE-instead-of-PTHREAD_MUTEX.patch \
+           file://0003-Guard-use-of-mallinfo-with-__GLIBC__.patch \
+           file://0004-include-fcntl.h-for-O_-defines-and-fcntl-signature.patch \
+           "
 
 PACKAGECONFIG ??= "readline"
 PACKAGECONFIG[readline] = "--enable-readline,--disable-readline,readline"
meta-oe/recipes-support/lvm2/lvm2/0001-implement-libc-specific-_reopen_stream.patch new file +139 -0

139 lines not on this page · raw message

meta-oe/recipes-support/lvm2/lvm2/0002-use-PTHREAD_MUTEX_RECURSIVE-instead-of-PTHREAD_MUTEX.patch new file +44 -0

44 lines not on this page · raw message

meta-oe/recipes-support/lvm2/lvm2/0003-Guard-use-of-mallinfo-with-__GLIBC__.patch new file +30 -0
new file mode 100644
index 0000000..3d71767
@@ -0,0 +1,30 @@
+From e018d055603389b22cbc3bd68b1525f3048ebee7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 20 Jan 2016 04:50:26 +0000
+Subject: [PATCH 3/4] Guard use of mallinfo() with __GLIBC__
+
+This API is glibc-only
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ lib/mm/memlock.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
+index 969f1d7..405a7c0 100644
+--- a/lib/mm/memlock.c
++++ b/lib/mm/memlock.c
+@@ -145,7 +145,7 @@ static void _touch_memory(void *mem, size_t size)
+ 
+ static void _allocate_memory(void)
+ {
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ 	void *stack_mem;
+ 	struct rlimit limit;
+ 	int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
+-- 
+2.7.0
+
meta-oe/recipes-support/lvm2/lvm2/0004-include-fcntl.h-for-O_-defines-and-fcntl-signature.patch new file +29 -0
new file mode 100644
index 0000000..2a3b843
@@ -0,0 +1,29 @@
+From 9b793d5b4adc5d8b3684e7f66943e236eae7c2db Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 20 Jan 2016 04:52:59 +0000
+Subject: [PATCH 4/4] include fcntl.h for O_* defines and fcntl() signature
+
+On glibc _somehow_ this header gets pulled in indirectly
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ libdaemon/server/daemon-server.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
+index d9d60d1..433d100 100644
+--- a/libdaemon/server/daemon-server.c
++++ b/libdaemon/server/daemon-server.c
+@@ -18,6 +18,7 @@
+ #include "daemon-server.h"
+ #include "daemon-log.h"
+ 
++#include <fcntl.h>
+ #include <dlfcn.h>
+ #include <errno.h>
+ #include <pthread.h>
+-- 
+2.7.0
+
Signature · 1 line
2.7.0
author
#1 lore raw

PATCH 2/3 fbset: Fix out of tree builds ( S != B )

Remove assumption about glibc == linux

---
 ...ding-asm-types.h-is-needed-on-all-linux-s.patch | 34 ++++++++++++++++++++++
 meta-oe/recipes-support/fbset/fbset_2.1.bb         |  9 +++---
 2 files changed, 39 insertions(+), 4 deletions(-)
 create mode 100644 meta-oe/recipes-support/fbset/fbset/0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch
meta-oe/recipes-support/fbset/fbset/0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch new file +34 -0
new file mode 100644
index 0000000..7f45dbe
@@ -0,0 +1,34 @@
+From 06edd88833da93361d5408b880fbb890df332497 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 19 Jan 2016 01:55:47 +0000
+Subject: [PATCH] fbset: including asm/types.h is needed on all linux systems
+
+including asm/types.h is needed to get Linux typedef's like
+__s32 and so on which are independent of C library therefore this
+define should not be guarded by __GLIBC__ but by __linux__
+
+Helps to compile it on musl systems
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ fbset.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fbset.h b/fbset.h
+index 9b1d2ac..0d8def8 100644
+--- a/fbset.h
++++ b/fbset.h
+@@ -15,7 +15,7 @@
+ #include <stdio.h>
+ #include <sys/types.h>
+ 
+-#ifdef __GLIBC__
++#ifdef __linux__
+ #include <asm/types.h>
+ #endif
+ 
+-- 
+2.7.0
+
meta-oe/recipes-support/fbset/fbset_2.1.bb +5 -4
index 1855932..ce49019 100644
@@ -16,15 +16,16 @@ PR = "r4"
 SRC_URI = "http://ftp.debian.org/debian/pool/main/f/fbset/fbset_2.1.orig.tar.gz \
            file://makefile.patch \
            file://fbset-2.1-fix-makefile-dep.patch \
-"
+           file://0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch \
+           "
 
 inherit update-alternatives
 
 do_install() {
     install -d ${D}${sbindir} ${D}${datadir}/man/man8 ${D}${datadir}/man/man5
-    install -m 0755 ${WORKDIR}/${BP}/fbset ${D}${sbindir}/fbset.real
-    install -m 0644 ${WORKDIR}/${BP}/*.5 ${D}${datadir}/man/man5
-    install -m 0644 ${WORKDIR}/${BP}/*.8 ${D}${datadir}/man/man8
+    install -m 0755 ${B}/fbset ${D}${sbindir}/fbset.real
+    install -m 0644 ${B}/*.5 ${D}${datadir}/man/man5
+    install -m 0644 ${B}/*.8 ${D}${datadir}/man/man8
 }
 
 ALTERNATIVE_fbset = "fbset"
Signature · 1 line
2.7.0
#2 lore raw

Re: [meta-oe][PATCH 2/3] fbset: Fix out of tree builds ( S != B )

Quoted 54 lines · Khem Raj

Remove assumption about glibc == linux

---
 ...ding-asm-types.h-is-needed-on-all-linux-s.patch | 34 ++++++++++++++++++++++
 meta-oe/recipes-support/fbset/fbset_2.1.bb         |  9 +++---
 2 files changed, 39 insertions(+), 4 deletions(-)
 create mode 100644 meta-oe/recipes-support/fbset/fbset/0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch
meta-oe/recipes-support/fbset/fbset/0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch new file +34 -0
new file mode 100644
index 0000000..7f45dbe
@@ -0,0 +1,34 @@
+From 06edd88833da93361d5408b880fbb890df332497 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 19 Jan 2016 01:55:47 +0000
+Subject: [PATCH] fbset: including asm/types.h is needed on all linux systems
+
+including asm/types.h is needed to get Linux typedef's like
+__s32 and so on which are independent of C library therefore this
+define should not be guarded by __GLIBC__ but by __linux__
+
+Helps to compile it on musl systems
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ fbset.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fbset.h b/fbset.h
+index 9b1d2ac..0d8def8 100644
+--- a/fbset.h
++++ b/fbset.h
+@@ -15,7 +15,7 @@
+ #include <stdio.h>
+ #include <sys/types.h>
+ 
+-#ifdef __GLIBC__
++#ifdef __linux__
+ #include <asm/types.h>
+ #endif
+ 
+-- 
+2.7.0
+
meta-oe/recipes-support/fbset/fbset_2.1.bb +0 -0
index 1855932..ce49019 100644

meta-oe/recipes-support/fbset/fbset_2.1.bb PR = "r4" · line 20

Quoted 6 lines
meta-oe/recipes-support/fbset/fbset_2.1.bb +2 -1
@@ -16,15 +16,16 @@ PR = "r4"
 SRC_URI = "http://ftp.debian.org/debian/pool/main/f/fbset/fbset_2.1.orig.tar.gz \
            file://makefile.patch \
            file://fbset-2.1-fix-makefile-dep.patch \
-"
+           file://0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch \
+           "

I've removed closing quote indentation change, because it should be first character on separate line (according to our styleguide).

Quoted 22 lines
meta-oe/recipes-support/fbset/fbset_2.1.bb +3 -3
 inherit update-alternatives
 
 do_install() {
     install -d ${D}${sbindir} ${D}${datadir}/man/man8 ${D}${datadir}/man/man5
-    install -m 0755 ${WORKDIR}/${BP}/fbset ${D}${sbindir}/fbset.real
-    install -m 0644 ${WORKDIR}/${BP}/*.5 ${D}${datadir}/man/man5
-    install -m 0644 ${WORKDIR}/${BP}/*.8 ${D}${datadir}/man/man8
+    install -m 0755 ${B}/fbset ${D}${sbindir}/fbset.real
+    install -m 0644 ${B}/*.5 ${D}${datadir}/man/man5
+    install -m 0644 ${B}/*.8 ${D}${datadir}/man/man8
 }
 
 ALTERNATIVE_fbset = "fbset"
Signature · 7 lines
2.7.0

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
author
#3 lore raw

Re: [meta-oe][PATCH 2/3] fbset: Fix out of tree builds ( S != B )

Quoted 57 lines · Martin Jansa
Quoted 56 lines · Khem Raj

Remove assumption about glibc == linux

---
 ...ding-asm-types.h-is-needed-on-all-linux-s.patch | 34 ++++++++++++++++++++++
 meta-oe/recipes-support/fbset/fbset_2.1.bb         |  9 +++---
 2 files changed, 39 insertions(+), 4 deletions(-)
 create mode 100644 meta-oe/recipes-support/fbset/fbset/0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch
meta-oe/recipes-support/fbset/fbset/0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch new file +34 -0
new file mode 100644
index 0000000..7f45dbe
@@ -0,0 +1,34 @@
+From 06edd88833da93361d5408b880fbb890df332497 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 19 Jan 2016 01:55:47 +0000
+Subject: [PATCH] fbset: including asm/types.h is needed on all linux systems
+
+including asm/types.h is needed to get Linux typedef's like
+__s32 and so on which are independent of C library therefore this
+define should not be guarded by __GLIBC__ but by __linux__
+
+Helps to compile it on musl systems
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ fbset.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fbset.h b/fbset.h
+index 9b1d2ac..0d8def8 100644
+--- a/fbset.h
++++ b/fbset.h
+@@ -15,7 +15,7 @@
+ #include <stdio.h>
+ #include <sys/types.h>
+
+-#ifdef __GLIBC__
++#ifdef __linux__
+ #include <asm/types.h>
+ #endif
+
+--
+2.7.0
+
meta-oe/recipes-support/fbset/fbset_2.1.bb +0 -0
index 1855932..ce49019 100644
@@ -16,15 +16,16 @@ PR = "r4"
 SRC_URI = "http://ftp.debian.org/debian/pool/main/f/fbset/fbset_2.1.orig.tar.gz \
            file://makefile.patch \
Quoted 8 lines

meta-oe/recipes-support/fbset/fbset_2.1.bb PR = "r4" · line 20

Quoted 4 lines
meta-oe/recipes-support/fbset/fbset_2.1.bb +2 -1
            file://fbset-2.1-fix-makefile-dep.patch \
-"
+           file://0001-fbset-including-asm-types.h-is-needed-on-all-linux-s.patch \
+           "

I've removed closing quote indentation change, because it should be first character on separate line (according to our styleguide).

old habits die hard. Thanks for correcting it, I will remember to change myself in future.

Quoted 33 lines
Quoted 18 lines
meta-oe/recipes-support/fbset/fbset_2.1.bb +3 -4
 inherit update-alternatives
 
 do_install() {
     install -d ${D}${sbindir} ${D}${datadir}/man/man8 ${D}${datadir}/man/man5
-    install -m 0755 ${WORKDIR}/${BP}/fbset ${D}${sbindir}/fbset.real
-    install -m 0644 ${WORKDIR}/${BP}/*.5 ${D}${datadir}/man/man5
-    install -m 0644 ${WORKDIR}/${BP}/*.8 ${D}${datadir}/man/man8
+    install -m 0755 ${B}/fbset ${D}${sbindir}/fbset.real
+    install -m 0644 ${B}/*.5 ${D}${datadir}/man/man5
+    install -m 0644 ${B}/*.8 ${D}${datadir}/man/man8
 }
 
 ALTERNATIVE_fbset = "fbset"
--

2.7.0

Quoted 5 lines

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

--
Martin 'JaMa' Jansa jabber: [email protected]

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

author
#4 lore raw

PATCH 3/3 polkit: Fix build with musl

In reply to Khem Raj

Make features like netgroup optional, these are not supported by posix secondly they are poked at during configure so nothing changes for glibc based systems but it helps compiling with musl

---
 .../0001-make-netgroup-support-configurable.patch  | 107 +++++++++++++++++++++
 meta-oe/recipes-extended/polkit/polkit_0.113.bb    |   1 +
 2 files changed, 108 insertions(+)
 create mode 100644 meta-oe/recipes-extended/polkit/polkit/0001-make-netgroup-support-configurable.patch
meta-oe/recipes-extended/polkit/polkit/0001-make-netgroup-support-configurable.patch new file +107 -0
new file mode 100644
index 0000000..4e3af87
@@ -0,0 +1,107 @@
+From 7d5e205aa58a10e7b1ccc2fa75b443508a5c3e18 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 20 Jan 2016 04:31:59 +0000
+Subject: [PATCH] make netgroup support configurable
+
+Disable using innetgr and *netigrent function if not available
+
+These functions are not available on all libc implementations e.g. musl
+doesnt have them.
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+Upstream-Status: Pending
+
+ configure.ac                                          | 2 +-
+ src/polkitbackend/polkitbackendinteractiveauthority.c | 6 +++++-
+ src/polkitbackend/polkitbackendjsauthority.c          | 5 ++---
+ 3 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 07982d1..21590b2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -158,7 +158,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
+ 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
+ AC_SUBST(EXPAT_LIBS)
+ 
+-AC_CHECK_FUNCS(clearenv fdatasync)
++AC_CHECK_FUNCS(clearenv fdatasync getnetgrent innetgr)
+ 
+ if test "x$GCC" = "xyes"; then
+   LDFLAGS="-Wl,--as-needed $LDFLAGS"
+diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
+index 7019356..cf39d77 100644
+--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
++++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
+@@ -2213,7 +2213,7 @@ get_users_in_group (PolkitIdentity                    *group,
+  out:
+   return ret;
+ }
+-
++#if defined HAVE_GETNETGRENT
+ static GList *
+ get_users_in_net_group (PolkitIdentity                    *group,
+                         gboolean                           include_root)
+@@ -2270,6 +2270,8 @@ get_users_in_net_group (PolkitIdentity                    *group,
+   return ret;
+ }
+ 
++#endif
++
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+ static void
+@@ -2355,10 +2357,12 @@ authentication_agent_initiate_challenge (AuthenticationAgent         *agent,
+         {
+           user_identities = g_list_concat (user_identities, get_users_in_group (identity, FALSE));
+         }
++#if defined HAVE_GETNETGRENT
+       else if (POLKIT_IS_UNIX_NETGROUP (identity))
+         {
+           user_identities =  g_list_concat (user_identities, get_users_in_net_group (identity, FALSE));
+         }
++#endif
+       else
+         {
+           g_warning ("Unsupported identity");
+diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
+index 097dcc5..e59b3f7 100644
+--- a/src/polkitbackend/polkitbackendjsauthority.c
++++ b/src/polkitbackend/polkitbackendjsauthority.c
+@@ -1498,7 +1498,6 @@ js_polkit_spawn (JSContext  *cx,
+ 
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+-
+ static JSBool
+ js_polkit_user_is_in_netgroup (JSContext  *cx,
+                                unsigned    argc,
+@@ -1518,6 +1517,7 @@ js_polkit_user_is_in_netgroup (JSContext  *cx,
+   user = JS_EncodeString (cx, user_str);
+   netgroup = JS_EncodeString (cx, netgroup_str);
+ 
++#if defined HAVE_INNETGR
+   if (innetgr (netgroup,
+                NULL,  /* host */
+                user,
+@@ -1525,6 +1525,7 @@ js_polkit_user_is_in_netgroup (JSContext  *cx,
+     {
+       is_in_netgroup =  JS_TRUE;
+     }
++#endif
+ 
+   JS_free (cx, netgroup);
+   JS_free (cx, user);
+@@ -1536,8 +1537,6 @@ js_polkit_user_is_in_netgroup (JSContext  *cx,
+   return ret;
+ }
+ 
+-
+-
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+ typedef struct
+-- 
+2.7.0
+
meta-oe/recipes-extended/polkit/polkit_0.113.bb +1 -0
index b85122e..8a613ef 100644
@@ -19,6 +19,7 @@ PACKAGECONFIG[consolekit] = ",,,consolekit"
 
 PAM_SRC_URI = "file://polkit-1_pam.patch"
 SRC_URI = "http://www.freedesktop.org/software/polkit/releases/polkit-${PV}.tar.gz \
+           file://0001-make-netgroup-support-configurable.patch \
            ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
 "
 SRC_URI[md5sum] = "4b77776c9e4f897dcfe03b2c34198edf"
Signature · 1 line
2.7.0