Version in base suite: 0.142+deb12u1 Base version: initramfs-tools_0.142+deb12u1 Target version: initramfs-tools_0.142+deb12u3 Base file: /srv/ftp-master.debian.org/ftp/pool/main/i/initramfs-tools/initramfs-tools_0.142+deb12u1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/i/initramfs-tools/initramfs-tools_0.142+deb12u3.dsc debian/changelog | 19 +++++++++ debian/tests/control | 4 + debian/tests/copy-file | 95 +++++++++++++++++++++++++++++++++++++++++++++++ debian/tests/test-common | 1 hook-functions | 56 ++++++++++++++++++++------- 5 files changed, 161 insertions(+), 14 deletions(-) diff -Nru initramfs-tools-0.142+deb12u1/debian/changelog initramfs-tools-0.142+deb12u3/debian/changelog --- initramfs-tools-0.142+deb12u1/debian/changelog 2024-08-24 23:14:50.000000000 +0000 +++ initramfs-tools-0.142+deb12u3/debian/changelog 2025-04-26 20:00:24.000000000 +0000 @@ -1,3 +1,22 @@ +initramfs-tools (0.142+deb12u3) bookworm; urgency=medium + + * Re-upload with clean debian directory + + -- Ben Hutchings Sat, 26 Apr 2025 22:00:24 +0200 + +initramfs-tools (0.142+deb12u2) bookworm; urgency=medium + + * [37a6e9e] hook-functions: Expand documentation of copy_exec and copy_file + * [31c50bc] hook-functions: Restore copy_file's handling of target ending in + slash (Closes: #1082647) + * [d6d1883] hook-functions: Exclude usr-merge symlinks in copy_file + (Closes: #1088959) + * [38cf275] autopkgtest: Add tests for copy_file function + * [065a03f] hook-functions: Add reset drivers when MODULES=dep + (Closes: #1027458) + + -- Ben Hutchings Thu, 24 Apr 2025 17:45:07 +0200 + initramfs-tools (0.142+deb12u1) bookworm; urgency=medium [ Ben Hutchings ] diff -Nru initramfs-tools-0.142+deb12u1/debian/tests/control initramfs-tools-0.142+deb12u3/debian/tests/control --- initramfs-tools-0.142+deb12u1/debian/tests/control 2024-08-22 18:38:38.000000000 +0000 +++ initramfs-tools-0.142+deb12u3/debian/tests/control 2025-04-24 15:40:53.000000000 +0000 @@ -21,3 +21,7 @@ Tests: amd64-panic-shell Depends: @, qemu-system-x86, linux-image-amd64 | linux-image-generic:amd64, klibc-utils, genext2fs, zstd Restrictions: skip-not-installable + +Tests: copy-file +Restrictions: needs-root, breaks-testbed, skip-not-installable, superficial, allow-stderr +Depends: linux-image-generic, zstd, @ diff -Nru initramfs-tools-0.142+deb12u1/debian/tests/copy-file initramfs-tools-0.142+deb12u3/debian/tests/copy-file --- initramfs-tools-0.142+deb12u1/debian/tests/copy-file 1970-01-01 00:00:00.000000000 +0000 +++ initramfs-tools-0.142+deb12u3/debian/tests/copy-file 2025-04-24 15:40:53.000000000 +0000 @@ -0,0 +1,95 @@ +#!/bin/sh -e + +SUPPORTED_FLAVOURS='alpha-smp amd64 arm64 armmp parisc loong64 m68k powerpc64 powerpc64le riscv64 s390x sparc64-smp generic' +. debian/tests/test-common + +SOURCEDIR=/usr/lib/initramfs-test-copy-file + +mkdir -p "${SOURCEDIR}/dir1" +echo -n 1 >"${SOURCEDIR}/dir1/file1" +ln -s dir1 "${SOURCEDIR}/dir2" +echo -n 22 >"${SOURCEDIR}/file2" +echo -n 333 >"${SOURCEDIR}/file3" + +cat >>"${CONFDIR}/initramfs.conf" <"${CONFDIR}/hooks/initramfs-test-copy-file" <"${AUTOPKGTEST_TMP}/listing" + +rc=0 + +check_file() { + local ftype="$1" + local name="$2" + local extra="$3" + local size_re='[0-9]*' + local tail_re='' + + case "$ftype" in + -) + # Regular file: extra is size + size_re="${extra}" + ;; + l) + # Symbolic link: extra is link text + size_re="${#extra}" + tail_re=" -> $(printf %s "$extra" | sed 's/\./\\./g')" + ;; + esac + + if ! grep -q "^${ftype}......... *[0-9]* root *root *${size_re} ............ ${name#/}${tail_re}$" "${AUTOPKGTEST_TMP}/listing"; then + echo >&2 "E: $name did not get copied correctly" + rc=1 + fi +} + +# Check that files, directories, and symlinks were created as expected +check_file d ${SOURCEDIR}/dir1 - +check_file - ${SOURCEDIR}/dir1/file1 1 +check_file d ${SOURCEDIR}/dir2 - +check_file l ${SOURCEDIR}/dir2/file1 ../dir1/file1 +check_file - ${SOURCEDIR}/file3 3 +check_file d ${SOURCEDIR}/dir3 - +check_file - ${SOURCEDIR}/dir3/file2 2 +check_file d ${SOURCEDIR}/dir4 - +check_file - ${SOURCEDIR}/dir4/file2 2 +check_file - ${SOURCEDIR}/dir5/file3 3 + +if [ $rc -ne 0 ]; then + echo "I: Initramfs contents:" + cat "$AUTOPKGTEST_TMP/listing" +fi + +exit $rc diff -Nru initramfs-tools-0.142+deb12u1/debian/tests/test-common initramfs-tools-0.142+deb12u3/debian/tests/test-common --- initramfs-tools-0.142+deb12u1/debian/tests/test-common 2024-08-22 19:30:14.000000000 +0000 +++ initramfs-tools-0.142+deb12u3/debian/tests/test-common 2025-04-24 15:40:53.000000000 +0000 @@ -21,6 +21,7 @@ CONFDIR="$(mktemp -d)" cp conf/initramfs.conf "${CONFDIR}/initramfs.conf" echo "RESUME=none" >>"${CONFDIR}/initramfs.conf" +mkdir "${CONFDIR}/hooks" touch "${CONFDIR}/modules" mkdir "${CONFDIR}/scripts" diff -Nru initramfs-tools-0.142+deb12u1/hook-functions initramfs-tools-0.142+deb12u3/hook-functions --- initramfs-tools-0.142+deb12u1/hook-functions 2024-08-22 19:30:14.000000000 +0000 +++ initramfs-tools-0.142+deb12u3/hook-functions 2025-04-24 15:40:56.000000000 +0000 @@ -153,12 +153,28 @@ done } -# $1 = file type (for logging) -# $2 = file to copy to initramfs -# $3 (optional) Name for the file on the initramfs -# Location of the image dir is assumed to be $DESTDIR -# If the target exists, we leave it and return 1. -# On any other error, we return >1. +# Copy a file to the initramfs: +# $1 = file type, for debug logging +# $2 = source file name +# $3 (optional) = target file or directory name in the initramfs +# +# * If the target is not specified, it defaults to the source file +# name. +# * If the target is specified and exists as a directory under +# $DESTDIR or ends in a slash, the basename of the source is +# appended to it. +# +# The target file's containing directories are created if necessary. +# +# If the source file name includes a symlink, other than usr-merge +# symlinks, and the canonical name of the source is not the same as +# the target, the source file is copied to its canonical name in the +# initramfs and the target is created as a symlink. +# +# Returns: +# * If the file was copied successfully, 0 +# * If the target file already existed, 1 +# * On error, >1 copy_file() { local type src target link_target @@ -168,7 +184,7 @@ [ -f "${src}" ] || return 2 - if [ -d "${DESTDIR}/${target}" ]; then + if [ -d "${DESTDIR}/${target}" ] || [ "${target%/}" != "$target" ]; then target="${target}/${src##*/}" fi @@ -176,7 +192,12 @@ # will work target="$(realpath -ms "/${target}")" || return 2 - # Canonicalise usr-merged target directories + # Canonicalise usr-merged directories + case "${src}" in + /bin/* | /lib* | /sbin/*) + [ "$(readlink -f /bin)" = /usr/bin ] && src="/usr${src}" + ;; + esac case "${target}" in /bin/* | /lib* | /sbin/*) target="/usr${target}" ;; esac @@ -219,10 +240,16 @@ cp -pP "${src}" "${DESTDIR}/${target}" || return $(($? + 1)) } -# $1 = executable/shared library to copy to initramfs, with dependencies -# $2 (optional) Name for the file on the initramfs -# Location of the image dir is assumed to be $DESTDIR -# We never overwrite the target if it exists. +# Copy an executable or shared library to the initramfs: +# $1 = source file name +# $2 (optional) = target file or directory name in the initramfs +# +# The source and all its shared library dependencies are copied +# using copy_file. +# +# Returns: +# * If the files were copied successfully or already exited, 0 +# * On error, >0 copy_exec() { local src target x nonoptlib ret @@ -528,11 +555,12 @@ class_add_modules "$class" done - # clk, USB-PHY and pinctrl devices are outside the device model (!) so - # match loaded modules by name + # clk, USB-PHY, pinctrl and reset devices are outside the device + # model (!) so match loaded modules by name add_loaded_modules 'clk[-_]*' add_loaded_modules 'phy[-_]*' add_loaded_modules 'pinctrl[-_]*' + add_loaded_modules 'reset[-_]*' # Sys walk keyboards. We identify keyboards as input devices # that can generate at least key events 1-31; udev has the