Re: git: 7e35117eb07f - main - Makefile: Hook MIT KRB5 into the build

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Tue, 08 Jul 2025 13:07:25 UTC

On 08.07.2025 14:09, Dima Panov wrote:
> Hello!
> 
> On 08.07.2025 07:28, Cy Schubert wrote:
>> In message <aGxx371-HV384A0r@mail.bsd4all.net>, "Herbert J. Skuhra" writes:
>>> On Mon, Jul 07, 2025 at 04:04:46PM -0700, Cy Schubert wrote:
>>>> In message <aGwv06rGlgW8zmJI@mail.bsd4all.net>, "Herbert J. Skuhra" writes:
>>>>> On Mon, Jul 07, 2025 at 10:36:31PM +0300, Dima Panov wrote:
>>>>>> Hello!
>>>>>>
>>>>>>
>>>>>> BTW, it looks like symlink for libkadm5clnt.so is broken and produced a
>>>   bad
>>>>>   file
>>>>>> $ ls -la libkadm5clnt
>>>>>> lrwxr-xr-x  1 root wheel 13  7 Jul 20:40 libkadm5clnt -> kadm5clnt_mit
>>>>>>
>>>>>> instead of assumed libkadm5clnt.so -> kadm5clnt_mit.so
>>>>>>
>>>>>>
>>>>>> Please review:
>>>>>>
>>>>>> diff --git a/krb5/lib/kadm5clnt/Makefile b/krb5/lib/kadm5clnt/Makefile
>>>>>> index e377f95f5b6e..be09dd3e210e 100644
>>>>>> --- a/krb5/lib/kadm5clnt/Makefile
>>>>>> +++ b/krb5/lib/kadm5clnt/Makefile
>>>>>> @@ -88,7 +88,7 @@ ${CHPASS_UTIL_STRINGS_ERR_C}: ${CHPASS_UTIL_STRINGS_E
>>> RR}
>>>>>>          rm -f et-c-${.PREFIX}.et et-c-${.PREFIX}.c
>>>>>>
>>>>>>   afterinstall:
>>>>>> -       ${INSTALL_LIBSYMLINK} ${SHLIB} ${DESTDIR}${LIBDIR}/libkadm5clnt
>>>>>> +       ${INSTALL_LIBSYMLINK} ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/libkadm
>>> 5cln
>>>>> t.so
>>>>>>
>>>>>>   .include <bsd.lib.mk>
>>>>>
>>>>> This produces a valid symlink that 'make delete-old' wants to
>>>>> remove again:
>>>>>
>>>>> lrwxr-xr-x  1 root wheel     23 Jul  7 22:26 /usr/lib/libkadm5clnt.so ->
>>>>> libkadm5clnt_mit.so.121
>>>>>
>>>>> # make delete-old
>>>>>>>> Removing old files (only deletes safe to delete libs)
>>>>> remove /usr/lib/libkadm5clnt.so?
>>>>
>>>> Thanks Dima and Herbert for reporting this. It's been fixed.
>>>
>>> Cy, I am sorry for not being more precise.
>>>
>>> Dima's change, which hasn't been commited yet, fixes the real issue of
>>> creating a bad symlink.
>>>
>>> I just wanted to add that his fix also needs removal of
>>> usr/lib/libkadm5clnt.so in tools/build/mk/OptionalObsoleteFiles.inc.
>>>
>>> Maybe usr/lib/libkadm5clnt should be added to OptionalObsoleteFiles.inc?
>>
>> libkadm5clnt.so is a legitimate symlink for both MIT and Heimdal. In the
>> case of Heimdal it points to libkadm5clnt.so.11. Whereas for MIT it points
>> to libkadm5clnt_mit.so.121. There is o libkadm5clnt in MIT. It is
>> libkadm5clnt_mit. You can see this in the port with pkg info -l as follows:
>>
>> slippy$ pkg info -l krb5 | grep libkadm5clnt
>>          /usr/local/lib/libkadm5clnt.so
>>          /usr/local/lib/libkadm5clnt_mit.so
>>          /usr/local/lib/libkadm5clnt_mit.so.12
>>          /usr/local/lib/libkadm5clnt_mit.so.12.0
>> slippy$
>>
> 
> Cy, it looks you still have something staled at your machine :(
> 
> On a clean build for pkgbase in poudriere without my patch it still produces a bad symlink and no compat is packaged as result
> 
> root@aarch64:~ # pkg info -l -x krb5 | grep libkadm5clnt
>          /usr/lib/libkadm5clnt_mit.so.121
>          /usr/lib/debug/usr/lib/libkadm5clnt_mit.so.121.debug
>          /usr/lib/debug/usr/lib32/libkadm5clnt_mit.so.121.debug
>          /usr/lib/libkadm5clnt_mit.a
>          /usr/lib/libkadm5clnt_mit.so
>          /usr/lib32/libkadm5clnt_mit.a
>          /usr/lib32/libkadm5clnt_mit.so
>          /usr/lib32/libkadm5clnt_mit.so.121
> 
> 

${SHLIB} macro gives a wrong name, check it:

$ make -V SHLIB
kadm5clnt_mit
$ make -V SHLIB_LINK
libkadm5clnt_mit.so
$ pwd
/home/fluffy/repo/FreeBSD/FreeBSD-src/krb5/lib/kadm5clnt


So we still need to patch it :)

diff --git a/krb5/lib/kadm5clnt/Makefile b/krb5/lib/kadm5clnt/Makefile
index e377f95f5b6e..ddb9b0e9fec5 100644
--- a/krb5/lib/kadm5clnt/Makefile
+++ b/krb5/lib/kadm5clnt/Makefile
@@ -88,7 +88,7 @@ ${CHPASS_UTIL_STRINGS_ERR_C}: ${CHPASS_UTIL_STRINGS_ERR}
         rm -f et-c-${.PREFIX}.et et-c-${.PREFIX}.c

  afterinstall:
-       ${INSTALL_LIBSYMLINK} ${SHLIB} ${DESTDIR}${LIBDIR}/libkadm5clnt
+       ${INSTALL_LIBSYMLINK} ${SHLIB_LINK} ${DESTDIR}${LIBDIR}/libkadm5clnt.so

  .include <bsd.lib.mk>




-- 
Sincerely,
Dima (fluffy@FreeBSD.org, https://t.me/FluffyBSD, @fluffy:matrix-dev.freebsd.org)
(desktop, kde, x11, office, ports-secteam)@FreeBSD team