Bug 281818 - net/samba419: fix rl_completion_func_t detection and usage
Summary: net/samba419: fix rl_completion_func_t detection and usage
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 281776
  Show dependency treegraph
 
Reported: 2024-10-02 12:47 UTC by Dimitry Andric
Modified: 2024-10-02 13:40 UTC (History)
1 user (show)

See Also:
0mp: maintainer-feedback+


Attachments
net/samba419: fix rl_completion_func_t detection and usage (4.06 KB, patch)
2024-10-02 12:54 UTC, Dimitry Andric
0mp: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2024-10-02 12:47:50 UTC
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.
Comment 1 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 12:52:10 UTC

*** This bug has been marked as a duplicate of bug 281776 ***
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2024-10-02 12:54:53 UTC
Created attachment 253963 [details]
net/samba419: fix rl_completion_func_t detection and usage
Comment 3 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 13:08:33 UTC
Thanks for the patch! It looks pretty good! Would you like to commit it?

Reviewed by: 0mp
Approved by: samba (0mp)
Comment 4 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 13:11:45 UTC
Once we land the fix for 4.19, we should also port this patch to 4.16.
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2024-10-02 13:31:17 UTC
(In reply to Mateusz Piotrowski from comment #4)
See bug 281817, the fix is almost identical there.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-10-02 13:34:48 UTC
A commit in branch main references this bug:

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

commit c81f658808ee608f60198584a870087946cefc98
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:32: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

 net/samba419/Makefile                              |  1 +
 .../0028-Fix-rl_completion_func_t.patch (new)      | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)
Comment 7 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 13:36:08 UTC
(In reply to Dimitry Andric from comment #5)
Thanks a lot! I missed that bug report :)
Comment 8 commit-hook freebsd_committer freebsd_triage 2024-10-02 13:37:50 UTC
A commit in branch 2024Q3 references this bug:

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 +
 .../0028-Fix-rl_completion_func_t.patch (new)      | 32 ++++++++++++++++++++++
 2 files changed, 33 insertions(+)