[PATCHES v2] Fix FreeBSD developer build

Stefan Metzmacher metze at samba.org
Wed Nov 22 13:02:04 UTC 2017


Am 22.11.2017 um 01:15 schrieb Andrew Bartlett via samba-technical:
> On Tue, 2017-11-21 at 21:25 +0200, Uri Simchoni via samba-technical
> wrote:
>> Hi,
>>
>> Attached version 3 - same as v2, but with added 3 patches at the end,
>> which allow FreeBSD developer build to run without the ADDITIONAL_CFLAGS
>> workaround, and without breaking Linux...
>>
>> Some responses below.
>>
>> Thanks,
>> Uri.
>>
>> On 11/21/2017 12:58 AM, Timur I. Bakeyev via samba-technical wrote:
>>> Hi, Uri!
>>>
>>> That's quite a jumbo patch, possibly splitting it into smaller chunks could
>>> be easier to review :)
>>>
>>
>> That's a jumbo patch-*set*. Each patch is pretty small, concerns one
>> issue, and most patches modify a single file. I believe that's more or
>> less the Samba practice. Granted, it's easier for people to review a
>> small patch set, but that would mean I'd get into a cycle of several
>> weeks, waiting for the previous subset to land before submitting the
>> next one - I don't have the patience for that so let's keep our fingers
>> crossed.
> 
> I've taken a go at it.  I'll review what I can of this, so as to cut
> down the set into the changes I can simply approve. 
> 
> In particular, I've dropped the pragma changes.  #pragma caused chaos
> last time we used it, so I'm skipping those for now.
> 
> I'm also skipping the changes to pam_wrapper that need to go upstream
> (via Andreas) first.  It looks like I also made the same mistake when
> some python3 patches landed, oops. 
> 
>>> I've noticed mentioning of missing HAVE_INTPTR_T on FreeBSD, need to check
>>> that, but meanwhile:
>>>
>>> https://bugzilla.samba.org/show_bug.cgi?id=4635
>>>
>>> Also, is that patchset against the HEAD? As traditionally we usually first
>>> work with releases, so at least two patches fail to me...
>>>
>>> What are the problems with the patches I sent on Linux? I believe similar
>>> approach is used in couple of other places in wscripts.
>>>
>>
>> I didn't want to use the patches as-is, as I don't support the notion
>> of CHECK_CFLAGS(<flag-we-want-to-check> + <error flags>). CHECK_CFLAGS
>> should be able to detect <flag-we-want-to-check> without having to add.
>> So what I did was make a similar change to CHECK_CFLAGS itself. That
>> worked on FreeBSD, but changed the set of supported flags on Fedora 25
>> (GCC 6.4.1), all of the sudden claiming that -Wformat-security is not
>> supported. With further examination, it turned out that
>> -Wformat-security is ignored when -Wformat is not specified, hence the
>> addition of "prereq_flags" to CHECK_FLAGS.
> 
> I like this approach.
> 
> Attached is what I'm happy with, which is under a private autobuild.
> 
> This should then allow broader review of the remaining changes, without
> the weight of the larger patch set.

I'm not so happy with the cflags_end change.
Shouldn't we fix pidl to avoid generating unused functions?

I'm also wondering what an actual example error message is.
As I guess we already make sure we don't have any unused static
functions with the master autobuild.

Here're also some nsswitch compile fixes for freebsd 11.
I didn't runtime tested them, but at least
./configure.developer --picky-developer && make
completes on my FreeBSD 11 box.
Once someone does runtime tests on them, I'm happy
to add my sign-off-by to them. We may also want to
open a bug report for the backports.

metze
-------------- next part --------------
From 4488db7de8f4d7b3893099636afb09d3c9676228 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Sat, 21 Oct 2017 14:08:15 +0200
Subject: [PATCH 1/3] nsswitch: maintain prototypes for the linux based
 functions only once

---
 nsswitch/winbind_nss.h         |  6 ++++++
 nsswitch/winbind_nss_freebsd.c | 19 -------------------
 nsswitch/winbind_nss_linux.c   | 22 ----------------------
 nsswitch/winbind_nss_linux.h   | 24 +++++++++++++++++++++---
 nsswitch/winbind_nss_netbsd.c  | 26 --------------------------
 nsswitch/winbind_nss_solaris.h | 26 --------------------------
 6 files changed, 27 insertions(+), 96 deletions(-)

