Discussion:
Bug#860545: debootstrap fails to locate xzcat if the default shell is set to posh
Olliver Schinagl
2017-04-18 11:44:52 UTC
Permalink
Package: debootstrap
Version: 1.0.89
Severity: normal

Dear Maintainer,

Trying to run debootstrap with just acl (the first package in the list) fails
at unpacking due to a missing xzcat

sudo debootstrap --merged-usr --variant=minbase --components=main,non-free
--include=acl jessie /tmp/debtest http://deb.debian.org/debian

I: Chosen extractor for .deb packages: ar
I: Extracting acl...
E: Extracting .//var/cache/apt/archives/acl_2.2.52-2_amd64.deb requires the
xzcat command, which is not available
$ which xzcat
/usr/bin/xzcat


changing /bin/sh -> dash fixes it, but I would have figued that if debootstrap
has its shebang set to /bin/sh, it would work with any posix shell, including
posh.

(I read the warning:
WARNING: Since many of Debian's /bin/sh scripts are not actually policy-
compliant, using posh as your /bin/sh may reveal breakage.)



-- System Information:
Debian Release: 9.0
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages debootstrap depends on:
ii wget 1.18-5

Versions of packages debootstrap recommends:
ii debian-archive-keyring 2014.3
ii gnupg 2.1.18-6

debootstrap suggests no packages.

-- no debconf information
Steve McIntyre
2017-04-18 13:52:00 UTC
Permalink
Post by Olliver Schinagl
Package: debootstrap
Version: 1.0.89
Severity: normal
Dear Maintainer,
Trying to run debootstrap with just acl (the first package in the list) fails
at unpacking due to a missing xzcat
sudo debootstrap --merged-usr --variant=minbase --components=main,non-free
--include=acl jessie /tmp/debtest http://deb.debian.org/debian
I: Chosen extractor for .deb packages: ar
I: Extracting acl...
E: Extracting .//var/cache/apt/archives/acl_2.2.52-2_amd64.deb requires the
xzcat command, which is not available
$ which xzcat
/usr/bin/xzcat
changing /bin/sh -> dash fixes it, but I would have figued that if debootstrap
has its shebang set to /bin/sh, it would work with any posix shell, including
posh.
WARNING: Since many of Debian's /bin/sh scripts are not actually policy-
compliant, using posh as your /bin/sh may reveal breakage.)
Just tested this - it appears that posh doesn't include "type", which
is what debootstrap is using to check what's available. I don't
personally know if "type" is a hard requirement in a posix shell here.
--
Steve McIntyre, Cambridge, UK. ***@einval.com
"We're the technical experts. We were hired so that management could
ignore our recommendations and tell us how to do our jobs." -- Mike Andrews
Sven Joachim
2017-04-18 14:33:55 UTC
Permalink
Post by Steve McIntyre
Post by Olliver Schinagl
Package: debootstrap
Version: 1.0.89
Severity: normal
Dear Maintainer,
Trying to run debootstrap with just acl (the first package in the list) fails
at unpacking due to a missing xzcat
sudo debootstrap --merged-usr --variant=minbase --components=main,non-free
--include=acl jessie /tmp/debtest http://deb.debian.org/debian
I: Chosen extractor for .deb packages: ar
I: Extracting acl...
E: Extracting .//var/cache/apt/archives/acl_2.2.52-2_amd64.deb requires the
xzcat command, which is not available
$ which xzcat
/usr/bin/xzcat
changing /bin/sh -> dash fixes it, but I would have figued that if debootstrap
has its shebang set to /bin/sh, it would work with any posix shell, including
posh.
WARNING: Since many of Debian's /bin/sh scripts are not actually policy-
compliant, using posh as your /bin/sh may reveal breakage.)
Just tested this - it appears that posh doesn't include "type", which
is what debootstrap is using to check what's available. I don't
personally know if "type" is a hard requirement in a posix shell here.
It's not. The portable equivalent would be 'command -v', however posh
does not implement that either, since it only became mandatory in
POSIX.1-2008. I'm afraid there is no easy better solution: while
'which' would always work on Debian systems, it's not guaranteed to be
available elsewhere.

Cheers,
Sven
Ben Hutchings
2017-04-18 14:52:11 UTC
Permalink
Post by Sven Joachim
Post by Steve McIntyre
Post by Olliver Schinagl
Package: debootstrap
Version: 1.0.89
Severity: normal
Dear Maintainer,
Trying to run debootstrap with just acl (the first package in the list) fails
at unpacking due to a missing xzcat
sudo debootstrap  --merged-usr  --variant=minbase --components=main,non-free
--include=acl jessie /tmp/debtest http://deb.debian.org/debian
I: Chosen extractor for .deb packages: ar
I: Extracting acl...
E: Extracting .//var/cache/apt/archives/acl_2.2.52-2_amd64.deb requires the
xzcat command, which is not available
$ which xzcat
/usr/bin/xzcat
changing /bin/sh -> dash fixes it, but I would have figued that if debootstrap
has its shebang set to /bin/sh, it would work with any posix shell, including
posh.
WARNING: Since many of Debian's /bin/sh scripts are not actually policy-
compliant, using posh as your /bin/sh may reveal breakage.)
Just tested this - it appears that posh doesn't include "type", which
is what debootstrap is using to check what's available. I don't
personally know if "type" is a hard requirement in a posix shell here.
It's not.
[...]

