Remove C89-specific language constructs from configure checks
Fix feature detection for major/minor macros. Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
parent
c7d395b20c
commit
22ec3a0a0d
31
samba-sysmacros.patch
Normal file
31
samba-sysmacros.patch
Normal file
@ -0,0 +1,31 @@
|
||||
source3/wscript: Fix detection of major/minor macros
|
||||
|
||||
These macros are only available via <sys/sysmacros.h> as of glibc
|
||||
commit e16deca62e16f645213dffd4ecd1153c37765f17 ("[BZ #19239] Don't
|
||||
include sys/sysmacros.h from sys/types.h."), which went into
|
||||
glibc 2.28.
|
||||
|
||||
This is different from the usual C99 cleanups because it changes
|
||||
the configure check result with existing compilers that usually
|
||||
accept implicit function declarations.
|
||||
|
||||
Submitted upstream: <https://gitlab.com/samba-team/samba/-/merge_requests/2807>
|
||||
|
||||
diff --git a/source3/wscript b/source3/wscript
|
||||
index 22be17a1a6fd1126..ca27deaa54381446 100644
|
||||
--- a/source3/wscript
|
||||
+++ b/source3/wscript
|
||||
@@ -603,11 +603,11 @@ msg.msg_accrightslen = sizeof(fd);
|
||||
conf.CHECK_HEADERS('asm/types.h')
|
||||
|
||||
conf.CHECK_CODE('dev_t dev; int i = major(dev); return 0', "HAVE_DEVICE_MAJOR_FN",
|
||||
- headers='unistd.h sys/types.h',
|
||||
+ headers='sys/sysmacros.h unistd.h sys/types.h',
|
||||
msg="Checking for major macro")
|
||||
|
||||
conf.CHECK_CODE('dev_t dev; int i = minor(dev); return 0', "HAVE_DEVICE_MINOR_FN",
|
||||
- headers='unistd.h sys/types.h',
|
||||
+ headers='sys/sysmacros.h unistd.h sys/types.h',
|
||||
msg="Checking for minor macro")
|
||||
|
||||
conf.CHECK_STRUCTURE_MEMBER('struct dirent', 'd_off',
|
23
samba-waf18.patch
Normal file
23
samba-waf18.patch
Normal file
@ -0,0 +1,23 @@
|
||||
Avoid calling lib_func without a prototype.
|
||||
|
||||
This commit mirrors the change in commit f4c0a750d4adebcf2342a44e85f04526c34
|
||||
("WAF: Fix detection of linker features")
|
||||
to buildtools/wafsamba/samba_conftests.py. It fixes the check for rpath
|
||||
support with compilers in strict C99 mode.
|
||||
|
||||
Submitted upstream: <https://gitlab.com/samba-team/samba/-/merge_requests/2807>
|
||||
|
||||
diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py
|
||||
index e2a078bd3a05fd78..cfdceea14ca4b706 100644
|
||||
--- a/buildtools/wafsamba/samba_waf18.py
|
||||
+++ b/buildtools/wafsamba/samba_waf18.py
|
||||
@@ -209,7 +209,8 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
|
||||
lib_node.parent.mkdir()
|
||||
lib_node.write('int lib_func(void) { return 42; }\n', 'w')
|
||||
main_node = bld.srcnode.make_node('main.c')
|
||||
- main_node.write('int main(void) {return !(lib_func() == 42);}', 'w')
|
||||
+ main_node.write('int lib_func(void);\n'
|
||||
+ 'int main(void) {return !(lib_func() == 42);}', 'w')
|
||||
linkflags = []
|
||||
if version_script:
|
||||
script = bld.srcnode.make_node('ldscript')
|
55
samba-wscript-c99.patch
Normal file
55
samba-wscript-c99.patch
Normal file
@ -0,0 +1,55 @@
|
||||
source3/wscript: Remove implict int and implicit function declarations
|
||||
|
||||
This should fix the remaining C89isms in these configure checks.
|
||||
|
||||
Submitted upstream: <https://gitlab.com/samba-team/samba/-/merge_requests/2807>
|
||||
|
||||
diff --git a/source3/wscript b/source3/wscript
|
||||
index ca27deaa54381446..e77cd127e600f8c2 100644
|
||||
--- a/source3/wscript
|
||||
+++ b/source3/wscript
|
||||
@@ -1314,7 +1314,7 @@ syscall(SYS_initgroups, 16, NULL, NULL, 0);
|
||||
|
||||
if conf.CHECK_CODE('''
|
||||
#include <time.h>
|
||||
-main() {
|
||||
+int main() {
|
||||
struct tm *tm;
|
||||
if (sizeof(time_t) == 8) {
|
||||
time_t max_time = 0x7fffffffffffffffll;
|
||||
@@ -1345,7 +1345,7 @@ main() {
|
||||
#if defined(HAVE_SYS_SYSMACROS_H)
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
-main() { dev_t dev = makedev(1,2); return 0; }
|
||||
+int main() { dev_t dev = makedev(1,2); return 0; }
|
||||
''',
|
||||
'HAVE_MAKEDEV',
|
||||
addmain=False,
|
||||
@@ -1355,12 +1355,13 @@ main() { dev_t dev = makedev(1,2); return 0; }
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
+#include <stdlib.h>
|
||||
|
||||
void exit_on_core(int ignored) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
-main() {
|
||||
+int main() {
|
||||
char *newpath;
|
||||
signal(SIGSEGV, exit_on_core);
|
||||
newpath = realpath("/tmp", NULL);
|
||||
@@ -1517,9 +1518,9 @@ main() {
|
||||
# Check for getcwd allowing a NULL arg.
|
||||
conf.CHECK_CODE('''
|
||||
#include <unistd.h>
|
||||
-main() {
|
||||
+int main() {
|
||||
char *s = getcwd(NULL,0);
|
||||
- exit(s != NULL ? 0 : 1);
|
||||
+ return s != NULL ? 0 : 1;
|
||||
}''', 'GETCWD_TAKES_NULL', addmain=False, execute=True,
|
||||
msg="getcwd takes a NULL argument")
|
||||
|
@ -135,7 +135,7 @@
|
||||
%define samba_requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
|
||||
|
||||
%global samba_version 4.17.3
|
||||
%global baserelease 0
|
||||
%global baserelease 1
|
||||
# This should be rc1 or %%nil
|
||||
%global pre_release %nil
|
||||
|
||||
@ -230,6 +230,9 @@ Source17: samba-usershares-systemd-sysusers.conf
|
||||
|
||||
Source201: README.downgrade
|
||||
Source202: samba.abignore
|
||||
Patch0: samba-waf18.patch
|
||||
Patch1: samba-sysmacros.patch
|
||||
Patch2: samba-wscript-c99.patch
|
||||
|
||||
Requires(pre): /usr/sbin/groupadd
|
||||
|
||||
@ -4313,6 +4316,10 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Nov 21 2022 Florian Weimer <fweimer@redhat.com> - 2:4.17.3-%{baserelease}
|
||||
- Remove C89-specific language constructs from configure checks
|
||||
- Fix feature detection for major/minor macros
|
||||
|
||||
* Tue Nov 15 2022 Guenther Deschner <gdeschner@redhat.com> - 4.17.3-0
|
||||
- resolves: #2142959 - Update to version 4.17.3
|
||||
- resolves: #2140960, #2143117 - Security fixes for CVE-2022-42898
|
||||
|
Loading…
Reference in New Issue
Block a user