Bug#1061820: debootstrap fails if target has spaces
Package: debootstrap
Version: 1.0.128+nmu2+deb12u1
Severity: normal
Tags: patch
X-Debbugs-Cc: imwellcushtymelike@gmail.com
Dear Maintainer,
Running a debootstrap where the target directory has a space causes the process to fail.
For example:
debootstrap --arch=i386 --variant=minbase stable "I love spaces" http://localhost:3142/debian
In the log:
grep: /tmp/chroots/I: No such file or directory
grep: like: No such file or directory
grep: spaces/var/lib/apt/lists/localhost:3142_ubuntu_dists_jammy_main_binary-i386_Packages: No such file or directory
grep: /tmp/chroots/I: No such file or directory
grep: like: No such file or directory
grep: spaces/var/lib/apt/lists/localhost:3142_ubuntu_dists_jammy_main_binary-i386_Packages: No such file or directory
I will attach a patch that I have tested on Debian Unstable (and some Ubuntu versions).
Downstream: https://bugs.launchpad.net/ubuntu/+source/debootstrap/+bug/1716079
-- System Information:
Debian Release: 12.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 6.5.0-15-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
Versions of packages debootstrap depends on:
ii wget 1.21.3-1+b1
Versions of packages debootstrap recommends:
pn arch-test <none>
ii debian-archive-keyring 2023.3+deb12u1
pn gnupg <none>
Versions of packages debootstrap suggests:
ii binutils 2.40-2
pn squid-deb-proxy-client <none>
pn ubuntu-archive-keyring <none>
ii xz-utils 5.4.1-0.2
pn zstd <none>
-- no debconf information
diff --git a/functions b/functions
index 1924e89..f5de832 100644
--- a/functions
+++ b/functions
@@ -1673,7 +1673,7 @@ while (read STDIN, $x, 1) {
}' "$@"
elif [ "$1" = "GETDEPS" ]; then
local pkgdest="$2"; shift; shift
-LC_ALL=C grep "$gropt" '^$|^Package:|^Depends:|^Pre-Depends:' $pkgdest | perl -e '
+LC_ALL=C grep "$gropt" '^$|^Package:|^Depends:|^Pre-Depends:' "${pkgdest}" | perl -e '
%seen = map { $_ => 1 } @ARGV;
while (<STDIN>) {
if (/^Package: (.*)$/) {
diff --git a/functions b/functions
index 1924e89..f5de832 100644
--- a/functions
+++ b/functions
@@ -1673,7 +1673,7 @@ while (read STDIN, $x, 1) {
}' "$@"
elif [ "$1" = "GETDEPS" ]; then
local pkgdest="$2"; shift; shift
-LC_ALL=C grep "$gropt" '^$|^Package:|^Depends:|^Pre-Depends:' $pkgdest | perl -e '
+LC_ALL=C grep "$gropt" '^$|^Package:|^Depends:|^Pre-Depends:' "${pkgdest}" | perl -e '
%seen = map { $_ => 1 } @ARGV;
while (<STDIN>) {
if (/^Package: (.*)$/) {
diff --git a/functions b/functions
index 1924e89..f5de832 100644
--- a/functions
+++ b/functions
@@ -1673,7 +1673,7 @@ while (read STDIN, $x, 1) {
}' "$@"
elif [ "$1" = "GETDEPS" ]; then
local pkgdest="$2"; shift; shift
-LC_ALL=C grep "$gropt" '^$|^Package:|^Depends:|^Pre-Depends:' $pkgdest | perl -e '
+LC_ALL=C grep "$gropt" '^$|^Package:|^Depends:|^Pre-Depends:' "${pkgdest}" | perl -e '
%seen = map { $_ => 1 } @ARGV;
while (<STDIN>) {
if (/^Package: (.*)$/) {
Reply to: