kernel-devel RPM post scriptlet generates thousands of hardlink errors
As reported in RBHZ#2025157, the post scriptlet for the kernel-devel
RPM generates thousands upon thousands of .hardlink-temporary
files. This is a result of a bug in the hardlink
binary (fixed in 2.38) that causes orphaned temporary files if multiple aliases for the same path are provided. The kernel-devel
post scriptlet does exactly that. The following is from the current Fedora 35 kernel-devel
package:
(cd /usr/src/kernels/5.16.20-200.fc35.x86_64+debug &&
/usr/bin/find . -type f | while read f; do
hardlink -c /usr/src/kernels/*.fc35.*/$f $f > /dev/null
done)
/usr/src/kernels/*.fc35.*/$f
and $f
will always include an aliased path and, as a result, systems with affected versions of hardlink
will leave behind extraneous .hardlink-temporary
files.
The extra $f
should be removed from the scriptlet. Additionally, it may be prudent to temporarily add a cleanup step that runs the following command first:
/usr/bin/find /usr/src/kernels -type f -name '*.hardlink-temporary' -delete
See also: RHBZ#2025157, util-linux#1602