# ExternalProject\_Add fails to extract kexec-tools-2.0.17.tar.xz

**URL:** <https://discourse.cmake.org/t/externalproject-add-fails-to-extract-kexec-tools-2-0-17-tar-xz/1251>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [May 22, 2020, 12:24am UTC](https://discourse.cmake.org/t/externalproject-add-fails-to-extract-kexec-tools-2-0-17-tar-xz/1251 "2020-05-22T00:24:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DKLind](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dklind/32/526_2.png) [@DKLind](https://discourse.cmake.org/u/DKLind)\
**Post date:** [May 22, 2020, 12:24am UTC](https://discourse.cmake.org/t/externalproject-add-fails-to-extract-kexec-tools-2-0-17-tar-xz/1251/1 "2020-05-22T00:24:07Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [May 22, 2020, 5:59pm UTC](https://discourse.cmake.org/t/externalproject-add-fails-to-extract-kexec-tools-2-0-17-tar-xz/1251/2 "2020-05-22T17:59:23Z")

</div>

`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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [May 22, 2020, 6:05pm UTC](https://discourse.cmake.org/t/externalproject-add-fails-to-extract-kexec-tools-2-0-17-tar-xz/1251/3 "2020-05-22T18:05:39Z")

</div>

Upstream report: [https://github.com/libarchive/libarchive/issues/1381](https://github.com/libarchive/libarchive/issues/1381)

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [May 23, 2020, 12:03pm UTC](https://discourse.cmake.org/t/externalproject-add-fails-to-extract-kexec-tools-2-0-17-tar-xz/1251/4 "2020-05-23T12:03:12Z")

</div>

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`.