diff --git a/nsswitch/winbind_nss.h b/nsswitch/winbind_nss.h
index 05e07ad..e98a961 100644
--- a/nsswitch/winbind_nss.h
+++ b/nsswitch/winbind_nss.h
@@ -30,6 +30,7 @@
  */
 
 #include "nsswitch/winbind_nss_solaris.h"
+#include "nsswitch/winbind_nss_linux.h"
 
 #elif HAVE_NSS_H
 
@@ -37,6 +38,10 @@
  * Linux (glibc)
  */
 
+#include <nss.h>
+
+typedef enum nss_status NSS_STATUS;
+
 #include "nsswitch/winbind_nss_linux.h"
 
 #elif HAVE_NS_API_H
@@ -60,6 +65,7 @@
  */
 
 #include "nsswitch/winbind_nss_netbsd.h"
+#include "nsswitch/winbind_nss_linux.h"
 
 #else /* Nothing's defined. Neither gnu nor netbsd nor sun nor hp */
 
diff --git a/nsswitch/winbind_nss_freebsd.c b/nsswitch/winbind_nss_freebsd.c
index 476349f..1d0d9bd 100644
--- a/nsswitch/winbind_nss_freebsd.c
+++ b/nsswitch/winbind_nss_freebsd.c
@@ -24,25 +24,6 @@
 #include "winbind_client.h"
 
 /* Make sure that the module gets registered needed by freebsd 5.1 */
-extern enum nss_status _nss_winbind_getgrent_r(struct group *, char *, size_t,
-    int *);
-extern enum nss_status _nss_winbind_getgrnam_r(const char *, struct group *,
-    char *, size_t, int *);
-extern enum nss_status _nss_winbind_getgrgid_r(gid_t gid, struct group *, char *,
-    size_t, int *);
-extern enum nss_status _nss_winbind_setgrent(void);
-extern enum nss_status _nss_winbind_endgrent(void);
-extern enum nss_status _nss_winbind_initgroups_dyn(char *, gid_t, long int *,
-    long int *, gid_t **, long int , int *);
-
-extern enum nss_status _nss_winbind_getpwent_r(struct passwd *, char *, size_t,
-    int *);
-extern enum nss_status _nss_winbind_getpwnam_r(const char *, struct passwd *,
-    char *, size_t, int *);
-extern enum nss_status _nss_winbind_getpwuid_r(gid_t gid, struct passwd *, char *,
-    size_t, int *);
-extern enum nss_status _nss_winbind_setpwent(void);
-extern enum nss_status _nss_winbind_endpwent(void);
 ns_mtab *nss_module_register(const char *, unsigned int *, nss_module_unregister_fn *);
 
 NSS_METHOD_PROTOTYPE(__nss_compat_getgrnam_r);
diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
index b5c50ef..fc165a1 100644
--- a/nsswitch/winbind_nss_linux.c
+++ b/nsswitch/winbind_nss_linux.c
@@ -36,28 +36,6 @@ static pthread_mutex_t winbind_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
 #define MAX_GETPWENT_USERS 250
 #define MAX_GETGRENT_USERS 250
 
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-				       long int *size, gid_t **groups,
-				       long int limit, int *errnop);
-
 /*************************************************************************
  ************************************************************************/
 
diff --git a/nsswitch/winbind_nss_linux.h b/nsswitch/winbind_nss_linux.h
index db5a378..61e5261 100644
--- a/nsswitch/winbind_nss_linux.h
+++ b/nsswitch/winbind_nss_linux.h
@@ -22,8 +22,26 @@
 #ifndef _WINBIND_NSS_LINUX_H
 #define _WINBIND_NSS_LINUX_H
 
-#include <nss.h>
-
-typedef enum nss_status NSS_STATUS;
+NSS_STATUS _nss_winbind_setpwent(void);
+NSS_STATUS _nss_winbind_endpwent(void);
+NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
+				   char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
+				   char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_setgrent(void);
+NSS_STATUS _nss_winbind_endgrent(void);
+NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
+				   char *buffer, size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
+				   size_t buflen, int *errnop);
+NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
+				       long int *size, gid_t **groups,
+				       long int limit, int *errnop);
 
 #endif /* _WINBIND_NSS_LINUX_H */
diff --git a/nsswitch/winbind_nss_netbsd.c b/nsswitch/winbind_nss_netbsd.c
index d3a558c..4edf64c 100644
--- a/nsswitch/winbind_nss_netbsd.c
+++ b/nsswitch/winbind_nss_netbsd.c
@@ -38,32 +38,6 @@
 static struct group	_winbind_group;
 static char		_winbind_groupbuf[1024];
 
