Created attachment 1775335 [details] .spec file Description of problem: On my Arch Linux (5.10.16-arch1-1) I cannot build a simple spec file (see attachment) depending the directory from whcih the package is being built. Version-Release number of selected component (if applicable): * 4.16.1.2 (from Arch Linux rpm-tools) * rpm-4.16.0-alpha-417-ge1fbd486e (git: e1fbd486e9bdd52fa7c5b5efea4ce9de13e48955) How reproducible: Not sure. May depend on filesystem. Steps to Reproduce: 1. Copy spec file to different locations on system 2.On each location, build the attached spec file using this command: rpmbuild -bb --define 'input_dir input' --buildroot ${PWD}/build <path to spec file> Actual results: If you are lucky, observe error on some locations: error: create archive failed: cpio: write failed - No such file or directory RPM build errors: create archive failed: cpio: write failed - No such file or directory Expected results: Having a working .rpm package. Additional info: I debugged through the current git version shown above. Please note that I am not very confident with all of the internals. The attached spec file compiles a simple C++ program and adds this to the build root. For reasons I don't know rpmbuild creates a symbolic link to this program. Depending on the directory I build the rpm in, the symbolic link has a file size of either 24 Bytes or 34 Bytes. Notice: 24 is also the length of the path that the symbolic link points to. In files.c (function addFile) the file size is read using lstat. In cpio.c the expected file end is computed as cpio->fileend = cpio->offset + st->st_size; In rpmfi.c (function iterWriteArchiveNext) the length of the path is taken that the symbolic link points to. This string is written into the archive and the offset is incremented by the length of the path. Since the path length is not necessarily equal to the size of the symbolic link the rpmbuild may fail at the end when fileend is checked to be equal to offset.
OK, this turns out to an kernel issue that is hopefully going to get fixed. Closing here. See https://github.com/rpm-software-management/rpm/issues/1682 and https://github.com/rpm-software-management/rpm/pull/1740 for reference.