mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
When updating copy_file I have assumed that expected the target
argument is an absolute file (or directory) name. This was not
previously required, and is even our own example hook does not include
a leading "/".
This is a longstanding bug, but apparently didn't have much of an
effect until commit b641a97705c1 ("hook_functions: Fix copy_file with
source including a directory symlink").
The reiserfsprogs hook runs:
copy_exec /sbin/reiserfsck sbin/reiserfsck
which now results in:
src=/sbin/reiserfsck
target=sbin/reiserfsck # did not match usr-merge patterns
link_target=/usr/sbin/reiserfsck # host is usr-merged
We make a symlink from ${DESTDIR}//usr/sbin/reiserfsck to
${DESTDIR}/sbin/reiserfsck, i.e. a self-link, and try to copy
/usr/sbin/reiserfsck to ${DESTDIR}/sbin/reiserfsck, which fails.
Prepend a "/" to the target and canonicalise it with "realpath -ms"
before doing any filename comparisons.
Fixes: e5476bff04c0 ("copy_file: Skip duplicating symlink if it points to ...")
Fixes: 4807ede18d88 ("hook-functions: Avoid symlinks that conflict with ...")
Closes: #1079276
Signed-off-by: Ben Hutchings <benh@debian.org>
Description
initramfs-tools
Languages
Shell
68.3%
Roff
22.3%
C
9.3%