Bug 281776

Summary: devel/readline: 8.2.13_1 update breaks build of net/samba419 and net/samba416
Product: Ports & Packages Reporter: Christian Ullrich <chris>
Component: Individual Port(s)Assignee: FreeBSD Samba Team <samba>
Status: Closed FIXED    
Severity: Affects Many People CC: 0mp, crest, dim, freebsd, kib, nikita, rozhuk.im, samba, sunpoet, tomas, yasu
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281633
Bug Depends on: 281817, 281818    
Bug Blocks:    
Attachments:
Description Flags
Patch file 0mp: maintainer-approval-

Description Christian Ullrich 2024-09-30 15:20:22 UTC
The recent patch to devel/readline breaks the build of net/samba419. readline is an unavoidable dependency there. (Python needs it, and Samba needs Python.)


[00:01:18] [1683/2606] Compiling libcli/smbreadline/smbreadline.c
[00:01:18] runner ['cc', '-D_SAMBA_BUILD_=4', '-DHAVE_CONFIG_H=1', '-O2', '-pipe', '-march=haswell', '-DLIBICONV_PLUG', '-DLDAP_DEPRECATED', '-fno-color-diagnostics', '-fstack-protector-strong', '-isystem', '/usr/local/include', '-fno-strict-aliasing', '-fno-omit-frame-pointer', '-MMD', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '-DHAVE_CONFIG_H=1', '-fPIC', '-D__STDC_WANT_LIB_EXT1__=1', '-D_REENTRANT', '-fstack-protector-strong', '-fstack-clash-protection', '-DSTATIC_SMBREADLINE_MODULES=NULL', '-DSTATIC_SMBREADLINE_MODULES_PROTO=extern void __SMBREADLINE_dummy_module_proto(void)', '-Ilibcli/smbreadline', '-I../../libcli/smbreadline', '-Iinclude/public', '-I../../include/public', '-Isource4', '-I../../source4', '-Ilib', '-I../../lib', '-Isource4/lib', '-I../../source4/lib', '-Isource4/include', '-I../../source4/include', '-Iinclude', '-I../../include', '-Ilib/replace', '-I../../lib/replace', '-I.', '-I../..', '-I/usr/local/include', '../../libcli/smbreadline/smbreadline.c', '-c', '-o/wrkdirs/usr/ports/net/samba419/work/samba-4.19.8/bin/default/libcli/smbreadline/smbreadline.c.1.o', '-DLIBICONV_PLUG', '-isystem', '/usr/local/include']
[00:01:18] ../../libcli/smbreadline/smbreadline.c:139:38: warning: 'CPPFunction' is deprecated [-Wdeprecated-declarations]
[00:01:18]   139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
[00:01:18]       |                                                    ^
[00:01:18] ../../lib/replace/system/readline.h:50:31: note: expanded from macro 'RL_COMPLETION_CAST'
[00:01:18]    50 | #  define RL_COMPLETION_CAST (CPPFunction *)
[00:01:18]       |                               ^
[00:01:18] /usr/local/include/readline/rltypedefs.h:38:50: note: 'CPPFunction' has been explicitly marked deprecated here
[00:01:18]    38 | typedef char **CPPFunction (void) __attribute__((deprecated));
[00:01:18]       |                                                  ^
[00:01:18] ../../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]
[00:01:18]   139 |                 rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
[00:01:18]       |                                                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[00:01:18] 1 warning and 1 error generated.
[00:01:18] 
[00:01:18] Waf: Leaving directory `/wrkdirs/usr/ports/net/samba419/work/samba-4.19.8/bin/default'
[00:01:18] Build failed
Comment 1 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-09-30 15:24:52 UTC
Thanks for the report!
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2024-09-30 17:33:15 UTC
I could confirm that it breaks net/samba{416,419}.
Comment 3 Ivan Rozhuk 2024-10-01 04:00:27 UTC
*** Bug 281789 has been marked as a duplicate of this bug. ***
Comment 4 Ivan Rozhuk 2024-10-01 04:15:42 UTC
As workaround add to make.conf:

.if ${.CURDIR:M*/net/samba419}
CFLAGS+=-D_FUNCTION_DEF
.endif
Comment 5 freebsd 2024-10-01 13:39:04 UTC
(In reply to Po-Chuan Hsieh from comment #2)

Confirm for both (FreeBSD 14.1, Poudriere)
Comment 6 Yasuhiro Kimura freebsd_committer freebsd_triage 2024-10-02 06:02:45 UTC
Created attachment 253952 [details]
Patch file

Fix build after commit ee994524fffd.

I confirmed build of net/samba416 and net/samba419 succeeds with poudriere and 14.1-RELEASE amd64 jail.
Comment 7 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 10:03:17 UTC
(In reply to Yasuhiro Kimura from comment #6)

I've not looked deep into why -D_FUNCTION_DEF would fix the issue, but if it is working, let's commit that.

Reviewed by: 0mp
Comment 8 crest 2024-10-02 12:33:33 UTC
(In reply to Mateusz Piotrowski from comment #7)

It works because readline tries to deprecate parts of its API, but the header setting __attribute__((deprecated)) provides an escape hatch: 
https://git.savannah.gnu.org/cgit/readline.git/tree/rltypedefs.h#n31. (lines 31 to 44).
Comment 9 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 12:52:10 UTC
*** Bug 281818 has been marked as a duplicate of this bug. ***
Comment 10 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 13:09:48 UTC
If it is only a temporary fix, then let's go for the fix suggested by dim@ in 281818.
Comment 11 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 13:10:22 UTC
Comment on attachment 253952 [details]
Patch file

Let's commit the patch suggested by dim@ in 281818.
Comment 13 Mateusz Piotrowski freebsd_committer freebsd_triage 2024-10-02 13:49:05 UTC
Thank you, Dimitry!