From 184a71fbdc605d0732529b506a75cfa4f9c7acda Mon Sep 17 00:00:00 2001
From: hauky <>
Date: Apr 20 2022 15:18:46 +0000
Subject: Update openafs to version 1.8.8.1 / rev 33 via SR 970995


https://build.opensuse.org/request/show/970995
by user hauky + dimstar_suse

---

diff --git a/.files b/.files
index 6275132..ef6f1ed 100644
Binary files a/.files and b/.files differ
diff --git a/.rev b/.rev
index e3f944e..6872096 100644
--- a/.rev
+++ b/.rev
@@ -473,4 +473,12 @@
     <comment></comment>
     <requestid>948297</requestid>
   </revision>
+  <revision rev="33" vrev="2">
+    <srcmd5>6cfd1d2db2b9c872ae53b94c9e4b797e</srcmd5>
+    <version>1.8.8.1</version>
+    <time>1650466634</time>
+    <user>dimstar_suse</user>
+    <comment></comment>
+    <requestid>970995</requestid>
+  </revision>
 </revisionlist>
diff --git a/449d1fa.diff b/449d1fa.diff
new file mode 100644
index 0000000..b5552fd
--- /dev/null
+++ b/449d1fa.diff
@@ -0,0 +1,118 @@
+From 449d1faf87e2841e80be38cf2b4a5cf5ff4df2d8 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 28 Jan 2022 14:10:46 -0700
+Subject: [PATCH] Linux-5.17: Kernel build uses -Wcast-function-type
+
+The linux 5.17 commit:
+  "Makefile: Enable -Wcast-function-type" (552a23a0)
+added the -Wcast-function-type compiler flag for kernel module builds.
+
+This change catches a type mismatch in the external files obtained from
+heimdal: hcrypto/evp.c and hcrypto/evp-algs.c and produces the following
+type of compile time error messages.
+
+  src/libafs/MODLOAD-.../evp.c: In function ‘hc_EVP_md_null’:
+  src/libafs/MODLOAD-.../evp.c:501:2: error: cast between incompatible
+      function types from ‘void (*)(void *)’ to ‘int (*)(EVP_MD_CTX *)’
+          {aka ‘int (*)(struct hc_EVP_MD_CTX *)’}
+          [-Werror=cast-function-type]
+  501 |  (hc_evp_md_init)null_Init,
+      |  ^
+
+Use AX_APPEND_COMPILE_FLAGS to create a CFLAGS_NOCAST_FUNCTION_TYPE
+macro to disable this warning and update the CFLAGS for these 2 files
+for the Linux libafs build.
+
+Update the CODING documentation to add the new exceptions.  In addition
+add a brief description on how to set up autoconf to add a new build
+macro to suppress compiler warnings.
+
+Note: upstream heimdal has committed a fix for this in:
+
+   hcrypto: Fix return type for null_Init, null_Update and null_Final
+   (fc4b3ce49b)
+
+Reviewed-on: https://gerrit.openafs.org/14881
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+(cherry picked from commit 6bdfa976731ce07f3236893ecf12abb9e169b882)
+
+Change-Id: Ibd354f663d5876c421a8b4e89b8943c9e3d59ebc
+---
+
+diff --git a/CODING b/CODING
+index 5d62dbb..c266979 100644
+--- a/CODING
++++ b/CODING
+@@ -265,7 +265,13 @@
+   # endif
+   #endif
+ 
+-If a pragma isn't available for your particular warning, you will need to
++If the source cannot be changed to add a pragma, you might be abe to use the
++autoconf function AX_APPEND_COMPILE_FLAGS to create a new macro that disables
++the warning and then use macro for the build options for that file. For an
++example, see how the autoconf macro CFLAGS_NOIMPLICIT_FALLTHROUGH is defined and
++used.
++
++Finally if there isn't a way to disable the specific warning, you will need to
+ disable all warnings for the file in question. You can do this by supplying
+ the autoconf macro @CFLAGS_NOERROR@ in the build options for the file. For
+ example:
+@@ -288,6 +294,10 @@
+ 				     : signed vs unsigned for dates
+ butc/tcudbprocs.c    : all	     : ubik_Call
+ external/heimdal/hcrypto/validate.c: all: statement with empty body
++external/heimdal/hcrypto/evp.c:      cast-function-type
++             : Linux kernel build uses -Wcast-function-type
++external/heimdal/hcrypto/evp-algs.c: cast-function-type
++             : Linux kernel build uses -Wcast-function-type
+ kauth/admin_tools.c  : strict-proto  : ubik_Call
+ kauth/authclient.c   : strict-proto  : ubik_Call nonsense
+ libadmin/kas/afs_kasAdmin.c: strict-proto : ubik_Call nonsense
+diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4
+index 1e1b080..11f3eea 100644
+--- a/src/cf/osconf.m4
++++ b/src/cf/osconf.m4
+@@ -665,6 +665,7 @@
+ CFLAGS_NOSTRICT=-fno-strict-aliasing
+ CFLAGS_NOUNUSED=
+ CFLAGS_NOOLDSTYLE=
++CFLAGS_NOCAST_FUNCTION_TYPE=
+ XCFLAGS_NOCHECKING="$XCFLAGS"
+ 
+ if test "x$GCC" = "xyes"; then
+@@ -677,6 +678,8 @@
+       CFLAGS_NOERROR="-Wno-error"
+       CFLAGS_NOUNUSED="-Wno-unused"
+       CFLAGS_NOOLDSTYLE="-Wno-old-style-definition"
++      AX_APPEND_COMPILE_FLAGS([-Wno-cast-function-type],
++                              [CFLAGS_NOCAST_FUNCTION_TYPE])
+       AC_DEFINE(IGNORE_SOME_GCC_WARNINGS, 1, [define to disable some gcc warnings in warnings-as-errors mode])
+     else
+       CFLAGS_NOSTRICT=
+@@ -753,6 +756,7 @@
+ AC_SUBST(CFLAGS_NOSTRICT)
+ AC_SUBST(CFLAGS_NOUNUSED)
+ AC_SUBST(CFLAGS_NOOLDSTYLE)
++AC_SUBST(CFLAGS_NOCAST_FUNCTION_TYPE)
+ AC_SUBST(XCFLAGS64)
+ AC_SUBST(XLDFLAGS)
+ AC_SUBST(XLDFLAGS64)
+diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in
+index d98fa05..8e98afd 100644
+--- a/src/libafs/MakefileProto.LINUX.in
++++ b/src/libafs/MakefileProto.LINUX.in
+@@ -79,8 +79,9 @@
+ CFLAGS_opr_rbtree.o = -I${TOP_SRCDIR}/opr
+ 
+ CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
+-	       -DHAVE_CONFIG_H
+-CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
++	       -DHAVE_CONFIG_H @CFLAGS_NOCAST_FUNCTION_TYPE@
++CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
++	       @CFLAGS_NOCAST_FUNCTION_TYPE@
+ CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+ CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+ CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
diff --git a/4cf7a9a.diff b/4cf7a9a.diff
new file mode 100644
index 0000000..956fcf9
--- /dev/null
+++ b/4cf7a9a.diff
@@ -0,0 +1,38 @@
+From 4cf7a9adba18ed7752898c0d9421067c7bf17292 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Wed, 09 Feb 2022 14:00:13 -0700
+Subject: [PATCH] autoconf: Additional library test for ncurses
+
+Depending on how the ncurses libraries were built the external symbol
+'LINES' may be replaced with the '_nc_LINES' external symbol.  Because
+the symbol 'LINES' may or may not be present, the autoconf test can fail
+to detect the correct libraries needed for curses support.
+
+Add an additional AC_CHECK_LIBs for the symbol _nc_LINES (within the
+ncurses or tinfo libraries) when setting the $LIB_curses.
+
+This commit was adapted from the openSuSE source packaging for openafs.
+
+Background: when ncurses is built with --enable-reentrant, LINES is
+defined as a C preprocessor macro that expands to a call to _nc_LINES
+
+Change-Id: If5e93078ff8cd0af5a50a25a8be7b462261a4f6f
+---
+
+diff --git a/src/cf/curses.m4 b/src/cf/curses.m4
+index 24c6535..1691845 100644
+--- a/src/cf/curses.m4
++++ b/src/cf/curses.m4
+@@ -19,7 +19,11 @@
+     AC_CHECK_LIB([ncurses], [initscr],
+ 		 [AC_CHECK_LIB([ncurses], [LINES], [openafs_cv_curses_lib=-lncurses],
+ 			       [AC_CHECK_LIB([tinfo], [LINES],
+-					     [openafs_cv_curses_lib="-lncurses -ltinfo"])])])
++					     [openafs_cv_curses_lib="-lncurses -ltinfo"],
++					     [AC_CHECK_LIB([ncurses], [_nc_LINES],
++							   [openafs_cv_curses_lib=-lncurses],
++							   [AC_CHECK_LIB([tinfo], [_nc_LINES],
++									 [openafs_cv_curses_lib="-lncurses -ltinfo"])])])])])
+     AS_IF([test "x$openafs_cv_curses_lib" = x],
+ 	  [AC_CHECK_LIB([Hcurses], [initscr], [openafs_cv_curses_lib=-lHcurses])])
+     AS_IF([test "x$openafs_cv_curses_lib" = x],
diff --git a/a714e86.diff b/a714e86.diff
new file mode 100644
index 0000000..715174f
--- /dev/null
+++ b/a714e86.diff
@@ -0,0 +1,134 @@
+From a714e865efe41aa1112f6f9c8479112660dacd6f Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Thu, 27 Jan 2022 20:19:17 -0700
+Subject: [PATCH] Linux-5.17: kernel func complete_and_exit renamed
+
+Handle the Linux kernel function rename made in commit
+ "exit: Rename complete_and_exit to kthread_complete_and_exit"
+ (cead1855)
+
+Add a new autoconf test for the linux function kthread_complete_and_exit
+and if not found use a define to map kthread_complete_and_exit to
+complete_and_exit.
+
+Replace calls to complete_and_exit with kthread_complete_and_exit.
+
+Reviewed-on: https://gerrit.openafs.org/14882
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit a651d4db7f86a24ea6784f6f27d5c8482667267b)
+
+Change-Id: Ibe96b92a84a8f876dda4019c221c37dabde93244
+---
+
+diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
+index 726b655..53a079b 100644
+--- a/src/afs/LINUX/osi_compat.h
++++ b/src/afs/LINUX/osi_compat.h
+@@ -27,6 +27,10 @@
+ # endif
+ #endif
+ 
++#if !defined(HAVE_LINUX_KTHREAD_COMPLETE_AND_EXIT)
++# define kthread_complete_and_exit complete_and_exit
++#endif
++
+ #if defined(STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT) && !defined(DCACHE_NEED_AUTOMOUNT)
+ # define DCACHE_NEED_AUTOMOUNT DMANAGED_AUTOMOUNT
+ #endif
+diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c
+index 32ad210..fab4c01 100644
+--- a/src/afs/afs_call.c
++++ b/src/afs/afs_call.c
+@@ -19,7 +19,9 @@
+ #include "afs/afs_stats.h"
+ #include "rx/rx_globals.h"
+ #if !defined(UKERNEL)
+-# if !defined(AFS_LINUX20_ENV)
++# if defined(AFS_LINUX20_ENV)
++#  include "osi_compat.h"
++# else
+ #  include "net/if.h"
+ #  ifdef AFS_SGI62_ENV
+ #   include "h/hashing.h"
+@@ -328,7 +330,7 @@
+ 	sprintf(current->comm, "afs_callback");
+ 	afs_RXCallBackServer();
+ 	AFS_GUNLOCK();
+-	complete_and_exit(0, 0);
++	kthread_complete_and_exit(0, 0);
+ 	break;
+     case AFSOP_START_AFS:
+ 	sprintf(current->comm, "afs_afsstart");
+@@ -342,7 +344,7 @@
+ 	sprintf(current->comm, "afsd");
+ 	afs_Daemon();
+ 	AFS_GUNLOCK();
+-	complete_and_exit(0, 0);
++	kthread_complete_and_exit(0, 0);
+ 	break;
+     case AFSOP_START_BKG:
+ #ifdef AFS_NEW_BKG
+@@ -361,7 +363,7 @@
+ 	afs_BackgroundDaemon();
+ 	AFS_GUNLOCK();
+ #endif
+-	complete_and_exit(0, 0);
++	kthread_complete_and_exit(0, 0);
+ 	break;
+     case AFSOP_START_TRUNCDAEMON:
+ 	sprintf(current->comm, "afs_trimstart");
+@@ -372,7 +374,7 @@
+ 	sprintf(current->comm, "afs_cachetrim");
+ 	afs_CacheTruncateDaemon();
+ 	AFS_GUNLOCK();
+-	complete_and_exit(0, 0);
++	kthread_complete_and_exit(0, 0);
+ 	break;
+     case AFSOP_START_CS:
+ 	sprintf(current->comm, "afs_checkserver");
+@@ -380,7 +382,7 @@
+ 	complete(arg->complete);
+ 	afs_CheckServerDaemon();
+ 	AFS_GUNLOCK();
+-	complete_and_exit(0, 0);
++	kthread_complete_and_exit(0, 0);
+ 	break;
+     case AFSOP_RXEVENT_DAEMON:
+ 	sprintf(current->comm, "afs_evtstart");
+@@ -398,7 +400,7 @@
+ 	sprintf(current->comm, "afs_rxevent");
+ 	afs_rxevent_daemon();
+ 	AFS_GUNLOCK();
+-	complete_and_exit(0, 0);
++	kthread_complete_and_exit(0, 0);
+ 	break;
+ #ifdef RXK_LISTENER_ENV
+     case AFSOP_RXLISTENER_DAEMON:
+@@ -420,7 +422,7 @@
+ 	sprintf(current->comm, "afs_rxlistener");
+ 	rxk_Listener();
+ 	AFS_GUNLOCK();
+-	complete_and_exit(0, 0);
++	kthread_complete_and_exit(0, 0);
+ 	break;
+ #endif
+     default:
+diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
+index 0ca3e44..cd4afe9 100644
+--- a/src/cf/linux-kernel-func.m4
++++ b/src/cf/linux-kernel-func.m4
+@@ -178,6 +178,12 @@
+                     [#include <net/ip.h>],
+                     [ip_sock_set_mtu_discover(NULL, 0);])
+ 
++dnl Linux 5.17 renamed complete_and_exit to kthread_complete_and_exit
++AC_CHECK_LINUX_FUNC([kthread_complete_and_exit],
++                    [#include <linux/kernel.h>
++                     #include <linux/kthread.h>],
++                    [kthread_complete_and_exit(0, 0);])
++
+ dnl Consequences - things which get set as a result of the
+ dnl                above tests
+ AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],
diff --git a/dir_layout.patch b/dir_layout.patch
deleted file mode 100644
index 3896588..0000000
--- a/dir_layout.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- openafs-1.8.3/src/cf/dirpaths.m4.orig	2019-04-30 13:38:33.411870333 +0200
-+++ openafs-1.8.3/src/cf/dirpaths.m4	2019-04-30 13:48:06.182604169 +0200
-@@ -20,10 +20,10 @@
-     afssrvbindir=${afssrvbindir='${bindir}'}
-     afssrvsbindir=${afssrvsbindir='${sbindir}'}
-     afssrvlibexecdir=${afssrvlibexecdir='${libexecdir}/openafs'}
--    afsdbdir=${afsdbdir='${localstatedir}/openafs/db'}
--    afslogsdir=${afslogsdir='${localstatedir}/openafs/logs'}
--    afslocaldir=${afslocaldir='${localstatedir}/openafs'}
--    afsbackupdir=${afsbackupdir='${localstatedir}/openafs/backup'}
-+    afsdbdir=${afsdbdir='/var/lib/openafs/db'}
-+    afslogsdir=${afslogsdir='/var/log/openafs'}
-+    afslocaldir=${afslocaldir='/var/lib/openafs'}
-+    afsbackupdir=${afsbackupdir='/var/lib/openafs/backup'}
-     afsbosconfigdir=${afsbosconfigdir='${sysconfdir}/openafs'}
-     afsdatadir=${afsdatadir='${datadir}/openafs'}
- fi
diff --git a/gcc-11.diff b/gcc-11.diff
new file mode 100644
index 0000000..261a2bf
--- /dev/null
+++ b/gcc-11.diff
@@ -0,0 +1,591 @@
+From 36796bbb83af2650a872234fdb5cf7124bf6cfa8 Mon Sep 17 00:00:00 2001
+From: Michael Meffie <mmeffie@sinenomine.net>
+Date: Mon, 23 Aug 2021 14:23:01 -0400
+Subject: [PATCH] ubik: Fix ubeacon_updateUbikNetworkAddress() mismatched array parameter warning
+
+The ubeacon_updateUbikNetworkAddress() prototype does not match the
+function definition. The ubik_host parameter is declared as an unbounded
+array in the prototype but is defined as a bounded array. As of GCC 12,
+a warning is issued for the mismatch:
+
+    error: argument 1 of type ‘afs_uint32[256]’ {aka ‘unsigned int[256]’}
+           with mismatched bound [-Werror=array-parameter=]
+           ubeacon_updateUbikNetworkAddress(
+             afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR])
+
+    note: previously declared as ‘afs_uint32[]’ {aka ‘unsigned int[]’}
+          extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[]);
+
+Restore the ubik_host array length in the function prototype, which was
+dropped in commit 9020e6e2f0357b1082705dcaa6626573433969ec (ubik: Defer
+updateUbikNetworkAddress until after RX startup).
+
+Change-Id: I8189effc5b68ef8c1b45b4107f5e22e44ecf59fd
+Reviewed-on: https://gerrit.openafs.org/14767
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+---
+
+diff --git a/src/ubik/ubik.p.h b/src/ubik/ubik.p.h
+index cfd12f7..52869ad 100644
+--- a/src/ubik/ubik.p.h
++++ b/src/ubik/ubik.p.h
+@@ -492,7 +492,7 @@
+ 					char clones[]);
+ extern int ubeacon_InitServerList(afs_uint32 ame, afs_uint32 aservers[]);
+ extern void *ubeacon_Interact(void *);
+-extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[]);
++extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR]);
+ extern struct beacon_data beacon_globals;
+ extern struct addr_data addr_globals;
+ 
+From 4a8d0c4089078fb3df9cc06b595c80c9b4c2ca7f Mon Sep 17 00:00:00 2001
+From: Michael Meffie <mmeffie@sinenomine.net>
+Date: Mon, 23 Aug 2021 15:42:52 -0400
+Subject: [PATCH] libadmin: Fix isAlias may be uninitialized warning
+
+The cfgutil_HostNameIsAlias() function has an output parameter called
+isAlias, which is used when cfgutil_HostIsAlias() returns non-zero.
+However, it possible for isAlias to not be set before returning. GCC 12
+issues a warning about the possible use of the uninitialized isAlias
+variable:
+
+    cfginternal.c:366:32: error: ‘isAlias’ may be used uninitialized
+       [-Werror=maybe-uninitialized]
+
+Initialize the cfgutil_HostNameIsAlias() isAlias output flag to false.
+Also, fix the misleading code indentation around the
+cfgutil_HostNameIsAlias() call.
+
+Change-Id: I68e66ae5f9019a613187321bb792d0505959ed30
+Reviewed-on: https://gerrit.openafs.org/14772
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+---
+
+diff --git a/src/libadmin/cfg/cfginternal.c b/src/libadmin/cfg/cfginternal.c
+index 1f581b8..f1abacb 100644
+--- a/src/libadmin/cfg/cfginternal.c
++++ b/src/libadmin/cfg/cfginternal.c
+@@ -348,7 +348,7 @@
+ 		short dbhostFound = 0;
+ 
+ 		while (!dbhostDone) {
+-		    short isAlias;
++		    short isAlias = 0;
+ 
+ 		    if (!bos_HostGetNext(dbIter, hostNameAlias, &tst2)) {
+ 			/* no more entries (or failure) */
+@@ -357,15 +357,15 @@
+ 			}
+ 			dbhostDone = 1;
+ 
+-		    } else
+-			if (!cfgutil_HostNameIsAlias
+-			    (hostName, hostNameAlias, &isAlias, &tst2)) {
+-			tst = tst2;
+-			dbhostDone = 1;
+-
+-		    } else if (isAlias) {
+-			dbhostFound = 1;
+-			dbhostDone = 1;
++		    } else {
++			if (!cfgutil_HostNameIsAlias(hostName, hostNameAlias,
++						     &isAlias, &tst2)) {
++			    tst = tst2;
++			    dbhostDone = 1;
++			} else if (isAlias) {
++			    dbhostFound = 1;
++			    dbhostDone = 1;
++			}
+ 		    }
+ 		}
+ 
+From 7924aecf95bf4918a485a041f2426bd1fa407ac8 Mon Sep 17 00:00:00 2001
+From: Michael Meffie <mmeffie@sinenomine.net>
+Date: Fri, 03 Sep 2021 07:05:36 -0400
+Subject: [PATCH] ptserver: Fix CreateEntry() stringop-overflow warnings
+
+The CreateEntry() prototype has been fixed to match the function
+definition, so callers are expected to provide bounded arrays for the
+user or group name. Fix the InitialGroup() macro which is used to set
+the built-in names using string literal to avoid stringop-overflow
+warnings.
+
+    error: ‘CreateEntry’ accessing 64 bytes in a region of size 22 [-Werror=stringop-overflow=]
+            code = CreateEntry(tt, (name), &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \
+
+    note: in expansion of macro ‘InitialGroup’
+           InitialGroup(SYSADMINID, "system:administrators");
+    note: referencing argument 2 of type ‘char *’
+    note: in a call to function ‘CreateEntry’
+            CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ...
+
+    (Repeated for "system:backup", "system:anyuser", "system:authuser",
+    "system:ptsviewers", and "anonymous".)
+
+Change-Id: I7a37d4c8e191ffff52c2fdc1ed3783f4c3592b11
+Reviewed-on: https://gerrit.openafs.org/14789
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: Benjamin Kaduk <kaduk@mit.edu>
+---
+
+diff --git a/src/ptserver/ptutils.c b/src/ptserver/ptutils.c
+index dfa54ee..07fd220 100644
+--- a/src/ptserver/ptutils.c
++++ b/src/ptserver/ptutils.c
+@@ -1847,8 +1847,15 @@
+ #define InitialGroup(id,name) do {    \
+     afs_int32 temp = (id);		      \
+     afs_int32 flag = (id) < 0 ? PRGRP : 0; \
++    char tname[PR_MAXNAMELEN]; \
++    if (strlcpy(tname, (name), sizeof(tname)) >= sizeof(tname)) { \
++	code = PRBADNAM; \
++	afs_com_err (whoami, code, "name too long %s", (name)); \
++	ubik_AbortTrans(tt);	      \
++	return code;		      \
++    } \
+     code = CreateEntry		      \
+-	(tt, (name), &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \
++	(tt, tname, &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \
+     if (code) {			      \
+ 	afs_com_err (whoami, code, "couldn't create %s with id %di.", 	\
+ 		 (name), (id));	      \
+From 92a6242de2d8ea280debc283a7c089f97c1670bc Mon Sep 17 00:00:00 2001
+From: Michael Meffie <mmeffie@sinenomine.net>
+Date: Mon, 23 Aug 2021 15:37:13 -0400
+Subject: [PATCH] bucoord: Fix doDispatch() array-parameter gcc warning
+
+The doDispatch() prototype does not match the function definition. The
+targv parameter is declared as an unbounded array in the prototype, but
+is defined as a bounded array. As of GCC 12, a warning is issued for the
+mismatch.
+
+    main.c:346:18: error: argument 2 of type ‘char *[100]’ with
+      mismatched bound [-Werror=array-parameter=]
+    bucoord_internal.h:123:40: note: previously declared as ‘char *[]’
+
+Within doDispatch(), the targv argument is just passed to cmd_Dispatch()
+(this is the only use of targv). Since cmd_Displatch() expects an
+unbounded array, update the doDispatch() definition to match the
+prototype.
+
+Change-Id: I50a170b3490d0d4e5d971b9ccb483cccb6833686
+Reviewed-on: https://gerrit.openafs.org/14771
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+---
+
+diff --git a/src/bucoord/main.c b/src/bucoord/main.c
+index a453cc9..972ac2d 100644
+--- a/src/bucoord/main.c
++++ b/src/bucoord/main.c
+@@ -343,7 +343,7 @@
+ 
+ afs_int32
+ doDispatch(afs_int32 targc,
+-	   char *targv[MAXV],
++	   char *targv[],
+ 	   afs_int32 dispatchCount) /* to prevent infinite recursion */
+ {
+     char *sargv[MAXV];
+From a1e57d2e42b6d01e5ece93d5d49a4b9f3ecd3edc Mon Sep 17 00:00:00 2001
+From: Michael Meffie <mmeffie@sinenomine.net>
+Date: Mon, 23 Aug 2021 15:33:19 -0400
+Subject: [PATCH] Fix PrintInode() mismatched array parameter warnings
+
+The PrintInode() prototypes do not match the function definitions.
+
+When AFS_64BIT_IOPS_ENV is defined (which is the common case and is
+required for namei), the buffer parameter is declared as a bounded
+character array (afs_ino_str_t) in the prototype, but is defined as an
+unbounded character pointer.  When AFS_64BIT_IOPS_ENV is not defined
+(for legacy 32-bit inode vice partitions), PrintInode() is declared with
+no specified parameters.
+
+A static buffer is used to hold the formatted string when a NULL is
+passed as the first argument to PrintInode(). However, this method is
+only used by the volinfo and iopen utility programs.
+
+Fix the mismatch function prototypes and definitions to use the bounded
+char array (afs_ino_str_t) in all cases.  Remove the deprecated function
+declaration with no specified parameters. Update vol-info and iopen to
+pass an afs_ino_str_t buffer and remove the now unused static buffer.
+Update the duplicated PrintInode() function definition in namei_ops.c.
+(This duplicated code could be removed in a future commit.)
+
+Change-Id: I5c0128bb0d572dab0df637289daad0e648ad8a8f
+Reviewed-on: https://gerrit.openafs.org/14770
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+---
+
+diff --git a/src/sys/afssyscalls.c b/src/sys/afssyscalls.c
+index 8291a46..b248e69 100644
+--- a/src/sys/afssyscalls.c
++++ b/src/sys/afssyscalls.c
+@@ -281,23 +281,16 @@
+ }
+ 
+ 
+-/* PrintInode
++/**
++ * Format a string to print either 32 or 64 bit inode numbers.
+  *
+- * returns a static string used to print either 32 or 64 bit inode numbers.
++ * @param[out]  s    string buffer
++ * @param[in]   ino  inode number
++ * @returns pointer to formatted inode number string
+  */
+-#ifdef AFS_64BIT_IOPS_ENV
+-char *
+-PrintInode(char *s, Inode ino)
+-#else
+ char *
+ PrintInode(afs_ino_str_t s, Inode ino)
+-#endif
+ {
+-    static afs_ino_str_t result;
+-
+-    if (!s)
+-	s = result;
+-
+ #ifdef AFS_64BIT_IOPS_ENV
+     (void)sprintf((char *)s, "%llu", ino);
+ #else
+diff --git a/src/sys/afssyscalls.h b/src/sys/afssyscalls.h
+index df37c42..ea74bcd 100644
+--- a/src/sys/afssyscalls.h
++++ b/src/sys/afssyscalls.h
+@@ -88,14 +88,9 @@
+ #define AFS_INO_STR_LENGTH 32
+ typedef char afs_ino_str_t[AFS_INO_STR_LENGTH];
+ 
+-/* Print either 32 or 64 bit inode numbers. char * may be NULL. In which case
+- * a local statis is returned.
++/* Format either 32 or 64 bit inode numbers.
+  */
+-#ifdef AFS_64BIT_IOPS_ENV
+-extern char *PrintInode(afs_ino_str_t, Inode);
+-#else
+-extern char *PrintInode();
+-#endif
++extern char *PrintInode(afs_ino_str_t s, Inode ino) AFS_NONNULL((1));
+ 
+ /* Some places in the code assume icreate can return 0 when there's
+  * an error.
+diff --git a/src/sys/iopen.c b/src/sys/iopen.c
+index 7c1a961..b9cd3d6 100644
+--- a/src/sys/iopen.c
++++ b/src/sys/iopen.c
+@@ -37,6 +37,7 @@
+     int fd, n;
+     struct stat status;
+     Inode ino;
++    afs_ino_str_t inode_str;
+ 
+     if (argc != 3)
+ 	Usage();
+@@ -54,7 +55,7 @@
+     }
+     printf("ino=%" AFS_INT64_FMT "\n", ino);
+     printf("About to iopen(dev=(%d,%d), inode=%s, mode=%d\n",
+-	   major(status.st_dev), minor(status.st_dev), PrintInode(NULL, ino),
++	   major(status.st_dev), minor(status.st_dev), PrintInode(inode_str, ino),
+ 	   O_RDONLY);
+     fflush(stdout);
+     fd = IOPEN(status.st_dev, ino, O_RDONLY);
+diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c
+index 463b66b..d2f94bb 100644
+--- a/src/vol/namei_ops.c
++++ b/src/vol/namei_ops.c
+@@ -3275,19 +3275,17 @@
+     return code;
+ }
+ 
+-/* PrintInode
++/**
++ * Format a string to print inode numbers.
+  *
+- * returns a static string used to print either 32 or 64 bit inode numbers.
++ * @param[out]  s    string buffer
++ * @param[in]   ino  inode number
++ * @returns pointer to formatted inode number string
+  */
+ char *
+-PrintInode(char *s, Inode ino)
++PrintInode(afs_ino_str_t s, Inode ino)
+ {
+-    static afs_ino_str_t result;
+-    if (!s)
+-	s = result;
+-
+     snprintf(s, sizeof(afs_ino_str_t), "%llu", (afs_uintmax_t) ino);
+-
+     return s;
+ }
+ 
+diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c
+index 22ac94a..6423fa8 100644
+--- a/src/vol/vol-info.c
++++ b/src/vol/vol-info.c
+@@ -331,6 +331,7 @@
+     struct versionStamp *vsn;
+     int bad = 0;
+     int code;
++    afs_ino_str_t inode_str;
+ 
+     vsn = (struct versionStamp *)to;
+ 
+@@ -341,7 +342,7 @@
+     if (vsn->magic != magic) {
+ 	bad++;
+ 	fprintf(stderr, "%s: Inode %s: Bad magic %x (%x): IGNORED\n",
+-		progname, PrintInode(NULL, ih->ih_ino), vsn->magic, magic);
++		progname, PrintInode(inode_str, ih->ih_ino), vsn->magic, magic);
+     }
+ 
+     /* Check is conditional, in case caller wants to inspect version himself */
+@@ -349,23 +350,23 @@
+ 	bad++;
+ 	fprintf(stderr, "%s: Inode %s: Bad version %x (%x): IGNORED\n",
+ 		progname,
+-		PrintInode(NULL, ih->ih_ino), vsn->version, version);
++		PrintInode(inode_str, ih->ih_ino), vsn->version, version);
+     }
+     if (bad && opt->fixHeader) {
+ 	vsn->magic = magic;
+ 	vsn->version = version;
+ 	printf("Special index inode %s has a bad header. Reconstructing...\n",
+-	       PrintInode(NULL, ih->ih_ino));
++	       PrintInode(inode_str, ih->ih_ino));
+ 	code = IH_IWRITE(ih, 0, to, size);
+ 	if (code != size) {
+ 	    fprintf(stderr,
+ 		    "%s: Write failed for inode %s; header left in damaged state\n",
+-		    progname, PrintInode(NULL, ih->ih_ino));
++		    progname, PrintInode(inode_str, ih->ih_ino));
+ 	}
+     }
+     if (!bad && opt->dumpInfo) {
+ 	printf("Inode %s: Good magic %x and version %x\n",
+-	       PrintInode(NULL, ih->ih_ino), magic, version);
++	       PrintInode(inode_str, ih->ih_ino), magic, version);
+     }
+     return 0;
+ }
+@@ -887,6 +888,7 @@
+     afs_sfsize_t size = -1;
+     IHandle_t *ih = NULL;
+     FdHandle_t *fdP = NULL;
++    afs_ino_str_t inode_str;
+ #ifdef AFS_NAMEI_ENV
+     namei_t filename;
+ #endif /* AFS_NAMEI_ENV */
+@@ -912,7 +914,7 @@
+ 
+   error:
+     if (opt->dumpInfo) {
+-	printf("\t%s inode\t= %s (size = ", name, PrintInode(NULL, inode));
++	printf("\t%s inode\t= %s (size = ", name, PrintInode(inode_str, inode));
+ 	if (size != -1) {
+ 	    printf("%lld)\n", size);
+ 	} else {
+@@ -1241,6 +1243,7 @@
+     afs_foff_t total;
+     ssize_t len;
+     Inode ino = VNDISK_GET_INO(vdp->vnode);
++    afs_ino_str_t inode_str;
+ 
+     if (!VALID_INO(ino)) {
+ 	return;
+@@ -1251,10 +1254,10 @@
+     if (fdP == NULL) {
+ 	fprintf(stderr,
+ 		"%s: Can't open inode %s error %d (ignored)\n",
+-		progname, PrintInode(NULL, ino), errno);
++		progname, PrintInode(inode_str, ino), errno);
+ 	return;
+     }
+-    snprintf(nfile, sizeof nfile, "TmpInode.%s", PrintInode(NULL, ino));
++    snprintf(nfile, sizeof nfile, "TmpInode.%s", PrintInode(inode_str, ino));
+     ofd = afs_open(nfile, O_CREAT | O_RDWR | O_TRUNC, 0600);
+     if (ofd < 0) {
+ 	fprintf(stderr,
+@@ -1276,7 +1279,7 @@
+ 	    unlink(nfile);
+ 	    fprintf(stderr,
+ 		    "%s: Error while reading from inode %s (%d)\n",
+-		    progname, PrintInode(NULL, ino), errno);
++		    progname, PrintInode(inode_str, ino), errno);
+ 	    return;
+ 	}
+ 	if (len == 0)
+@@ -1299,7 +1302,7 @@
+     IH_RELEASE(ih);
+     close(ofd);
+     printf("... Copied inode %s to file %s (%lu bytes)\n",
+-	   PrintInode(NULL, ino), nfile, (unsigned long)total);
++	   PrintInode(inode_str, ino), nfile, (unsigned long)total);
+ }
+ 
+ /**
+@@ -1812,6 +1815,7 @@
+     VnodeDiskObject *vnode = vdp->vnode;
+     afs_fsize_t fileLength;
+     Inode ino;
++    afs_ino_str_t inode_str;
+ 
+     ino = VNDISK_GET_INO(vnode);
+     VNDISK_GET_LEN(fileLength, vnode);
+@@ -1828,7 +1832,7 @@
+ 	 vnode->dataVersion, vnode->cloned, (afs_uintmax_t) fileLength,
+ 	 vnode->linkCount, vnode->parent);
+     if (opt->dumpInodeNumber)
+-	printf(" inode: %s", PrintInode(NULL, ino));
++	printf(" inode: %s", PrintInode(inode_str, ino));
+     if (opt->dumpDate)
+ 	printf(" ServerModTime: %s", date(vnode->serverModifyTime));
+ #if defined(AFS_NAMEI_ENV)
+From a3aac5106beddc5a6f7a09c2d21c2524342aca01 Mon Sep 17 00:00:00 2001
+From: Michael Meffie <mmeffie@sinenomine.net>
+Date: Mon, 23 Aug 2021 19:43:45 -0400
+Subject: [PATCH] pts: Fix stringop-overflow warnings
+
+The ptutil functions are defined to accept bounded character arrays for
+user and group names. As of GCC 11, callers which provide the names as
+string literals now trigger the stringop-overflow warning, since the
+regions provided by the string literals are smaller than the bounded
+areas.
+
+    error: ‘pr_ChangeEntry’ accessing 64 bytes in a region of size 1
+           [-Werror=stringop-overflow=]
+    note: referencing argument 4 of type ‘char *’
+
+    error: ‘pr_IsAMemberOf’ accessing 64 bytes in a region of size 22
+           [-Werror=stringop-overflow=]
+    note: referencing argument 2 of type ‘char *’
+
+    error: ‘pr_CreateUser’ accessing 64 bytes in a region of size 16
+           [-Werror=stringop-overflow=]
+    note: referencing argument 1 of type ‘char *’
+
+    error: ‘pr_Delete’ accessing 64 bytes in a region of size 16
+           [-Werror=stringop-overflow=]
+    note: referencing argument 1 of type ‘char *’
+
+Update the callers in pts and testpt which pass literal strings. Instead
+of passing char pointers to literal strings, assign the strings to
+prname buffers and pass the prname buffers to the pr utility functions.
+
+Change-Id: I7d8c67aa28d21bb6889ef92a2193a77b54c83cb1
+Reviewed-on: https://gerrit.openafs.org/14769
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+---
+
+diff --git a/src/ptserver/pts.c b/src/ptserver/pts.c
+index e749714..90d6f16 100644
+--- a/src/ptserver/pts.c
++++ b/src/ptserver/pts.c
+@@ -663,6 +663,7 @@
+     idlist ids;
+     idlist lids;
+     struct prcheckentry aentry;
++    prname admins = "system:administrators";
+ 
+     if (GetNameOrId(as, &ids, &names))
+ 	return PRBADARG;
+@@ -728,7 +729,7 @@
+ 	}
+ 	if (aentry.id == SYSADMINID)
+ 	    admin = 1;
+-	else if (!pr_IsAMemberOf(aentry.name, "system:administrators", &flag)) {
++	else if (!pr_IsAMemberOf(aentry.name, admins, &flag)) {
+ 	    if (flag)
+ 		admin = 1;
+ 	}
+@@ -791,11 +792,12 @@
+ {
+     afs_int32 code;
+     char *name;
++    prname newname = "";
+     char *owner;
+ 
+     name = as->parms[0].items->data;
+     owner = as->parms[1].items->data;
+-    code = pr_ChangeEntry(name, "", 0, owner);
++    code = pr_ChangeEntry(name, newname, 0, owner);
+     if (code)
+ 	afs_com_err(whoami, code, "; unable to change owner of %s to %s", name,
+ 		owner);
+@@ -808,10 +810,11 @@
+     afs_int32 code;
+     char *oldname;
+     char *newname;
++    prname owner = "";
+ 
+     oldname = as->parms[0].items->data;
+     newname = as->parms[1].items->data;
+-    code = pr_ChangeEntry(oldname, newname, 0, "");
++    code = pr_ChangeEntry(oldname, newname, 0, owner);
+     if (code)
+ 	afs_com_err(whoami, code, "; unable to change name of %s to %s", oldname,
+ 		newname);
+diff --git a/src/ptserver/testpt.c b/src/ptserver/testpt.c
+index eaaee48..c359f8f 100644
+--- a/src/ptserver/testpt.c
++++ b/src/ptserver/testpt.c
+@@ -217,7 +217,7 @@
+ CreateUser(int u)
+ {
+     afs_int32 code;
+-    char name[16];
++    prname name;
+     afs_int32 id;
+ 
+     sprintf(name, "%s%d", createPrefix, u);
+From fe64ddd3b49bf15222d32d443ff226dd4c2b899e Mon Sep 17 00:00:00 2001
+From: Michael Meffie <mmeffie@sinenomine.net>
+Date: Tue, 24 Aug 2021 16:40:22 -0400
+Subject: [PATCH] ptserver: Fix CreateEntry() mismatched array parameter warning
+
+The CreateEntry() prototype does not match the function definition. The
+aname parameter is declared as an unbounded array in the prototype but
+is defined as a bounded array. As of GCC 12, a warning is issued for the
+mismatch.
+
+    error: argument 2 of type ‘char[64]’ with mismatched bound
+           [-Werror=array-parameter=]
+           CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ...
+
+    note: previously declared as ‘char[]’
+          extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[], ...
+
+Fix the prototype to declare the 'aname' parameter as a bounded array as
+expected for this function.
+
+Change-Id: I6d4dadcdd3f80c2b6f1b17670bbbc1e9e6076559
+Reviewed-on: https://gerrit.openafs.org/14768
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+---
+
+diff --git a/src/ptserver/ptprototypes.h b/src/ptserver/ptprototypes.h
+index c6a9dab..bb21b6b 100644
+--- a/src/ptserver/ptprototypes.h
++++ b/src/ptserver/ptprototypes.h
+@@ -72,7 +72,7 @@
+ 			    afs_int32 loc, afs_int32 aid);
+ extern int AccessOK(struct ubik_trans *ut, afs_int32 cid,
+ 		    struct prentry *tentry, int mem, int any);
+-extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[],
++extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN],
+ 			     afs_int32 *aid, afs_int32 idflag,
+ 			     afs_int32 flag, afs_int32 oid, afs_int32 creator);
+ extern afs_int32 RemoveFromEntry(struct ubik_trans *at, afs_int32 aid,
diff --git a/kmp_only.files b/kmp_only.files
new file mode 100644
index 0000000..8dde769
--- /dev/null
+++ b/kmp_only.files
@@ -0,0 +1,99 @@
+/usr/bin/aklog
+/usr/bin/fs
+/usr/bin/klog.krb5
+/usr/bin/pagsh
+/usr/bin/pagsh.krb
+/usr/bin/tokens
+/usr/bin/tokens.krb
+/usr/bin/unlog
+/usr/bin/up
+/usr/lib/firewalld/services/afs3-callback.xml
+/usr/lib/firewalld/services/afs3-rmtsys.xml
+/usr/sbin/afsd
+/usr/sbin/fstrace
+/usr/share/man/man1/aklog.1
+/usr/share/man/man1/copyauth.1
+/usr/share/man/man1/fs.1
+/usr/share/man/man1/fs_apropos.1
+/usr/share/man/man1/fs_bypassthreshold.1
+/usr/share/man/man1/fs_checkservers.1
+/usr/share/man/man1/fs_checkvolumes.1
+/usr/share/man/man1/fs_chgrp.1
+/usr/share/man/man1/fs_chown.1
+/usr/share/man/man1/fs_cleanacl.1
+/usr/share/man/man1/fs_copyacl.1
+/usr/share/man/man1/fs_cscpolicy.1
+/usr/share/man/man1/fs_discon.1
+/usr/share/man/man1/fs_diskfree.1
+/usr/share/man/man1/fs_examine.1
+/usr/share/man/man1/fs_exportafs.1
+/usr/share/man/man1/fs_flush.1
+/usr/share/man/man1/fs_flushall.1
+/usr/share/man/man1/fs_flushmount.1
+/usr/share/man/man1/fs_flushvolume.1
+/usr/share/man/man1/fs_getcacheparms.1
+/usr/share/man/man1/fs_getcalleraccess.1
+/usr/share/man/man1/fs_getcellstatus.1
+/usr/share/man/man1/fs_getclientaddrs.1
+/usr/share/man/man1/fs_getcrypt.1
+/usr/share/man/man1/fs_getfid.1
+/usr/share/man/man1/fs_getserverprefs.1
+/usr/share/man/man1/fs_getverify.1
+/usr/share/man/man1/fs_help.1
+/usr/share/man/man1/fs_listacl.1
+/usr/share/man/man1/fs_listaliases.1
+/usr/share/man/man1/fs_listcells.1
+/usr/share/man/man1/fs_listquota.1
+/usr/share/man/man1/fs_lsmount.1
+/usr/share/man/man1/fs_memdump.1
+/usr/share/man/man1/fs_messages.1
+/usr/share/man/man1/fs_minidump.1
+/usr/share/man/man1/fs_mkmount.1
+/usr/share/man/man1/fs_monitor.1
+/usr/share/man/man1/fs_newalias.1
+/usr/share/man/man1/fs_newcell.1
+/usr/share/man/man1/fs_nukenfscreds.1
+/usr/share/man/man1/fs_precache.1
+/usr/share/man/man1/fs_quota.1
+/usr/share/man/man1/fs_rmmount.1
+/usr/share/man/man1/fs_rxstatpeer.1
+/usr/share/man/man1/fs_rxstatproc.1
+/usr/share/man/man1/fs_setacl.1
+/usr/share/man/man1/fs_setcachesize.1
+/usr/share/man/man1/fs_setcbaddr.1
+/usr/share/man/man1/fs_setcell.1
+/usr/share/man/man1/fs_setclientaddrs.1
+/usr/share/man/man1/fs_setcrypt.1
+/usr/share/man/man1/fs_setquota.1
+/usr/share/man/man1/fs_setserverprefs.1
+/usr/share/man/man1/fs_setverify.1
+/usr/share/man/man1/fs_setvol.1
+/usr/share/man/man1/fs_storebehind.1
+/usr/share/man/man1/fs_sysname.1
+/usr/share/man/man1/fs_trace.1
+/usr/share/man/man1/fs_uuid.1
+/usr/share/man/man1/fs_whereis.1
+/usr/share/man/man1/fs_whichcell.1
+/usr/share/man/man1/fs_wscell.1
+/usr/share/man/man1/klog.krb5.1
+/usr/share/man/man1/pagsh.1
+/usr/share/man/man1/pagsh.krb.1
+/usr/share/man/man1/tokens.1
+/usr/share/man/man1/tokens.krb.1
+/usr/share/man/man1/unlog.1
+/usr/share/man/man1/up.1
+/usr/share/man/man5/afs_cache.5
+/usr/share/man/man5/afszcm.cat.5
+/usr/share/man/man5/cacheinfo.5
+/usr/share/man/man8/afsd.8
+/usr/share/man/man8/fstrace.8
+/usr/share/man/man8/fstrace_apropos.8
+/usr/share/man/man8/fstrace_clear.8
+/usr/share/man/man8/fstrace_dump.8
+/usr/share/man/man8/fstrace_help.8
+/usr/share/man/man8/fstrace_lslog.8
+/usr/share/man/man8/fstrace_lsset.8
+/usr/share/man/man8/fstrace_setlog.8
+/usr/share/man/man8/fstrace_setset.8
+/usr/share/openafs/C/afszcm.cat
+
diff --git a/openafs-1.8.x.ncurses6.patch b/openafs-1.8.x.ncurses6.patch
deleted file mode 100644
index 7c86855..0000000
--- a/openafs-1.8.x.ncurses6.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/src/cf/curses.m4.orig	2018-01-07 08:17:41.815732371 +0100
-+++ b/src/cf/curses.m4	2018-01-07 08:23:50.585670554 +0100
-@@ -19,7 +19,9 @@
-     AC_CHECK_LIB([ncurses], [initscr],
- 		 [AC_CHECK_LIB([ncurses], [LINES], [openafs_cv_curses_lib=-lncurses],
- 			       [AC_CHECK_LIB([tinfo], [LINES],
--					     [openafs_cv_curses_lib="-lncurses -ltinfo"])])])
-+					     [openafs_cv_curses_lib="-lncurses -ltinfo"],  
-+		                             [AC_CHECK_LIB([ncurses], [_nc_LINES], [openafs_cv_curses_lib=-lncurses], 
-+                                                          [AC_CHECK_LIB([tinfo], [_nc_LINES], [openafs_cv_curses_lib="-lncurses -ltinfo"])])])])])
-     AS_IF([test "x$openafs_cv_curses_lib" = x],
- 	  [AC_CHECK_LIB([Hcurses], [initscr], [openafs_cv_curses_lib=-lHcurses])])
-     AS_IF([test "x$openafs_cv_curses_lib" = x],
diff --git a/openafs.changes b/openafs.changes
index 9428408..ff3b05f 100644
--- a/openafs.changes
+++ b/openafs.changes
@@ -1,4 +1,24 @@
 -------------------------------------------------------------------
+Wed Apr 20 06:24:41 UTC 2022 - Christof Hanke <christof.hanke@mpcdf.mpg.de>
+
+- apply patches marked for upcoming release:
+  * kernel 5.17: a714e86.diff and 449d1fa.diff
+  * gcc-11: gcc-11.diff 
+
+-------------------------------------------------------------------
+Mon Mar 28 20:27:18 UTC 2022 - Christof Hanke <christof.hanke@mpcdf.mpg.de>
+
+- do not create client-package without KMP 
+
+-------------------------------------------------------------------
+Mon Feb 21 10:48:51 UTC 2022 - Christof Hanke <christof.hanke@mpcdf.mpg.de>
+
+- remove patch dir_layout.patch
+  this can be done via environment-variables
+- replace openafs-1.8.x.ncurses6.patch with patch 4cf7a9a.diff.
+  4cf7a9a.diff is coming from upstream and will be incorporated at some point.
+
+-------------------------------------------------------------------
 Sun Jan 23 15:48:09 UTC 2022 - Christof Hanke <christof.hanke@mpcdf.mpg.de>
 
 - Update to new upstream release 1.8.8.1
diff --git a/openafs.spec b/openafs.spec
index 7350453..2c33b3d 100644
--- a/openafs.spec
+++ b/openafs.spec
@@ -21,7 +21,7 @@
 %if ! %{defined _fillupdir}
 %define _fillupdir /var/adm/fillup-templates
 %endif
-%define _lto_cflags %{nil} 
+%define _lto_cflags %{nil}
 
 #
 #	TUNABLES
@@ -36,7 +36,7 @@
 %define build_kernel_modules 1
 
 # flag for firewalld, only required for SLE-12
-%if 0%{?sle_version} <= 120500 && !0%{?is_opensuse} 
+%if 0%{?sle_version} <= 120500 && !0%{?is_opensuse}
 %define have_firewalld 0
 %else
 %define have_firewalld 1
@@ -100,16 +100,21 @@ Source55:       openafs.SuidCells
 Source56:       openafs.CellAlias
 Source57:       openafs.ThisCell
 Source58:       openafs.cacheinfo
+Source98:       kmp_only.files
 Source99:       openafs.changes
-# PATCH-SUSE-SPECIFIC use proper directory layout
-Patch3:         dir_layout.patch
+# PATCH-FIX-UPSTREAM KMP build
+Patch1:         a714e86.diff
+Patch2:         449d1fa.diff
+# PATCH-FIX-UPSTREAM use gcc-11
+Patch3:         gcc-11.diff
 # PATCH-FIX-UPSTREAM make configure detect ncurses 6 correctly
-Patch4:         openafs-1.8.x.ncurses6.patch
+Patch4:         4cf7a9a.diff
 
 #
 #	GENERAL BuildRequires and Requires
 #
 
+BuildRequires:  autoconf-archive
 BuildRequires:  automake
 BuildRequires:  bison
 BuildRequires:  coreutils
@@ -124,22 +129,16 @@ BuildRequires:  krb5-devel
 BuildRequires:  libtirpc-devel
 BuildRequires:  libtool
 BuildRequires:  ncurses-devel
-%if 0%{?suse_version} < 1120
-BuildRequires:  perl-macros
-%endif
 BuildRequires:  pkg-config
 BuildRequires:  swig
 
-%if 0%{?suse_version} < 1210
-Requires(post): %insserv_prereq
-%endif
 Requires(post): %fillup_prereq
 
-%if %{build_kernel_modules} 
+%if %{build_kernel_modules}
 BuildRequires:  %{kernel_module_package_buildreqs}
 %endif
 
-%description  
+%description
 AFS is a cross-platform distributed file system product pioneered at
 Carnegie Mellon University and supported and developed as a product by
 Transarc Corporation (now IBM Pittsburgh Labs). It offers a
@@ -266,8 +265,9 @@ independence, scalability, and transparent migration capabilities for
 data.
 
 This client is using the EXPERIMENTAL FUSE interface on LINUX.
-It does not offer authentication etc. 
+It does not offer authentication etc.
 
+%if %{build_kernel_modules}
 %package client
 Summary:        OpenAFS File System Client
 Group:          System/Filesystems
@@ -286,7 +286,7 @@ data.
 In addition, among its features are authentication, encryption,
 caching, disconnected operations, replication for higher availability
 and load balancing, and ACLs. This package contains the OpenAFS client.
-
+%endif
 
 %prep
 
@@ -308,17 +308,19 @@ and load balancing, and ACLs. This package contains the OpenAFS client.
 : @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
 for src_file in %{S:0}  %{S:1}; do
-    if [ "`md5sum $src_file | awk '{print $1}'`" != "`cat $src_file.md5 | awk '{print $1}'`" ]; then 
-        echo "ERROR: MD5-Integrity check for $src_file failed."; 
+    if [ "`md5sum $src_file | awk '{print $1}'`" != "`cat $src_file.md5 | awk '{print $1}'`" ]; then
+        echo "ERROR: MD5-Integrity check for $src_file failed.";
         exit 1
     fi
-    if [ "`sha256sum $src_file | awk '{print $1}'`" != "`cat $src_file.sha256 | awk '{print $1}'`" ]; then 
-        echo "ERROR: SHA256-Integrity check for $src_file failed."; 
+    if [ "`sha256sum $src_file | awk '{print $1}'`" != "`cat $src_file.sha256 | awk '{print $1}'`" ]; then
+        echo "ERROR: SHA256-Integrity check for $src_file failed.";
         exit 1
     fi
 done
 
 %setup -q -n openafs-%{upstream_version} -T -b 0 -b 1
+%patch1 -p1
+%patch2 -p1
 %patch3 -p1
 %patch4 -p1
 
@@ -354,11 +356,14 @@ perl -pi -e 's,^(XLIBS.*),\1 -lresolv,' src/config/Makefile.amd64_linux24.in
 afs_sysname=${sysbase}_linux26
 
 RPM_OPT_FLAGS=`echo ${RPM_OPT_FLAGS} | sed s/-D_FORTIFY_SOURCE=2//`
-export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC -fcommon" 
+export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -fPIC -fcommon"
 
 export KRB5LIBS='-lcom_err -lkrb5'
 export PATH_KRB5_CONFIG=%{krb5_config}
-
+export afsdbdir='/var/lib/openafs/db'
+export afslocaldir='/var/lib/openafs'
+export afslogsdir='/var/log/openafs'
+export afsdbdir='/var/lib/openafs/db'
 %configure \
     --disable-transarc-paths \
     --disable-pam \
@@ -393,17 +398,18 @@ for flavor in %flavors_to_build; do
     make
     popd
 done
-%endif # build_kernel_modules
+%endif
+# build_kernel_modules
 
 %install
 
 #
-# install build binaries using  make 
+# install build binaries using  make
 
 make DESTDIR=%{buildroot} install_nolibafs
 
 #
-# man-pages 
+# man-pages
 
 OLD_PWD=`pwd`
 cd doc/man-pages
@@ -424,34 +430,40 @@ mkdir -p %{buildroot}/%{_sbindir}
 
 #
 # client
-cp -a src/afsd/CellServDB %{buildroot}/%{viceetcdir}/CellServDB
-cp -a %{S:55} %{buildroot}/%{viceetcdir}/SuidCells
+# also used by others
 cp -a %{S:56} %{buildroot}/%{viceetcdir}/CellAlias
 cp -a %{S:57} %{buildroot}/%{viceetcdir}/ThisCell
+cp -a src/afsd/CellServDB %{buildroot}/%{viceetcdir}/CellServDB
+cp -a %{S:55} %{buildroot}/%{viceetcdir}/SuidCells
 cp -a %{S:58} %{buildroot}/%{viceetcdir}/cacheinfo
+
+# kmp-only
+%if %{build_kernel_modules}
 cp -a src/afs/afszcm.cat %{buildroot}%{_datadir}/openafs/C
 install -m 644 %{S:27} %{buildroot}/%{_fillupdir}/sysconfig.openafs-client
-%if 0%{?sle_version} > 150000 
+%if 0%{?sle_version} > 150000
 install -m 644 %{S:24} %{buildroot}/%_unitdir/openafs-client.service
 %else
 install -m 644 %{S:23} %{buildroot}/%_unitdir
 %endif
 ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rcopenafs-client
+%endif
 
 #
 # fuse client package
+
 install -m 644 %{S:29} %{buildroot}/%{_fillupdir}/sysconfig.openafs-fuse-client
 install -m 644 %{S:26} %{buildroot}/%_unitdir
 ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rcopenafs-fuse-client
 
-# 
+#
 # server
 install -m 644 %{S:28} %{buildroot}/%{_fillupdir}/sysconfig.openafs-server
 install -m 644 %{S:25} %{buildroot}/%_unitdir
 ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rcopenafs-server
 
 #
-# kernel-source 
+# kernel-source
 mkdir -p %{buildroot}/usr/src/kernel-modules/openafs
 chmod -R o-w src/libafs
 chmod -R o-w libafs_tree
@@ -475,6 +487,7 @@ done
 cp -a %{S:10} README.SUSE
 cp -a %{S:18} RELNOTES
 cp -a %{S:19} ChangeLog
+
 mkdir -p %{buildroot}/etc/ld.so.conf.d
 echo %{_libdir}/openafs > %{buildroot}/etc/ld.so.conf.d/openafs.conf
 
@@ -487,11 +500,11 @@ mv %{buildroot}/%{_bindir}/udebug %{buildroot}/%{_sbindir}/udebug
 # avoid conflicts with other packages by adding the prefix afs_ to filenames
 mv %{buildroot}%{_bindir}/scout %{buildroot}%{_bindir}/afs_scout
 cat %{buildroot}/%{_mandir}/man1/scout.1 | sed 's/\<scout\>/afs_scout/g' > %{buildroot}/%{_mandir}/man1/afs_scout.1
-rm %{buildroot}/%{_mandir}/man1/scout.1 
+rm %{buildroot}/%{_mandir}/man1/scout.1
 mv %{buildroot}%{_sbindir}/backup %{buildroot}%{_sbindir}/afs_backup
 OLD_PWD=`pwd`
 cd %{buildroot}/%{_mandir}/man8/
-for f in $(ls backup*); do 
+for f in $(ls backup*); do
     cat $f | sed 's/\<backup\>/afs_backup/g' > afs_"$f"
     rm $f
 done
@@ -533,7 +546,7 @@ install -D -m 644 %{S:47} %{buildroot}%{_prefix}/lib/firewalld/services/
 # we supposedly don't need this on linux
 rm %{buildroot}/%{_sbindir}/rmtsysd
 
-%if %{build_authlibs} == 0
+%if ! %{build_authlibs}
 rm %{buildroot}/%{_libdir}/libafsauthent.so.*
 rm %{buildroot}/%{_libdir}/libafsrpc.so.*
 rm %{buildroot}/%{_libdir}/libkopenafs.so.*
@@ -541,6 +554,11 @@ rm %{buildroot}/%{_libdir}/libafsauthent.so
 rm %{buildroot}/%{_libdir}/libafsrpc.so
 rm %{buildroot}/%{_libdir}/libkopenafs.so
 %endif
+%if ! %{build_kernel_modules}
+for f in $(cat %{S:98}); do
+    rm -f %{buildroot}/$f
+done
+%endif
 
 # remove all static libraries
 find %{buildroot} -type f -name "*.a" -delete
@@ -562,7 +580,7 @@ for d in %{buildroot}%{_mandir}/man*; do
             mv $f $f.gz
         elif [ -f $f ];then
             gzip -9 $f
-        else 
+        else
             echo "Unknown thing to compress : $f"
         fi
     done
@@ -628,6 +646,7 @@ fi
 #
 # client
 
+%if %{build_kernel_modules}
 %pre client
 %service_add_pre openafs-client.service
 
@@ -650,9 +669,9 @@ fi
 if [ $my_operation -gt 1 ]; then
     echo Not stopping the possibly running client.
     echo You must restart the client to put the upgrade into effect.
-else 
+else
     echo For configuring the client, please check /etc/sysconfig/openafs-client
-    echo and/or follow the instructions found on http://www.openafs.org  how to install an openafs-client. 
+    echo and/or follow the instructions found on http://www.openafs.org  how to install an openafs-client.
 fi
 
 %preun client
@@ -665,6 +684,7 @@ if [ -d /afs ]; then
 fi
 /sbin/ldconfig
 %service_del_postun openafs-client.service
+%endif
 
 #
 # server
@@ -683,11 +703,11 @@ if [ "$FIRST_ARG" -gt 1 ]; then
     echo You must restart the service to put the upgrade into effect.
     if [ -d /var/openafs ]; then
          echo To upgrade, stop the server, copy the contents of /var/openafs to /var/lib/openafs,
-         echo remove the empty directory /var/openafs and then start the server again. 
+         echo remove the empty directory /var/openafs and then start the server again.
     fi
-else 
+else
     echo For configuring the server, please check /etc/sysconfig/openafs-server
-    echo and/or follow the instructions found on http://www.openafs.org to install an openafs-client. 
+    echo and/or follow the instructions found on http://www.openafs.org to install an openafs-client.
 fi
 
 %preun server
@@ -718,7 +738,7 @@ fi
 #	FILES
 #
 
-%files           
+%files
 %defattr(-,root,root)
 %config /etc/ld.so.conf.d/openafs.conf
 %config(noreplace) %{viceetcdir}/CellAlias
@@ -729,7 +749,7 @@ fi
 %doc %{_mandir}/man1/afs.1.gz
 %doc %{_mandir}/man1/afs_compile_et.1.gz
 %doc %{_mandir}/man1/afs_scout.1.gz
-%doc %{_mandir}/man1/afsmonitor.1.gz 
+%doc %{_mandir}/man1/afsmonitor.1.gz
 %doc %{_mandir}/man1/cmdebug.1.gz
 %doc %{_mandir}/man1/pts.1.gz
 %doc %{_mandir}/man1/pts_*.gz
@@ -801,13 +821,14 @@ fi
 %{_fillupdir}/sysconfig.openafs-fuse-client
 %{vicecachedir}
 
+%if %{build_kernel_modules}
 %files client
 %defattr(-,root,root)
  %{_bindir}/fs
  %{_bindir}/aklog
  %{_bindir}/klog.krb5
  %{_bindir}/pagsh
- %{_bindir}/pagsh.krb	
+ %{_bindir}/pagsh.krb
  %{_bindir}/tokens
  %{_bindir}/tokens.krb
  %{_bindir}/unlog
@@ -846,8 +867,9 @@ fi
 %{_prefix}/lib/firewalld/services/afs3-callback.xml
 %{_prefix}/lib/firewalld/services/afs3-rmtsys.xml
 %endif
+%endif
 
-%files server 
+%files server
 %defattr(-,root,root)
 %attr(770,root,root) %dir %{afslocaldir}
 %attr(775,root,root) %dir %{afslogsdir}
@@ -922,11 +944,11 @@ fi
 %{_sbindir}/bos_util
 %{_sbindir}/bosserver
 %{_sbindir}/dafssync-debug
-%{_sbindir}/fssync-debug 
+%{_sbindir}/fssync-debug
 %{_sbindir}/prdb_check
 %{_sbindir}/pt_util
-%{_sbindir}/salvsync-debug 
-%{_sbindir}/state_analyzer 
+%{_sbindir}/salvsync-debug
+%{_sbindir}/state_analyzer
 %{_sbindir}/vldb_check
 %{_sbindir}/vldb_convert
 %{_sbindir}/voldump
@@ -938,7 +960,7 @@ fi
 %if %{have_firewalld}
 %dir %{_prefix}/lib/firewalld
 %dir %{_prefix}/lib/firewalld/services
-%{_prefix}/lib/firewalld/services/afs3-bos.xml  
+%{_prefix}/lib/firewalld/services/afs3-bos.xml
 %{_prefix}/lib/firewalld/services/afs3-fileserver.xml
 %{_prefix}/lib/firewalld/services/afs3-prserver.xml
 %{_prefix}/lib/firewalld/services/afs3-update.xml
@@ -946,7 +968,7 @@ fi
 %{_prefix}/lib/firewalld/services/afs3-volser.xml
 %endif
 
-%files devel  
+%files devel
 %defattr(-,root,root)
 %dir %{_libdir}/openafs
 %doc %{_mandir}/man1/livesys.1.gz
@@ -961,7 +983,7 @@ fi
 %dir %{perl_vendorlib}/AFS
 %{perl_vendorlib}/AFS/ukernel.pm
 
-%files  kernel-source 
+%files  kernel-source
 %defattr(-,root,root)
 %dir /usr/src/kernel-modules
 %dir /usr/src/kernel-modules/openafs