From 1e7ef9d064d8bf23039a1d06e73a906bfade8b77 Mon Sep 17 00:00:00 2001 From: Nikita Maslo <103246874+QwaSeeK@users.noreply.github.com> Date: Sat, 27 Dec 2025 08:15:36 +0300 Subject: [PATCH] fix(rootfs): unset GIT_FIXED_WORKDIR after debootstrap/mmdebstrap clone (#9132) * fix(rootfs): pass GIT_FIXED_WORKDIR inline to fetch_from_repo Instead of using 'export GIT_FIXED_WORKDIR' and then 'unset' after, pass the variable inline to the fetch_from_repo call. This ensures the variable only exists in the context of that specific command and doesn't leak into subsequent calls. This follows the same pattern used in uboot-git.sh and kernel-git.sh. --------- Co-authored-by: Viacheslav Bocharov --- lib/functions/rootfs/rootfs-create.sh | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/functions/rootfs/rootfs-create.sh b/lib/functions/rootfs/rootfs-create.sh index a4d0c9433e..1a74a3212e 100644 --- a/lib/functions/rootfs/rootfs-create.sh +++ b/lib/functions/rootfs/rootfs-create.sh @@ -100,35 +100,38 @@ function create_new_rootfs_cache_via_debootstrap() { case "${DISTRIBUTION}" in Ubuntu) if [[ "${LEGACY_DEBOOTSTRAP,,}" == "yes" ]]; then - export GIT_FIXED_WORKDIR="debootstrap-ubuntu-devel" - fetch_from_repo "https://git.launchpad.net/ubuntu/+source/debootstrap" "debootstrap-ubuntu-devel" "tag:import/1.0.118ubuntu1.13" - debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}" + declare debootstrap_name="debootstrap-ubuntu-devel" + GIT_FIXED_WORKDIR="${debootstrap_name}" \ + fetch_from_repo "https://git.launchpad.net/ubuntu/+source/debootstrap" "${debootstrap_name}" "tag:import/1.0.118ubuntu1.13" + debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}" debootstrap_default_script="gutsy" debootstrap_version="$(sed 's/.*(\(.*\)).*/\1/; q' "${debootstrap_wanted_dir}/debian/changelog")" debootstrap_bin="${debootstrap_wanted_dir}/debootstrap" else - export GIT_FIXED_WORKDIR="mmdebstrap-ubuntu-devel" + declare debootstrap_name="mmdebstrap-ubuntu-devel" #FIXME: branch should be a variable eventually - fetch_from_repo "https://git.launchpad.net/ubuntu/+source/mmdebstrap" "${GIT_FIXED_WORKDIR}" "branch:ubuntu/noble" - debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}" + GIT_FIXED_WORKDIR="${debootstrap_name}" \ + fetch_from_repo "https://git.launchpad.net/ubuntu/+source/mmdebstrap" "${debootstrap_name}" "branch:ubuntu/noble" + debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}" debootstrap_version="$(sed 's/.*(\(.*\)).*/\1/; q' "${debootstrap_wanted_dir}/debian/changelog")" debootstrap_bin="${debootstrap_wanted_dir}/mmdebstrap" fi ;; Debian) if [[ "${LEGACY_DEBOOTSTRAP,,}" == "yes" ]]; then - export GIT_FIXED_WORKDIR="debootstrap-debian-devel" - fetch_from_repo "https://salsa.debian.org/installer-team/debootstrap.git" "debootstrap-debian-devel" "branch:master" - debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}" + declare debootstrap_name="debootstrap-debian-devel" + GIT_FIXED_WORKDIR="${debootstrap_name}" \ + fetch_from_repo "https://salsa.debian.org/installer-team/debootstrap.git" "${debootstrap_name}" "branch:master" + debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}" debootstrap_default_script="sid" debootstrap_version="$(sed 's/.*(\(.*\)).*/\1/; q' "${debootstrap_wanted_dir}/debian/changelog")" debootstrap_bin="${debootstrap_wanted_dir}/debootstrap" else - export GIT_FIXED_WORKDIR="mmdebstrap-debian-devel" + declare debootstrap_name="mmdebstrap-debian-devel" #FIXME: branch should be a variable eventually - fetch_from_repo "https://gitlab.mister-muffin.de/josch/mmdebstrap" "${GIT_FIXED_WORKDIR}" "branch:main" - debootstrap_wanted_dir="${SRC}/cache/sources/${GIT_FIXED_WORKDIR}" - debootstrap_default_script="sid" + GIT_FIXED_WORKDIR="${debootstrap_name}" \ + fetch_from_repo "https://gitlab.mister-muffin.de/josch/mmdebstrap" "${debootstrap_name}" "branch:main" + debootstrap_wanted_dir="${SRC}/cache/sources/${debootstrap_name}" debootstrap_version="$(sed 's/^## \[\([^]]*\)\].*/\1/; q' "${debootstrap_wanted_dir}/CHANGELOG.md")" debootstrap_bin="${debootstrap_wanted_dir}/mmdebstrap" fi