Bug 267814 - security/heimdal: 7.8.0 fails to build in Poudriere, missing Python dep, other issues
Summary: security/heimdal: 7.8.0 fails to build in Poudriere, missing Python dep, othe...
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-16 16:21 UTC by James TD Smith
Modified: 2022-12-05 20:10 UTC (History)
8 users (show)

See Also:
bugzilla: maintainer-feedback? (hrs)


Attachments
Poudriere log without adding python to USES (9.99 KB, text/plain)
2022-11-16 16:21 UTC, James TD Smith
no flags Details
Poudriere log with python added to USES (250.54 KB, text/plain)
2022-11-16 16:22 UTC, James TD Smith
no flags Details
This patch fixes the three build problems (1.83 KB, patch)
2022-11-17 01:42 UTC, Cy Schubert
no flags Details | Diff
Do not depend on Python (779 bytes, patch)
2022-11-17 19:18 UTC, Jung-uk Kim
no flags Details | Diff
Python is a build-only dependency, not a runtime dependency (1.07 KB, patch)
2022-11-17 19:58 UTC, Cy Schubert
no flags Details | Diff
Do not depend on Python (v2) (784 bytes, patch)
2022-11-17 20:28 UTC, Jung-uk Kim
no flags Details | Diff
Alternative patch to enable Python detection only in maintainer mode (580 bytes, patch)
2022-11-17 22:11 UTC, Jung-uk Kim
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James TD Smith 2022-11-16 16:21:46 UTC
Created attachment 238122 [details]
Poudriere log without adding python to USES

Port fails in configure due to Python not being available:

