ExternalProject_Add fails to extract kexec-tools-2.0.17.tar.xz

I’m using ExternalProject_Add with download parameters below:

URL https://projects.horms.net/projects/kexec/kexec-tools/kexec-tools-2.0.17.tar.xz
URL_MD5 f72c11e3bd80de23cae144ce8683d96b

I’m getting the following error:

– extracting… [tar xfz]
CMake Error: Problem with archive_write_header(): Can’t create ‘kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S’
CMake Error: Current file: kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S
CMake Error: Problem extracting tar: /home/builder/local_tarballs/kexec-tools-2.0.17.tar.xz

tar -xf kexec-tools-2.0.17.tar.xz extracts without errors.

xfz

Is this what it is actually using (I’d expect J, not z)? Though that it got a filename indicates that it isn’t the direct issue.

Doing an strace shows that it is trying to make the file before the directory:

openat(AT_FDCWD, "kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S", O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0640) = -1 ENOENT (No such file or directory)
stat("kexec-tools-2.0.17/purgatory/arch/i386", 0x7ffdf8be2110) = -1 ENOENT (No such file or directory)
stat("kexec-tools-2.0.17/purgatory/arch", {st_mode=S_IFDIR|0750, st_size=20, ...}) = 0
mkdir("kexec-tools-2.0.17/purgatory/arch/i386", 0750) = 0

I suspect this is a libarchive bug, but the tarball also might be better with the entries in the right order anyways.

Upstream report: https://github.com/libarchive/libarchive/issues/1381

Upstream reports that the tarball is invalid: it records kexec-tools-2.0.17/purgatory/arch/i386/entry32-16.S as a hardlink to itself. They say they’re going to contact the author about how it got generated because it does sound pretty nonsensical. In the meantime, I suggest repacking the tarball yourself after extracting it with tar xf.