From ca7790240cf63cd6f449cbde2d8b9866bd22c7d8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 10 Feb 2012 15:16:06 -0500 Subject: [PATCH] libarchive: Workaround mbsnrtowcs assertion failure on old glibc The CMake TarTest fails with the error mbsnrtowcs.c:116: __mbsnrtowcs: Assertion `status == GCONV_OK || status != GCONV_EMPTY_INPUT || status == GCONV_ILLEGAL_INPUT || status == GCONV_INCOMPLETE_INPUT || status == GCONV_FULL_OUTPUT' failed. on very old glibc versions. Work around the problem by pretending that mbsnrtowcs does not exist. Libarchive will fall back to mbrtowc. --- Utilities/cmlibarchive/libarchive/archive_platform.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Utilities/cmlibarchive/libarchive/archive_platform.h b/Utilities/cmlibarchive/libarchive/archive_platform.h index ce2f482ba..cdd9c7c86 100644 --- a/Utilities/cmlibarchive/libarchive/archive_platform.h +++ b/Utilities/cmlibarchive/libarchive/archive_platform.h @@ -76,6 +76,11 @@ #define __FBSDID(a) struct _undefined_hack #endif +/* Old glibc mbsnrtowcs fails assertions in our use case. */ +#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 1 +# undef HAVE_MBSNRTOWCS +#endif + /* Try to get standard C99-style integer type definitions. */ #if HAVE_INTTYPES_H #include