NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/59967: heimdal: broken .et/.asn1 rules



>Number:         59967
>Category:       toolchain
>Synopsis:       heimdal: broken .et/.asn1 rules
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 07 01:10:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, 9, ...
>Organization:
The NetKRB5 Machination, Inc.
>Environment:
>Description:

	1. The procedure to generate .c and .h files from .et (error
	   table) files is to run compile_et to generate both at the
	   same time.  The rule for this is:

${et_src:.et=.c} ${et_src:.et=.h}: ${et_src} ${TOOL_COMPILE_ET}
	${_MKTARGET_CREATE}
	${TOOL_COMPILE_ET} ${.ALLSRC:[1]}

	   This is equivalent to two rules for the .c and the .h files
	   independently; nothing prevents a parallel make(1) from
	   trying to run two compile_et instances in parallel jobs,
	   potentially clobbering each other's output.

	2. The procedure to generate, e.g., krb5_asn1.h from krb5.asn1
	   goes through several stages, the first of which is to
	   simultaneously generate

		krb5.ts
		krb5_asn1-priv.hx
		krb5.hx
		krb5_asn1_files

	   from krb5.asn1 and krb5.opt by this rule:

${src:.asn1=.ts}: ${src} ${src:.asn1=.opt} ${TOOL_ASN1_COMPILE}
	${_MKTARGET_CREATE}
	@touch $@
	${TOOL_ASN1_COMPILE}			\
		${ASN1_OPTS.${src}}		\
		--option-file=${.ALLSRC:[2]}	\
		${.ALLSRC:[1]} ${src:.asn1=_asn1}

	   The next stage is to generate krb5_asn1.h and
	   krb5_asn1-priv.h from krb5_asn1.hx and krb5_asn1-priv.hx,
	   but the rules to do these don't mention the .hx file, so if
	   it gets deleted then the build just fails:

${src:.asn1=_asn1.h}: ${src:.asn1=.ts}
	${_MKTARGET_CREATE}
	@${TOOL_SED} -E 						\
	    -e 's,#include <(.*)_asn1\.h>,#include <krb5/\1_asn1.h>,'	\
	    2> /dev/null < ${src:.asn1=_asn1.hx} > ${src:.asn1=_asn1.h}

${src:.asn1=_asn1-priv.h}: ${src:.asn1=.ts}
	${_MKTARGET_CREATE}
	@cmp -s ${src:.asn1=_asn1-priv.hx} ${src:.asn1=_asn1-priv.h}	\
	    2> /dev/null ||						\
	    cp ${src:.asn1=_asn1-priv.hx} ${src:.asn1=_asn1-priv.h}

	3. Same deal as (1) for slc .in -> .c/.h files:

${slc_src:.in=.c} ${slc_src:.in=.h}: ${slc_src}
	${_MKTARGET_CREATE}
	${TOOL_SLC} ${.ALLSRC}

>How-To-Repeat:

	1. run a highly parallel build, probably
	2. delete the .hx and .h files and rebuild
	3. run a highly parallel build, probably

>Fix:

	1. .ORDER: ${et_src:.et=.c} ${et_src:.et=.h}
	2. add intermediate .hx targets
	3. .ORDER: ${slc_src:.et=.c} ${slc_src:.et=.h}



Home | Main Index | Thread Index | Old Index