diff --git a/0008-fix-clang.patch b/0008-fix-clang.patch new file mode 100644 index 0000000000000000000000000000000000000000..06722678336bacca5bcd92f646e0b0bf5b367f71 --- /dev/null +++ b/0008-fix-clang.patch @@ -0,0 +1,76 @@ +From 6bf16267983c9acac4ef3bf695ac4f5cdeeca085 Mon Sep 17 00:00:00 2001 +From: hleft +Date: Tue, 31 Oct 2023 09:55:07 +0800 +Subject: [PATCH] fix clang build error + +v4clients.c:29:6: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses] +xcommon.c:101:24: error: format string is not a string literal [-Werror,-Wformat-nonliteral] +xtab.c:138:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] +gssd_proc.c:789:2: error: cannot jump from this goto statement to its label + goto out; + ^ +--- + configure.ac | 12 ++++++++++-- + utils/gssd/gssd_proc.c | 10 +++++----- + 2 files changed, 15 insertions(+), 7 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f1c46c5..fe12828 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -151,7 +151,11 @@ AC_ARG_WITH(rpcgen, + [AS_HELP_STRING([--with-rpcgen=internal],[use internal rpcgen instead of system one])], + rpcgen_path=$withval, + rpcgen_path=yes ) +- rpcgen_cflags=-Werror=strict-prototypes ++ case "$CC" in ++ *gcc*) ++ rpcgen_cflags=-Werror=strict-prototypes ++ ;; ++ esac + RPCGEN_PATH= + if test "$rpcgen_path" = "yes"; then + for p in /usr/local/bin/rpcgen /usr/bin/rpcgen /bin/rpcgen +@@ -163,7 +167,11 @@ AC_ARG_WITH(rpcgen, + RPCGEN_PATH=$rpcgen_path + else + RPCGEN_PATH=internal +- rpcgen_cflags=-Wstrict-prototypes ++ case "$CC" in ++ *gcc*) ++ rpcgen_cflags=-Wstrict-prototypes ++ ;; ++esac + fi + AC_SUBST(RPCGEN_PATH) + AM_CONDITIONAL(CONFIG_RPCGEN, [test "$RPCGEN_PATH" = "internal"]) +diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c +index ae568f1..89d62d5 100644 +--- a/utils/gssd/gssd_proc.c ++++ b/utils/gssd/gssd_proc.c +@@ -776,17 +776,17 @@ process_krb5_upcall(struct clnt_upcall_info *info) + + do_downcall(fd, uid, &pd, &token, lifetime_rec, &acceptor); + +-out: +- pthread_cleanup_pop(1); +- +- return; +- + out_return_error: + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_testcancel(); + + do_error_downcall(fd, uid, downcall_err); + goto out; ++ ++out: ++ pthread_cleanup_pop(1); ++ ++ return; + } + + static struct clnt_upcall_info * +-- +2.42.0 + diff --git a/nfs-utils.spec b/nfs-utils.spec index c7ddd5b92ba597c57b5869ebd59c11e81dfef351..d005005a355f9e340127c245007531d1d256b78b 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -4,7 +4,7 @@ Name: nfs-utils Version: 2.6.2 -Release: 4 +Release: 5 Epoch: 2 Summary: The Linux NFS userland utility package License: MIT and GPLv2 and GPLv2+ and BSD @@ -20,6 +20,9 @@ Patch4: 0004-nfs-blkmaped-Fix-the-error-status-when-nfs_blkmapd-s.patch Patch5: 0005-nfs-blkmapd-PID-file-read-by-systemd-failed.patch Patch6: 0006-nfs-utils-Don-t-allow-junction-tests-to-trigger-auto.patch Patch7: 0007-Covscan-Scan-Wrong-Check-of-Return-Value.patch +%if "%toolchain" == "clang" +Patch8: 0008-fix-clang.patch +%endif BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 @@ -122,8 +125,12 @@ find -name \*.py -exec sed -r -i '1s|^#!\s*/usr/bin.*python.*|#!%{__python3}|' { %build sh -x autogen.sh +CFLAGS="%{build_cflags} -D_FILE_OFFSET_BITS=64" +%if "%toolchain" == "clang" + CFLAGS="$CFLAGS -Wno-logical-not-parentheses -Wno-format-nonliteral" +%endif %configure \ - CFLAGS="%{build_cflags} -D_FILE_OFFSET_BITS=64" \ + CFLAGS="$CFLAGS" \ LDFLAGS="%{build_ldflags}" \ --enable-mountconfig \ --enable-ipv6 \ @@ -292,6 +299,9 @@ fi %{_mandir}/*/* %changelog +* Tue Oct 31 2023 yoo - 2.6.2-5 +- fix clang build error + * Wed Mar 22 2023 wuguanghao - 2:2.6.2-4 - backport patches from community