Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Oct 2024 13:37:07 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: 53d5fc24e4df - 2024Q3 - net/samba419: fix rl_completion_func_t detection and usage
Message-ID:  <202410021337.492Db7sN013723@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2024Q3 has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=53d5fc24e4dff740815f56ffa712785c8f79acce

commit 53d5fc24e4dff740815f56ffa712785c8f79acce
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-10-02 12:38:03 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-10-02 13:36:18 +0000

    net/samba419: fix rl_completion_func_t detection and usage
    
    After a recent devel/readline update, net/samba419 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:             281818
    Reviewed by:    0mp
    Approved by:    samba (0mp)
    MFH:            2024Q3
    
    (cherry picked from commit c81f658808ee608f60198584a870087946cefc98)
---
 net/samba419/Makefile                              |  1 +
 .../files/0028-Fix-rl_completion_func_t.patch      | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/net/samba419/Makefile b/net/samba419/Makefile
index 5186a7366219..115bc3b56bb4 100644
--- a/net/samba419/Makefile
+++ b/net/samba419/Makefile
@@ -43,6 +43,7 @@ EXTRA_PATCHES=			\
 				${PATCHDIR}/0025-From-d9b748869a8f4018ebee302aae8246bf29f60309-Mon-Se.patch:-p1 \
 				${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-Fix-rl_completion_func_t.patch:-p1 \
 				${PATCHDIR}/0100-Fix-pathref-handling-for-FreeBSD-13plus.patch
 
 SAMBA4_BASENAME=		samba
diff --git a/net/samba419/files/0028-Fix-rl_completion_func_t.patch b/net/samba419/files/0028-Fix-rl_completion_func_t.patch
new file mode 100644
index 000000000000..33debfab76bc
--- /dev/null
+++ b/net/samba419/files/0028-Fix-rl_completion_func_t.patch
@@ -0,0 +1,32 @@
+--- a/samba-4.19.8/lib/replace/system/readline.h        2023-07-18 10:14:54.478091000 +0200
++++ b/lib/replace/system/readline.h     2024-10-02 13:47:48.773606000 +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
+diff -upr a/samba-4.19.8/libcli/smbreadline/wscript_configure b/libcli/smbreadline/wscript_configure
+--- a/samba-4.19.8/libcli/smbreadline/wscript_configure 2023-07-18 10:14:54.558091600 +0200
++++ b/libcli/smbreadline/wscript_configure      2024-10-02 13:47:48.774008000 +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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410021337.492Db7sN013723>