The script find $RPM_BUILD_ROOT/usr/src/linux-%{KVERREL} -name ".*depend" | \ while read file ; do mv $file $file.old sed -e "s|[^ ]*\(/usr/src/linux\)|\1|g" < $file.old > $file rm -f $file.old done in the kernel spec file will replace .PRECIOUS: /usr/src/linux-2.4.21-2gt/include/asm/apicdef.h by /usr/src/linux-2.4.21-2gt/include/asm/apicdef.h and hence corrupt the corresponding file. Probaly the sed should read sed -e "s|$RPM_BUILD_ROOT||g" < $file.old > $file