--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: debootstrap: cannot specify --foreign and --unpack-tarball at the same time
- From: Cel Skeggs <cela@mit.edu>
- Date: Sun, 15 Dec 2019 14:59:40 -0500
- Message-id: <157643998006.15079.15297625424083440771.reportbug@localhost>
Package: debootstrap
Version: 1.0.114
Severity: normal
Tags: patch
Dear Maintainer,
After upgrading to Buster, one of my scripts that uses debootstrap has stopped
working, specifically on a step that involves both the --foreign option and the
--unpack-tarball option.
Reproduction steps:
$ sudo debootstrap --variant=minbase --make-tarball=test.tgz stretch test
$ sudo debootstrap --variant=minbase --foreign --unpack-tarball=$PWD/test.tgz stretch test
When I run the second command, I get the following output:
/usr/sbin/debootstrap: 266: [: --unpack-tarball=/homeworld/reproduce/test.tgz: unexpected operator
E: --foreign is specified with --unpack-tarball=/homeworld/reproduce/test.tgz, please use only one of those options.
I would expect that these two options could be used together, and there appears
to be code provided in /usr/share/debootstrap/functions that would allow this
particular combination:
########################################################### option handling
check_conflicting_option () {
if [ "$set_what_to_do" = --foreign ] && [ "${1%%=*}" = --unpack-tarball ] || \
[ "${set_what_to_do%%=*}" = "--unpack-tarball" ] && [ "$1" == --foreign ]; then
LOOSEN_CONFLICTING_RESTRICTION="true"
elif [ -n "$set_what_to_do" ]; then
error 1 ARG_CONFLICTING "$set_what_to_do is specified with $1, please use only one of those options."
fi
set_what_to_do="$1"
}
It seems to me that there are two bugs here:
* sh's test builtin does not support '==', whereas bash's does, so the use
of '==' causes the 'unexpected operator' error above.
* sh's order of operations does not distinguish between && and ||, so the
series of logical operators mean ((A && B) || C) && D, rather than
(A && B) || (C && D).
I was able to solve this, at least for my use case, with the following patch:
--- /usr/share/debootstrap/functions 2019-12-15 14:20:12.689000000 -0500
+++ /usr/share/debootstrap/functions 2019-12-15 14:20:27.872000000 -0500
@@ -262,8 +262,8 @@
########################################################### option handling
check_conflicting_option () {
- if [ "$set_what_to_do" = --foreign ] && [ "${1%%=*}" = --unpack-tarball ] || \
- [ "${set_what_to_do%%=*}" = "--unpack-tarball" ] && [ "$1" == --foreign ]; then
+ if ( [ "$set_what_to_do" = --foreign ] && [ "${1%%=*}" = --unpack-tarball ] ) || \
+ ( [ "${set_what_to_do%%=*}" = "--unpack-tarball" ] && [ "$1" = --foreign ] ); then
LOOSEN_CONFLICTING_RESTRICTION="true"
elif [ -n "$set_what_to_do" ]; then
error 1 ARG_CONFLICTING "$set_what_to_do is specified with $1, please use only one of those options."
I believe this bug was introduced by commit 25d80b10319ed292827d016bfea6edcdb51b9b52,
during the fix for bug #551838.
-- System Information:
Debian Release: 10.2
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.19.84-1.pvops.qubes.x86_64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
Versions of packages debootstrap depends on:
ii wget 1.20.1-1.1
Versions of packages debootstrap recommends:
pn arch-test <none>
ii debian-archive-keyring 2019.1
ii gnupg 2.2.12-1+deb10u1
Versions of packages debootstrap suggests:
pn squid-deb-proxy-client <none>
pn ubuntu-archive-keyring <none>
-- no debconf information
--- End Message ---
--- Begin Message ---
Source: debootstrap
Source-Version: 1.0.119
Done: Hideki Yamane <henrich@debian.org>
We believe that the bug you reported is fixed in the latest version of
debootstrap, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 946783@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Hideki Yamane <henrich@debian.org> (supplier of updated debootstrap package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Thu, 27 Feb 2020 21:16:24 +0900
Source: debootstrap
Architecture: source
Version: 1.0.119
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Hideki Yamane <henrich@debian.org>
Closes: 946476 946783
Changes:
debootstrap (1.0.119) unstable; urgency=medium
.
[ Hideki Yamane ]
* Fix: specify --foreign and --unpack-tarball at the same time
Thanks to Cel Skeggs <cela@mit.edu> for the patch (Closes: #946783)
* Add check rule for systemd-nspawn
.
[ Jeremiah C. Foster ]
* Adding PureOS 'amber' to scripts dir (Closes: #946476)
Checksums-Sha1:
9a13ee1ae54a113dc53f0dcb9da2aadb99b15e35 1919 debootstrap_1.0.119.dsc
bfb3eaf5a1d739ecdd78cb506e540e75fdca9649 76738 debootstrap_1.0.119.tar.gz
6a4d94c91e6a6429b58c29c47041360ca380cc57 5935 debootstrap_1.0.119_amd64.buildinfo
Checksums-Sha256:
9806c467aa5297f16a72121eff52f899a2861b9d617b56f056be2f7af83a3bc3 1919 debootstrap_1.0.119.dsc
e6bebac0ed001a1bb44aee7076871dacdd2ceb7210fd08e449d5b2526be1b3e0 76738 debootstrap_1.0.119.tar.gz
46463a20a992981670897d4edc9c2bfbdfd5284088c74039920c09d3513a7ce8 5935 debootstrap_1.0.119_amd64.buildinfo
Files:
df65e22903cee098f5e4cda3d05ffe60 1919 admin optional debootstrap_1.0.119.dsc
d4ea6a2aae0dc4bdb156523d42653b7e 76738 admin optional debootstrap_1.0.119.tar.gz
3231fb3e7c14c0b4a31e6a0eadf9a394 5935 admin optional debootstrap_1.0.119_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEWOEiL5aWyIWjzRBMXTKNCCqqsUAFAl5XtpIACgkQXTKNCCqq
sUAFFQ//bLXBHuht+gdIdtAY7ntDX40+nKwN2R1ocgwUCmAyERVKxKhCaqf1Qh1B
srTHZtSaSSCMsds8y9o8PDeVS9OKGR3ZELDVzJig/Q2HPdHIYEAMNW/Ov6biT5q/
bTO8rjpC49kCwseTKctOzbyxZlpMRseXGNtSyF8JQQa/zhhJoxeJ1ovtch8xlnT2
pzfLvnszafp5A1YiYZ6urVExu6ykjyd2mY4Bo8i81XsI0gYN8LmRIVoWNAw7x67P
iAEsCil7YNrOG8PQDU2YaLKXo+kXk/NTHvqF5uJ/mmk+VgUALmLTdkVUBhOiI3JA
SAVZd8fXxJ3gU3xG/jNr+TJKe+svFOsIY85NngLV0DwQtYY7ixgCUkoH2eVdz9n4
MCEMJe5lp1F38680x6jT7ThBfeSyKlPmj+mHt8tutjKxurqy5BXhJI99eSimVeNh
0CsBssOgNOp9SSLgjqcuLizVLh4lPYExl6m+o8z5OQyCs6+lQvCfh+bncHq63yug
a2c77OQyKR5N2zwa9I3ZF1vDr5VVE4h6Wfk6sQOmuVNTH/soQpD/7grEKYrvcfC/
0Q0eGbWOnRT4SNMYOg18ATaVoL+mEmDAl/m4ZNfq1EU2KcdZUto81zXJwgu0FM1s
4tLiSNanrw81r7/7B8yrUQqUNCRVNR2CSp0bEzNw8e3jSK5Mc9s=
=r2Na
-----END PGP SIGNATURE-----
--- End Message ---