All of lore.kernel.org
 help / color / mirror / Atom feed
From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-networking][PATCH 3/3] samba: Fix configure tests to work with clang
Date: Fri,  6 Sep 2019 09:32:42 -0700	[thread overview]
Message-ID: <20190906163242.4770-3-raj.khem@gmail.com> (raw)
In-Reply-To: <20190906163242.4770-1-raj.khem@gmail.com>

Do not use nested functions ( main inside main )
Use global scope for __thread variables

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...ipt-Avoid-generating-nested-main-fun.patch | 30 ++++++++++
 ...ve-__thread-variable-to-global-scope.patch | 58 +++++++++++++++++++
 .../samba/samba_4.10.7.bb                     |  2 +
 3 files changed, 90 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/0001-lib-replace-wscript-Avoid-generating-nested-main-fun.patch
 create mode 100644 meta-networking/recipes-connectivity/samba/samba/0002-util_sec.c-Move-__thread-variable-to-global-scope.patch

diff --git a/meta-networking/recipes-connectivity/samba/samba/0001-lib-replace-wscript-Avoid-generating-nested-main-fun.patch b/meta-networking/recipes-connectivity/samba/samba/0001-lib-replace-wscript-Avoid-generating-nested-main-fun.patch
new file mode 100644
index 0000000000..de7f311834
--- /dev/null
+++ b/meta-networking/recipes-connectivity/samba/samba/0001-lib-replace-wscript-Avoid-generating-nested-main-fun.patch
@@ -0,0 +1,30 @@
+From 3a935c638605bfb392ca7780d22c08c1a0a71e71 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 5 Sep 2019 21:37:33 -0700
+Subject: [PATCH 1/2] lib/replace/wscript: Avoid generating nested main
+ function
+
+clang is not happy when it sees another main nested inside the main
+function and fails the test for prctl syscall, therefore avoid adding
+implicit main() here
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/replace/wscript | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/replace/wscript b/lib/replace/wscript
+index a7fd25d..d6767fc 100644
+--- a/lib/replace/wscript
++++ b/lib/replace/wscript
+@@ -137,6 +137,7 @@ def configure(conf):
+                     }
+                     ''',
+                     'HAVE_PRCTL',
++                    addmain=False,
+                     headers='sys/prctl.h',
+                     msg='Checking for prctl syscall')
+ 
+-- 
+2.23.0
+
diff --git a/meta-networking/recipes-connectivity/samba/samba/0002-util_sec.c-Move-__thread-variable-to-global-scope.patch b/meta-networking/recipes-connectivity/samba/samba/0002-util_sec.c-Move-__thread-variable-to-global-scope.patch
new file mode 100644
index 0000000000..6fc849337c
--- /dev/null
+++ b/meta-networking/recipes-connectivity/samba/samba/0002-util_sec.c-Move-__thread-variable-to-global-scope.patch
@@ -0,0 +1,58 @@
+From c62a6f32ab965de2ec77a614f20f04568116835b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 5 Sep 2019 21:39:05 -0700
+Subject: [PATCH 2/2] util_sec.c: Move __thread variable to global scope
+
+Make clang happy otherwise it complains about variable scope
+
+fixes
+
+source3/./lib/util_sec.c:470:4: error: '__thread' variables must have global storage
+        } __thread cache;
+          ^
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ source3/lib/util_sec.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/source3/lib/util_sec.c b/source3/lib/util_sec.c
+index 9408269..7390318 100644
+--- a/source3/lib/util_sec.c
++++ b/source3/lib/util_sec.c
+@@ -444,6 +444,17 @@ void become_user_permanently(uid_t uid, gid_t gid)
+ 	assert_gid(gid, gid);
+ }
+ 
++#ifdef HAVE___THREAD
++	struct cache_t {
++		bool active;
++		uid_t uid;
++		gid_t gid;
++		size_t setlen;
++		uintptr_t gidset;
++	};
++
++static __thread struct cache_t cache;
++#endif
+ /**********************************************************
+  Function to set thread specific credentials. Leave
+  saved-set uid/gid alone.Must be thread-safe code.
+@@ -461,14 +472,6 @@ int set_thread_credentials(uid_t uid,
+ 	 * available.
+ 	 */
+ #ifdef HAVE___THREAD
+-	static struct {
+-		bool active;
+-		uid_t uid;
+-		gid_t gid;
+-		size_t setlen;
+-		uintptr_t gidset;
+-	} __thread cache;
+-
+ 	if (cache.active &&
+ 	    cache.uid == uid &&
+ 	    cache.gid == gid &&
+-- 
+2.23.0
+
diff --git a/meta-networking/recipes-connectivity/samba/samba_4.10.7.bb b/meta-networking/recipes-connectivity/samba/samba_4.10.7.bb
index d13a6b4dbb..1b2bc087d5 100644
--- a/meta-networking/recipes-connectivity/samba/samba_4.10.7.bb
+++ b/meta-networking/recipes-connectivity/samba/samba_4.10.7.bb
@@ -24,6 +24,8 @@ SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
            file://smb_conf-4.7.0.patch \
            file://volatiles.03_samba \
            file://0001-waf-add-support-of-cross_compile.patch \
+           file://0001-lib-replace-wscript-Avoid-generating-nested-main-fun.patch \
+           file://0002-util_sec.c-Move-__thread-variable-to-global-scope.patch \
            "
 SRC_URI_append_libc-musl = " \
            file://samba-pam.patch \
-- 
2.23.0



      parent reply	other threads:[~2019-09-06 16:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 16:32 [meta-oe][PATCH V2 1/3] remmina: Add recipe for the remmina remote desktop client Khem Raj
2019-09-06 16:32 ` [meta-oe][PATCH 2/3] remmina: Link with libexecinfo explicitly on musl Khem Raj
2019-09-06 16:35   ` Alejandro Enedino Hernandez Samaniego
2019-09-07 16:25     ` Khem Raj
2019-09-07 19:20       ` Alejandro Enedino Hernandez Samaniego
2019-09-06 16:32 ` Khem Raj [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190906163242.4770-3-raj.khem@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.