svn commit: r365876 - in head/lib/libarchive: . tests

Kyle Evans kevans at freebsd.org
Fri Sep 18 13:12:15 UTC 2020


On Fri, Sep 18, 2020 at 6:22 AM Alex Richardson <arichardson at freebsd.org> wrote:
>
> Author: arichardson
> Date: Fri Sep 18 11:22:34 2020
> New Revision: 365876
> URL: https://svnweb.freebsd.org/changeset/base/365876
>
> Log:
>   libarchive: fix mismatch between library and test configuration
>
>   I was investigating libarchive test failures on CheriBSD and it turns out
>   we get a reproducible SIGBUS for test_archive_m5, etc. Debugging this shows
>   that libarchive and the tests disagree when it comes to the definition of
>   archive_md5_ctx: libarchive assumes it's the OpenSSL type whereas the test
>   use the libmd type. The latter is not necessarily aligned enough to store
>   a pointer (16 bytes for CHERI RISC-V), so we were crashing when storing
>   EVP_MD_CTX* to an 8-byte-aligned archive_md5_ctx.
>
>   To avoid problems like this in the future, factor out the common compiler
>   flags into a Makefile.inc and include that from the tests Makefile.
>
>   Reviewed By:  lwhsu
>   Differential Revision: https://reviews.freebsd.org/D26469
>
> Added:
>   head/lib/libarchive/Makefile.inc   (contents, props changed)
> Modified:
>   head/lib/libarchive/Makefile
>   head/lib/libarchive/tests/Makefile
>
> [.. snip ..]
> Modified: head/lib/libarchive/tests/Makefile
> ==============================================================================
> --- head/lib/libarchive/tests/Makefile  Fri Sep 18 11:04:16 2020        (r365875)
> +++ head/lib/libarchive/tests/Makefile  Fri Sep 18 11:22:34 2020        (r365876)
> @@ -1,4 +1,5 @@
>  # $FreeBSD$
> +.include <src.opts.mk>
>
>  PACKAGE=       tests
>
> @@ -15,7 +16,7 @@ PROGS+=       libarchive_test
>  CFLAGS+= -I${.CURDIR} -I${.CURDIR:H} -I${.OBJDIR}
>  CFLAGS+= -I${_LIBARCHIVEDIR}/libarchive -I${_LIBARCHIVEDIR}/libarchive/test
>  CFLAGS+= -I${_LIBARCHIVEDIR}/test_utils
> -CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
> +.include "../Makefile.inc"
>
>  # Uncomment to link against dmalloc
>  #LDADD+= -L/usr/local/lib -ldmalloc

Is the explicit .include here necessary (e.g. for ordering)? I note
that inclusion of the parent directory's Makefile.inc is already
guaranteed by bsd.init.mk, so this duplicates all the CFLAGS
additions.

Thanks,

Kyle Evans


More information about the svn-src-all mailing list