checking for python... no
checking for python2... no
checking for python3... no
checking for python3.9... no
checking for python3.8... no
checking for python3.7... no
checking for python3.6... no
checking for python3.5... no
checking for python3.4... no
checking for python3.3... no
checking for python3.2... no
checking for python3.1... no
checking for python3.0... no
checking for python2.7... no
checking for python2.6... no
checking for python2.5... no
checking for python2.4... no
checking for python2.3... no
checking for python2.2... no
checking for python2.1... no
checking for python2.0... no
configure: error: no suitable Python interpreter found
===>  Script "configure" failed unexpectedly.
Please report the problem to hrs@FreeBSD.org [maintainer] and attach the
"/wrkdirs/usr/ports/security/heimdal/work/heimdal-7.8.0/config.log" including
the output of the failure of your make command. Also, it might be a good idea
to provide an overview of all packages installed on your system (e.g. a
/usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.

Adding python:build to USES gets past that but it then fails later in the build:

mv -f .deps/symbol.Tpo .deps/symbol.Po
/bin/sh ../../libtool  --tag=CC    --mode=link cc -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs -Wshadow -DINET6 -O2 -pipe -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -Wl,-rpath,/usr/local/lib/heimdal:/usr/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib -fstack-protector-strong -o asn1_compile asn1parse.o gen.o  gen_copy.o gen_decode.o gen_encode.o  gen_free.o gen_glue.o gen_length.o  gen_seq.o gen_template.o hash.o  lex.o main.o symbol.o ../../lib/vers/libvers.la ../../lib/roken/libroken.la -lcrypt  -lfl -lpthread
libtool: link: cc -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs -Wshadow -DINET6 -O2 -pipe -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wl,-rpath -Wl,/usr/local/lib/heimdal:/usr/lib -Wl,-rpath -Wl,/usr/local/lib -fstack-protector-strong -o .libs/asn1_compile asn1parse.o gen.o gen_copy.o gen_decode.o gen_encode.o gen_free.o gen_glue.o gen_length.o gen_seq.o gen_template.o hash.o lex.o main.o symbol.o  -L/usr/local/lib ../../lib/vers/.libs/libvers.a ../../lib/roken/.libs/libroken.so -lfl -lcrypt -lpthread -Wl,-rpath -Wl,/usr/local/lib/heimdal
../../lib/asn1/asn1_compile --one-code-file --preserve-binary=TBSCertificate --preserve-binary=TBSCRLCertList --preserve-binary=Name --sequence=GeneralNames --sequence=Extensions --sequence=CRLDistributionPoints ./rfc2459.asn1 rfc2459_asn1 || (rm -f rfc2459_asn1_files ; exit 1)
/bin/sh: no: not found
*** Error code 127

Stop.
make[3]: stopped in /wrkdirs/usr/ports/security/heimdal/work/heimdal-7.8.0/lib/asn1
*** Error code 1
*** Error code 1
*** Error code 1

Stop.
make: stopped in /usr/ports/security/heimdal
=>> Cleaning up wrkdir
===>  Cleaning for heimdal-7.8.0
build of security/heimdal | heimdal-7.8.0 ended at Wed Nov 16 16:03:04 GMT 2022
build time: 00:01:00
!!! build failure encountered !!!
Comment 1 James TD Smith 2022-11-16 16:22:21 UTC
Created attachment 238123 [details]
Poudriere log with python added to USES
Comment 2 Dave Hayes 2022-11-16 19:11:38 UTC
Confirming this exact behavior.
Comment 3 Tatsuki Makino 2022-11-16 21:19:49 UTC
(In reply to James TD Smith from comment #0)

> /bin/sh: no: not found

This is because the following part of ${WRKSRC}/configure.ac may put no.

AC_CHECK_PROG(CLANG_FORMAT, clang-format, [clang-format], [no])

However, it does not take into account the possibility of a "no" when used.
It would seem that that part of ${WRCSRC}/cf/Makefile.am.common needs to be fixed and autoreconf run.
Comment 4 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 00:22:12 UTC
I'm working on this.
Comment 5 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 00:28:47 UTC
ATM there are two problems. First, the python problem. This is the simple problem.

The other problem is a libtool generated asn1_compile runtime issue. I'm testing the resolution. The port built ok here because I had llvm90 installed.

This second problem manifests itself as:

There is another with a libtool generated script:

../../lib/asn1/asn1_compile --one-code-file --preserve-binary=TBSCertificate
 --preserve-binary=TBSCRLCertList --preserve-binary=Name 
--sequence=GeneralNames --sequence=Extensions --sequence=CRLDistributionPoin
ts ./rfc2459.asn1 rfc2459_asn1 || (rm -f rfc2459_asn1_files ; exit 1)
/bin/sh: no: not found
*** Error code 127

../../lib/asn1/.libs/asn1_compile (an elf binary) produces this error.
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 01:42:45 UTC
Created attachment 238132 [details]
This patch fixes the three build problems

This patch fixes the build problems. Commit log will be:

security/heimdal: Fix build

Three problems were discovered when building under poudriere or in
a clean jail.

1. Python is now a prerequisite.

2. liblockfile is now needed.

3. clang-format is needed for asn1_compile. Unfortunately the base llvm
   does not install clang-format so we need install $LLVM_DEFAULT to get
   this file.

PR:             267814
Reported by:    many
Fixes:          83f79ba0e0ca
MFH:            2022Q4
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-11-17 02:31:40 UTC
A commit in branch main references this bug:

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

commit a5523d807d01b1ed31614f346db2b348d7046420
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-17 01:34:53 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-17 02:21:36 +0000

    security/heimdal: Fix build

    Three problems were discovered when building under poudriere or in
    a clean jail.

    1. Python is now a prerequisite.

    2. liblockfile is now needed.

    3. clang-format is needed for asn1_compile. Unfortunately the base llvm
       does not install clang-format so we need install $LLVM_DEFAULT to get
       this file.

    PR:             267814
    Reported by:    many
    Fixes:          83f79ba0e0ca
    MFH:            2022Q4

 security/heimdal/Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-11-17 04:27:56 UTC
A commit in branch 2022Q4 references this bug:

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

commit 9d4980893f8e09acd8e8d828ac5d0db21493f6a8
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-17 01:34:53 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-17 04:27:36 +0000

    security/heimdal: Fix build

    Three problems were discovered when building under poudriere or in
    a clean jail.

    1. Python is now a prerequisite.

    2. liblockfile is now needed.

    3. clang-format is needed for asn1_compile. Unfortunately the base llvm
       does not install clang-format so we need install $LLVM_DEFAULT to get
       this file.

    PR:             267814
    Reported by:    many
    Fixes:          83f79ba0e0ca

    (cherry picked from commit a5523d807d01b1ed31614f346db2b348d7046420)

 security/heimdal/Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Comment 9 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 18:01:14 UTC
Is Python really required at runtime?  Don't you want "python:build"?
Comment 10 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 19:18:44 UTC
Created attachment 238144 [details]
Do not depend on Python

(In reply to Jung-uk Kim from comment #9)
Actually, I found Python is not really used for us.  We can just disable it.
Comment 11 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 19:53:54 UTC
(In reply to Jung-uk Kim from comment #10)
This patch won't work.

Below will depend on python for build only:

diff --git a/security/heimdal/Makefile b/security/heimdal/Makefile
index 14956859a0b2..97ed2cea2e69 100644
--- a/security/heimdal/Makefile
+++ b/security/heimdal/Makefile
@@ -13,7 +13,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
 CONFLICTS=     krb5 krb5-*
 
 USES=          cpe gettext-runtime gssapi:bootstrap,heimdal libtool pathfix \
-           pkgconfig python readline makeinfo ssl
+         pkgconfig python:build readline makeinfo ssl
 CPE_VENDOR=    ${PORTNAME}_project
 USE_LDCONFIG=  ${GSSAPILIBDIR}
Comment 12 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 19:58:33 UTC
Created attachment 238145 [details]
Python is a build-only dependency, not a runtime dependency

Python is a build-only dependency, not a runtime dependency.
Comment 13 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 20:10:10 UTC
(In reply to Jung-uk Kim from comment #10)
On second thought, does it build with PYTHON=/bin/true?

Seems the only library that needs it for build is libwind.
Comment 14 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 20:28:19 UTC
Created attachment 238147 [details]
Do not depend on Python (v2)

(In reply to Cy Schubert from comment #13)
It is only used to generate some files.  However, generated files are included in the distribution.  Basically, it is only used in "maintainer mode".

https://github.com/heimdal/heimdal/blob/master/lib/wind/Makefile.am#L92
Comment 15 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 20:33:24 UTC
(In reply to Cy Schubert from comment #13)
It builds fine with my patch.

Relevant log from Poudriere build after the patch:

checking for python version...
checking for python platform...
checking for GNU default python prefix... ${prefix}
checking for GNU default python exec_prefix... ${exec_prefix}
checking for python script directory (pythondir)... ${PYTHON_PREFIX}/lib/python/site-packages
checking for python extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python/site-packages
Comment 16 commit-hook freebsd_committer freebsd_triage 2022-11-17 20:46:36 UTC
A commit in branch main references this bug:

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

commit 68dcf2c91fa47302d8224fbebb7bec190cc0efe9
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-17 19:55:06 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-17 20:45:04 +0000

    security/heimdal: Remove python dependency

    Python is only needed in developer mode and only to regenerate already
    provided files in lib/wind.

    PR:             267814
    Submitted by:   jkim
    Reported by:    jkim
    Fixes:          a5523d807d01
    MFH:            2022Q4

 security/heimdal/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Comment 17 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 20:47:49 UTC
(In reply to Jung-uk Kim from comment #15)
Thanks for the patch.

Someone should probably create an upstream issue for this.
Comment 18 commit-hook freebsd_committer freebsd_triage 2022-11-17 20:55:39 UTC
A commit in branch 2022Q4 references this bug:

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

commit 079f8b91e3358f05d33eb6ad22100f123ee3c9e9
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-17 19:55:06 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-17 20:54:48 +0000

    security/heimdal: Remove python dependency

    Python is only needed in developer mode and only to regenerate already
    provided files in lib/wind.

    PR:             267814
    Submitted by:   jkim
    Reported by:    jkim
    Fixes:          a5523d807d01

    (cherry picked from commit 68dcf2c91fa47302d8224fbebb7bec190cc0efe9)

 security/heimdal/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Comment 19 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 21:25:57 UTC
(In reply to Cy Schubert from comment #17)
I don't have enough automake foo but will this work?

https://github.com/juikim/heimdal/commit/164f2faccf30ef828c3242eaa192e7e8176c1cde
Comment 20 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 22:11:50 UTC
Created attachment 238150 [details]
Alternative patch to enable Python detection only in maintainer mode

(In reply to Jung-uk Kim from comment #19)
With the upstream patch, regenerated configure script looks good.  The attached patch is the only difference between them.
Comment 21 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 22:14:24 UTC
(In reply to Jung-uk Kim from comment #19)
Looks like it should.

Thinking we should create a heimdal-devel port (not for development but to track upstream HEAD) just like we do krb5-devel. That would need automake, be a great way to test this, and people so inclined to run the latest heimdal could.
Comment 22 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 22:23:22 UTC
(In reply to Cy Schubert from comment #21)
FYI, I created a pull request.

https://github.com/heimdal/heimdal/pull/1034

> Thinking we should create a heimdal-devel port (not for development but to
> track upstream HEAD) just like we do krb5-devel. That would need automake, be
> a great way to test this, and people so inclined to run the latest heimdal
> could.

Good idea.
Comment 23 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 22:25:31 UTC
(In reply to Jung-uk Kim from comment #20)
This would be preferable for a non-devel (i.e. not like krb5-devel, nut-devel, cde-devel, ksh-devel, bind918-devel) port.

Running autotools may build differently on end-user systems due to configuration differences. This introduces variability and variability spawns needless tickets due to individual system differences that are impossible to control.

This would be a better patch. Test it and commit it. However, I think discussing better ways to implement the PYTHON bypass is probably outside of the scope of this PR already and this kind of patch should be discussed on phabricator as we're now improving on an already committed fix to the problem. Thoughts?
Comment 24 Jung-uk Kim freebsd_committer freebsd_triage 2022-11-17 22:35:29 UTC
(In reply to Cy Schubert from comment #23)
Obviously, configure patch is for security/heimdal and configure.ac patch is for security/heimdal-devel if you decide to add one.

I agree that it is out of scope at this point.
Comment 25 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 22:38:08 UTC
(In reply to Jung-uk Kim from comment #22)
I had a skeleton heimdal-devel port in my tree and deleted it two weeks ago because of too many other projects on the go, specifically when philip@ pinged me about committing the jumbo security patch to main.

I can resurrect that work and can add that to the weekly-monthly updates to all the -devel ports I already maintain.

Tangential to this discussion, is my goal to remove the kdc from base FreeBSD. Server services that are not needed subsequent to initial system install, such as kdc, web servers, MTA (postfix, sendmail, exim) and other server services should not be installed by the base O/S. Users should be able to pick and choose which services they want install and run on their servers.

WRT Kerberos, MIT and Heimdal share the same protocol except for kadmin. The Heimdal kadmin protocol is incompatible with MIT kadmin protocol. Even though the clients can use either as a server kerberos administrators cannot use MIT kadmin tools to manage a Heimdal KDC nor can Heimdal tools be used to manage an MIT KDC. I think the KDC should be removed, eventually.

This will also simplify upgrading our Heimdal from its ancient 1.5.2 to 7.8.0. Currently an update of base Heimdal to 7.7.0 resulted in numerous regressions with daemons such as telnetd and ftpd. Likely because we need to update our PAM stack too -- haven't had the time to investigate this avenue.
Comment 26 Cy Schubert freebsd_committer freebsd_triage 2022-11-17 22:39:21 UTC
(In reply to Jung-uk Kim from comment #24)
I think I'll revisit that at some point. Too many shiny objects (projects). Not enough time.
Comment 27 dewayne 2022-11-21 06:10:40 UTC
(In reply to Cy Schubert from comment #26)
Unfortunately I'm recovering from COVID (day 7) so I had some time to look into this.  Cutting a very long story short: 

# grep -E "CLANG|liblock" /usr/ports/security/heimdal/Makefile
# 20221119 LIB_DEPENDS=  liblockfile.so:devel/liblockfile
# 20221119              CLANG_FORMAT="${LOCALBASE}/bin/clang-format${LLVM_DEFAULT}"

# touch /usr/bin/no
# chmod 760 /usr/bin/no
# make -C /usr/ports/security/heimdal -DNOCCACHE clean package 
===>  Building package for heimdal-7.8.0_1

This built on FreeBSD12.4 Pre for both i386 and amd64. (I also built it with gcc11).  Cursory testing included:
/usr/local/sbin/kstash
1
# hd /var/heimdal/m-key
00000000  05 02 00 00 00 39 00 02  00 02 48 53 00 01 4b 00  |.....9....HS..K.|
00000010  01 4d 00 00 00 01 63 7a  f2 f8 01 00 10 00 18 d6  |.M....cz........|
00000020  4a 34 ba a7 b5 6b 64 f4  32 a4 f4 25 1c c8 c8 85  |J4...kd.2..%....|
00000030  31 07 a8 25 cd 07 a7 00  00 00 01 00 00 00 00     |1..%...........|
# /usr/local/bin/kadmin -l init new.here
# /usr/local/bin/kadmin -l add me
# /usr/local/libexec/kdc &
# /usr/local/bin/kadmin -l list \*
me
default@new.here
kadmin/admin@new.here
kadmin/hprop@new.here
kadmin/changepw@new.here
krbtgt/new.here@new.here
changepw/kerberos@new.here
WELLKNOWN/ANONYMOUS@new.here
WELLKNOWN/org.h5l.fast-cookie@WELLKNOWN:ORG.H5L
# /usr/local/bin/kinit me
me@XXXX's Password:
kinit: krb5_get_init_creds: unable to reach any KDC in realm XXXX (an actual realm)

I ran /usr/local/libexec/kdc where procstat -f indicated it was listening properly.  This is sufficient to suggest this is working.

I hope that this is of some help.  It started with why (the additions)?  :)
Comment 28 Tatsuki Makino 2022-11-22 04:46:11 UTC
(In reply to replies to my email sent to ports@FreeBSD)
No particular problem there :)
I had trouble with heimdal not being able to build, but I don't know how to use heimdal :)

However, there was still a problem with building heimdal...

I ran poudriere bulk -t ... security/heimdal with all options turned on, but liblockfile does not seem to be used.
Log of list of dependent libraries.

=>> Checking shared library dependencies
 0x0000000000000001 NEEDED               Shared library: [libasn1.so.8]
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x0000000000000001 NEEDED               Shared library: [libcom_err.so.1]
 0x0000000000000001 NEEDED               Shared library: [libcrack.so.2]
 0x0000000000000001 NEEDED               Shared library: [libcrypt.so.5]
 0x0000000000000001 NEEDED               Shared library: [libcrypto.so.111]
 0x0000000000000001 NEEDED               Shared library: [libdb-5.3.so.0]
 0x0000000000000001 NEEDED               Shared library: [libgssapi.so.3]
 0x0000000000000001 NEEDED               Shared library: [libhcrypto.so.4]
 0x0000000000000001 NEEDED               Shared library: [libhdb.so.9]
 0x0000000000000001 NEEDED               Shared library: [libheimbase.so.1]
 0x0000000000000001 NEEDED               Shared library: [libheimntlm.so.0]
 0x0000000000000001 NEEDED               Shared library: [libhx509.so.5]
 0x0000000000000001 NEEDED               Shared library: [libintl.so.8]
 0x0000000000000001 NEEDED               Shared library: [libkadm5clnt.so.7]
 0x0000000000000001 NEEDED               Shared library: [libkadm5srv.so.8]
 0x0000000000000001 NEEDED               Shared library: [libkafs.so.0]
 0x0000000000000001 NEEDED               Shared library: [libkdc.so.2]
 0x0000000000000001 NEEDED               Shared library: [libkrb5.so.26]
 0x0000000000000001 NEEDED               Shared library: [liblber.so.2]
 0x0000000000000001 NEEDED               Shared library: [libldap.so.2]
 0x0000000000000001 NEEDED               Shared library: [liblmdb.so.0]
 0x0000000000000001 NEEDED               Shared library: [libotp.so.0]
 0x0000000000000001 NEEDED               Shared library: [libreadline.so.8]
 0x0000000000000001 NEEDED               Shared library: [libroken.so.18]
 0x0000000000000001 NEEDED               Shared library: [libsl.so.0]
 0x0000000000000001 NEEDED               Shared library: [libsqlite3.so.0]
 0x0000000000000001 NEEDED               Shared library: [libthr.so.3]
 0x0000000000000001 NEEDED               Shared library: [libwind.so.0]

Then there is /bin/sh: no: not found issue...

I wrote a very abbreviated version in my comment #3, but here is the part where the no is executed.

.x.c:
	@if [ -z "$(CLANG_FORMAT)" ]; then \
	    cmp -s $< $@ 2> /dev/null || cp $< $@; \
	else \
	    cp $< $@.tmp.c; \
            $(CLANG_FORMAT) -style='{BasedOnStyle: Chromium, SortIncludes: false}' -i $@.tmp.c; \
	    cmp -s $@.tmp.c $@ 2> /dev/null || mv $@.tmp.c $@; \
	fi

This part does not seem to have a problem even if clang-format is not existing, but the problem is that no is entered when it is not existing.
A patch for this would look like this

-	@if [ -z "$(CLANG_FORMAT)" ]; then \
+	@if [ -z "$(CLANG_FORMAT)" -o "$(CLANG_FORMAT)" = no ]; then \

However, since this part is owned by all Makefile.in including Makefile.am.common, it would be better to patch the main ${WRCSRC}/cf/Makefile.am.common and add USES=autoreconf:2.71

Or, apply the following patch to configure.ac and add USES=autoreconf.

-AC_CHECK_PROG(CLANG_FORMAT, clang-format, [clang-format], [no])
+AC_CHECK_PROG(CLANG_FORMAT, clang-format, [clang-format], [])

Or apply the following patch directly to configure...

-  test -z "$ac_cv_prog_CLANG_FORMAT" && ac_cv_prog_CLANG_FORMAT="no"
+  test -z "$ac_cv_prog_CLANG_FORMAT" && ac_cv_prog_CLANG_FORMAT=""
Comment 29 commit-hook freebsd_committer freebsd_triage 2022-11-22 18:18:29 UTC
A commit in branch main references this bug:

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

commit b40d9eda115f03cd7859314c3617386094ac88a9
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-22 18:14:41 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-22 18:14:41 +0000

    security/heimdal*: Remove lockfile dependency

    Though heimdal ./configure checks for a lockfile dependency, it does
    not use it. Let's remove the dependency.

    PR:             267814
    Reported by:    Tatsuki Makino <tatsuki_makino@hotmail.com>
    MFH:            2022Q4

 security/heimdal-devel/Makefile | 3 +--
 security/heimdal/Makefile       | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
Comment 30 Cy Schubert freebsd_committer freebsd_triage 2022-11-22 18:38:12 UTC
Fixed.
Comment 31 Cy Schubert freebsd_committer freebsd_triage 2022-11-24 07:59:47 UTC
Reopened. There's a better solution to this.
Comment 32 commit-hook freebsd_committer freebsd_triage 2022-11-24 17:28:13 UTC
A commit in branch main references this bug:

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

commit 22a683a337efe7169b61de8c9ec63e2c0d561891
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-24 15:34:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-24 17:22:01 +0000

    security/heimdal*: Remove LLVM_DEFAULT build prerequisite

    Adjust ./configure to set the correct CLANG_FORMAT value when
    clang-format is not found (when none of the llvm ports are installed).

    PR:             267814
    Submitted by:   Tatsuki Makino <tatsuki_makino@hotmail.com>
    MFH:            2022Q4

 security/heimdal-devel/Makefile                 |  7 ++---
 security/heimdal-devel/files/patch-configure.ac | 15 ++++++++--
 security/heimdal/Makefile                       |  6 +---
 security/heimdal/files/patch-configure          | 39 +++++++++++++++----------
 security/heimdal/files/patch-configure.ac       | 15 ++++++++--
 5 files changed, 51 insertions(+), 31 deletions(-)
Comment 33 commit-hook freebsd_committer freebsd_triage 2022-11-24 23:33:25 UTC
A commit in branch main references this bug:

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

commit 286254e283f60ef160b572c8d76db06ac2b87c1a
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-24 20:36:25 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-24 23:31:23 +0000

    Partially revert "security/heimdal*: Remove LLVM_DEFAULT build prerequisite"

    The suggested workaround will only work when autoreconf is not run.
    The devel port still needs LLVM_DEFAULT while the non-devel port does
    not

    PR:     267814
    Fixes:  22a683a337ef
    MFH:    2022Q4

    This partially reverts commit 22a683a337efe7169b61de8c9ec63e2c0d561891.

 security/heimdal-devel/Makefile                 |  5 ++++-
 security/heimdal-devel/files/patch-configure.ac | 15 +++------------
 2 files changed, 7 insertions(+), 13 deletions(-)
Comment 34 commit-hook freebsd_committer freebsd_triage 2022-11-24 23:33:30 UTC
A commit in branch main references this bug:

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

commit 67fc2c392f1efc669521939b5003e47786807a6c
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-24 21:23:53 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-11-24 23:29:06 +0000

    security/heimdal: Remove LLVM_DEFAULT artifact

    Remove an artifact from 22a683a337ef.

    PR:             267814
    Fixes:          22a683a337ef
    MFH:            2022Q4

 security/heimdal/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Comment 35 commit-hook freebsd_committer freebsd_triage 2022-12-05 20:10:03 UTC
A commit in branch 2022Q4 references this bug:

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

commit 3c82f0cb8a253f74f2befa66c4ea1d654ce5ec9c
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-24 20:36:25 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-12-05 20:06:15 +0000

    Partially revert "security/heimdal*: Remove LLVM_DEFAULT build prerequisite"

    The suggested workaround will only work when autoreconf is not run.
    The devel port still needs LLVM_DEFAULT while the non-devel port does
    not

    PR:     267814
    Fixes:  22a683a337ef

    This partially reverts commit 22a683a337efe7169b61de8c9ec63e2c0d561891.

    (cherry picked from commit 286254e283f60ef160b572c8d76db06ac2b87c1a)

 security/heimdal-devel/Makefile                 |  5 ++++-
 security/heimdal-devel/files/patch-configure.ac | 15 +++------------
 2 files changed, 7 insertions(+), 13 deletions(-)
Comment 36 commit-hook freebsd_committer freebsd_triage 2022-12-05 20:10:10 UTC
A commit in branch 2022Q4 references this bug:

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

commit ea57c9f77dc38ab6141d215b3403f3c4a6011ab2
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-22 18:14:41 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-12-05 20:06:13 +0000

    security/heimdal*: Remove lockfile dependency

    Though heimdal ./configure checks for a lockfile dependency, it does
    not use it. Let's remove the dependency.

    PR:             267814
    Reported by:    Tatsuki Makino <tatsuki_makino@hotmail.com>

    (cherry picked from commit b40d9eda115f03cd7859314c3617386094ac88a9)

 security/heimdal-devel/Makefile | 3 +--
 security/heimdal/Makefile       | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
Comment 37 commit-hook freebsd_committer freebsd_triage 2022-12-05 20:10:12 UTC
A commit in branch 2022Q4 references this bug:

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

commit c4a04da5be275e110b187e63e34038bc9bb77ec8
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-24 21:23:53 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-12-05 20:06:15 +0000

    security/heimdal: Remove LLVM_DEFAULT artifact

    Remove an artifact from 22a683a337ef.

    PR:             267814
    Fixes:          22a683a337ef
    (cherry picked from commit 67fc2c392f1efc669521939b5003e47786807a6c)

 security/heimdal/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Comment 38 commit-hook freebsd_committer freebsd_triage 2022-12-05 20:10:13 UTC
A commit in branch 2022Q4 references this bug:

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

commit 4e3ca7cbf77438202f8a2e4b3a1a43b1aa885f73
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-24 15:34:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-12-05 20:06:14 +0000

    security/heimdal*: Remove LLVM_DEFAULT build prerequisite

    Adjust ./configure to set the correct CLANG_FORMAT value when
    clang-format is not found (when none of the llvm ports are installed).

    PR:             267814
    Submitted by:   Tatsuki Makino <tatsuki_makino@hotmail.com>

    (cherry picked from commit 22a683a337efe7169b61de8c9ec63e2c0d561891)

 security/heimdal-devel/Makefile                 |  7 ++---
 security/heimdal-devel/files/patch-configure.ac | 15 ++++++++--
 security/heimdal/Makefile                       |  6 +---
 security/heimdal/files/patch-configure          | 39 +++++++++++++++----------
 security/heimdal/files/patch-configure.ac       | 15 ++++++++--
 5 files changed, 51 insertions(+), 31 deletions(-)