-/*
- * We need a proper prototype for this :-)
- */
-
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char *name, struct passwd *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrlst_r(struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
-				   char *buffer, size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-				       long int *size, gid_t **groups,
-				       long int limit, int *errnop);
-
 int
 netbsdwinbind_endgrent(void *nsrv, void *nscb, va_list ap)
 {
diff --git a/nsswitch/winbind_nss_solaris.h b/nsswitch/winbind_nss_solaris.h
index f0cc099..8e26d0d 100644
--- a/nsswitch/winbind_nss_solaris.h
+++ b/nsswitch/winbind_nss_solaris.h
@@ -34,30 +34,4 @@ typedef nss_status_t NSS_STATUS;
 #define NSS_STATUS_UNAVAIL     NSS_UNAVAIL
 #define NSS_STATUS_TRYAGAIN    NSS_TRYAGAIN
 
-/* The solaris winbind is implemented as a wrapper around the linux
-   version. */
-
-NSS_STATUS _nss_winbind_setpwent(void);
-NSS_STATUS _nss_winbind_endpwent(void);
-NSS_STATUS _nss_winbind_getpwent_r(struct passwd* result, char* buffer,
-				   size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getpwuid_r(uid_t, struct passwd*, char* buffer,
-				   size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getpwnam_r(const char* name, struct passwd* result,
-				   char* buffer, size_t buflen, int* errnop);
-
-NSS_STATUS _nss_winbind_setgrent(void);
-NSS_STATUS _nss_winbind_endgrent(void);
-NSS_STATUS _nss_winbind_getgrent_r(struct group* result, char* buffer,
-				   size_t buflen, int* errnop);
-NSS_STATUS _nss_winbind_getgrnam_r(const char *name,
-				   struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid,
-				   struct group *result, char *buffer,
-				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
-				       long int *size, gid_t **groups,
-				       long int limit, int *errnop);
-
 #endif /* _WINBIND_NSS_SOLARIS_H */
-- 
1.9.1


From af3fa879e9813f5d9a2b737ccf0d49b8c20a32df Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Sat, 21 Oct 2017 14:14:34 +0200
Subject: [PATCH 2/3] nsswitch: add some const to _nss_winbind_initgroups_dyn()
 prototype

---
 nsswitch/winbind_nss_linux.c | 2 +-
 nsswitch/winbind_nss_linux.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
index fc165a1..442c06e 100644
--- a/nsswitch/winbind_nss_linux.c
+++ b/nsswitch/winbind_nss_linux.c
@@ -1024,7 +1024,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
 /* Initialise supplementary groups */
 
 NSS_STATUS
-_nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
+_nss_winbind_initgroups_dyn(const char *user, gid_t group, long int *start,
 			    long int *size, gid_t **groups, long int limit,
 			    int *errnop)
 {
diff --git a/nsswitch/winbind_nss_linux.h b/nsswitch/winbind_nss_linux.h
index 61e5261..d18799e 100644
--- a/nsswitch/winbind_nss_linux.h
+++ b/nsswitch/winbind_nss_linux.h
@@ -40,7 +40,7 @@ NSS_STATUS _nss_winbind_getgrnam_r(const char *name, struct group *result,
 				   char *buffer, size_t buflen, int *errnop);
 NSS_STATUS _nss_winbind_getgrgid_r(gid_t gid, struct group *result, char *buffer,
 				   size_t buflen, int *errnop);
-NSS_STATUS _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
+NSS_STATUS _nss_winbind_initgroups_dyn(const char *user, gid_t group, long int *start,
 				       long int *size, gid_t **groups,
 				       long int limit, int *errnop);
 
-- 
1.9.1


From 887659db2af5d777db8422be97d76dfe22faf98f Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Sat, 21 Oct 2017 14:15:12 +0200
Subject: [PATCH 3/3] nsswitch: fix the developer build of nsswitch/wins.c on
 freebsd 11

---
 nsswitch/wins.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index 19d3c5b..72055f0 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -19,7 +19,7 @@
 */
 
 #include "includes.h"
-#include "nsswitch/winbind_nss.h"
+#include "nsswitch/winbind_client.h"
 #include "nsswitch/libwbclient/wbclient.h"
 
 #ifdef HAVE_NS_API_H
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20171122/08e167b9/signature.sig>


More information about the samba-technical mailing list