No? I noticed the SUS page describing 'type' has an '[XSI]' next to
the name; does that indicate that it's optional? The text is not very
clear.

Ben.
--
Ben Hutchings
The world is coming to an end. Please log off.
Sven Joachim
2017-04-18 15:20:03 UTC
Permalink
Post by Ben Hutchings
Post by Sven Joachim
Post by Steve McIntyre
Just tested this - it appears that posh doesn't include "type", which
is what debootstrap is using to check what's available. I don't
personally know if "type" is a hard requirement in a posix shell here.
It's not.
[...]
No? I noticed the SUS page describing 'type' has an '[XSI]' next to
the name; does that indicate that it's optional?
Yes, XSI extensions are not mandatory, therefore posh does not implement
it. See #397601[1].

Cheers,
Sven


1. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=397601
Steve McIntyre
2017-04-18 14:57:43 UTC
Permalink
Post by Sven Joachim
Post by Steve McIntyre
Just tested this - it appears that posh doesn't include "type", which
is what debootstrap is using to check what's available. I don't
personally know if "type" is a hard requirement in a posix shell here.
It's not. The portable equivalent would be 'command -v', however posh
does not implement that either, since it only became mandatory in
POSIX.1-2008. I'm afraid there is no easy better solution: while
'which' would always work on Debian systems, it's not guaranteed to be
available elsewhere.
Joy. :-(

There are other hacky ways of trying this out - try "type ls" to see
if type works, then fall back to which, etc. Or actually try running
the extractor command (xzcat /dev/null), and check for the return
code.

But those are all hacky solutions. Maybe better to just detect posh
and bail with a message "get a real shell", then...
--
Steve McIntyre, Cambridge, UK. ***@einval.com
Google-bait: http://www.debian.org/CD/free-linux-cd
Debian does NOT ship free CDs. Please do NOT contact the mailing
lists asking us to send them to you.
Sven Joachim
2017-04-18 16:39:01 UTC
Permalink
Control: tags -1 + patch
Post by Steve McIntyre
Post by Sven Joachim
Post by Steve McIntyre
Just tested this - it appears that posh doesn't include "type", which
is what debootstrap is using to check what's available. I don't
personally know if "type" is a hard requirement in a posix shell here.
It's not. The portable equivalent would be 'command -v', however posh
does not implement that either, since it only became mandatory in
POSIX.1-2008. I'm afraid there is no easy better solution: while
'which' would always work on Debian systems, it's not guaranteed to be
available elsewhere.
Joy. :-(
There are other hacky ways of trying this out - try "type ls" to see
if type works, then fall back to which, etc. Or actually try running
the extractor command (xzcat /dev/null), and check for the return
code.
This wouldn't work, since /dev/null is not in xz format. ;-)

Fortunately there is a better solution: Joey Hess has already put an
in_path() function (basically a stripped-down version of debianutils'
which command) that can be used instead. See the attached patch which
worked for me (I did not dare to symlink posh to /bin/sh, but rather
changed the shebang in /usr/sbin/debootstrap to test it).

Cheers,
Sven
Ben Hutchings
2017-04-18 14:47:27 UTC
Permalink
On Tue, 2017-04-18 at 14:52 +0100, Steve McIntyre wrote:
[...]
Post by Steve McIntyre
Just tested this - it appears that posh doesn't include "type", which
is what debootstrap is using to check what's available. I don't
personally know if "type" is a hard requirement in a posix shell here.
It is in the latest POSIX standard (2008) and appears to have been
specified a long time before that (page says 'Issue 2' which means XPG
Issue 2, dating from the 90s). Perhaps it assumes that 'type' will be
an external program, but that's not compliant because it must be able
to find shell aliases. I would consider this a serious bug in posh.

Ben.
--
Ben Hutchings
The world is coming to an end. Please log off.
Thorsten Glaser
2017-07-31 09:27:10 UTC
Permalink
has its shebang set to /bin/sh, it would work with any posix shell, inclu=
ding
posh.
Do note that posh is *not* a POSIX shell, nor suitable for /bin/sh on
Debian systems at all. It contains tons of bugs inherited from pdksh
which I had to fix in mksh, so I feel qualified to say.

bye,
//mirabilos (current hat: mksh-in-Debian maintainer)
--=20
=C2=ABMyISAM tables -will- get corrupted eventually. This is a fact of life=
=2E =C2=BB
=E2=80=9Cmysql is about as much database as ms access=E2=80=9D =E2=80=93 =
=E2=80=9CMSSQL at least descends
from a database=E2=80=9D =E2=80=9Cit's a rebranded SyBase=E2=80=9D =E2=80=
=9CMySQL however was born from a
flatfile and went downhill from there=E2=80=9D =E2=80=93 =E2=80=9Cat least =
jetDB doesn=E2=80=99t claim to
be a database=E2=80=9D=09=E2=80=A3=E2=80=A3=E2=80=A3 Please, http://deb.li/=
mysql and MariaDB, finally die!

Loading...