1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

net/samba416: fix rl_completion_func_t detection and usage

After a recent devel/readline update, net/samba416 fails to compile with
clang 19, resulting in errors similar to:

  ../../libcli/smbreadline/smbreadline.c:139:38: warning: 'CPPFunction' is deprecated [-Wdeprecated-declarations]
    139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
        |                                                    ^
  ../../lib/replace/system/readline.h:50:31: note: expanded from macro 'RL_COMPLETION_CAST'
     50 | #  define RL_COMPLETION_CAST (CPPFunction *)
        |                               ^
  /usr/local/include/readline/rltypedefs.h:38:50: note: 'CPPFunction' has been explicitly marked deprecated here
     38 | typedef char **CPPFunction (void) __attribute__((deprecated));
        |                                                  ^
  ../../libcli/smbreadline/smbreadline.c:139:36: error: incompatible function pointer types assigning to 'rl_completion_func_t *' (aka 'char **(*)(const char *, int, int)') from 'CPPFunction *' (aka 'char **(*)(void)') [-Wincompatible-function-pointer-types]
    139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
        |                                                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are two reasons: samba checks for `rl_completion_t`, while the
actual readline type is `rl_completion_func_t`, and samba's wrapper
`readline.h` header prefers the `CPPFunction` type which is deprecated,
while it should use `rl_completion_func_t` instead.

Fix the `wscript_configure` check to detect `rl_completion_func_t`, and
reverse the `HAVE_RL_COMPLETION_T` and `HAVE_CPPFUNCTION` checks in the
wrapper header.

PR:		281817
Approved by:	samba (0mp)
Reviewed by:	0mp
MFH:		2024Q3
This commit is contained in:
Dimitry Andric 2024-10-02 13:31:20 +02:00
parent c81f658808
commit 48cea5704f
2 changed files with 32 additions and 0 deletions

View File

@ -45,6 +45,7 @@ EXTRA_PATCHES= \
${PATCHDIR}/0026-vfs-add-a-compatibility-option-to-the-vfs_streams_xa.patch:-p1 \
${PATCHDIR}/0027-Add-VFS-module-vfs_freebsd-that-implements-FreeBSD-s.patch:-p1 \
${PATCHDIR}/0028-s3-lib-system-add-FreeBSD-proc_fd_pattern.patch:-p1 \
${PATCHDIR}/0029-Fix-rl_completion_func_t.patch:-p1 \
${PATCHDIR}/0099-s3-modules-zfsacl-fix-get-set-ACL-on-FreeBSD-13.patch:-p1 \
${PATCHDIR}/0099-s4-mitkdc-Add-support-for-MIT-Kerberos-1.20.patch:-p1

View File

@ -0,0 +1,31 @@
--- a/lib/replace/system/readline.h 2022-01-24 11:26:58.905306300 +0100
+++ b/lib/replace/system/readline.h 2024-10-02 12:48:20.110740000 +0200
@@ -46,10 +46,10 @@
#endif
#ifdef HAVE_NEW_LIBREADLINE
-#ifdef HAVE_CPPFUNCTION
+#if defined(HAVE_RL_COMPLETION_FUNC_T)
+# define RL_COMPLETION_CAST (rl_completion_func_t *)
+#elif defined(HAVE_CPPFUNCTION)
# define RL_COMPLETION_CAST (CPPFunction *)
-#elif defined(HAVE_RL_COMPLETION_T)
-# define RL_COMPLETION_CAST (rl_completion_t *)
#else
# define RL_COMPLETION_CAST
#endif
--- a/libcli/smbreadline/wscript_configure 2022-01-24 11:26:58.973306700 +0100
+++ b/libcli/smbreadline/wscript_configure 2024-10-02 12:48:20.110969000 +0200
@@ -51,10 +51,10 @@ conf.CHECK_CODE('''
# endif
# endif
#endif
-int main(void) {rl_completion_t f; return 0;}
+int main(void) {rl_completion_func_t f; return 0;}
''',
'HAVE_RL_COMPLETION_FUNC_T', execute=False, addmain=False,
-msg='Checking for rl_completion_t')
+msg='Checking for rl_completion_func_t')
conf.CHECK_CODE('''
#ifdef HAVE_READLINE_READLINE_H