Bug#762713: debootstrap should set -e

2014-09-25 Thread Askar Safin
Sorry for Also, please make a decision-part of my prev. e-mail. I thought 
that export PATH makes sense only if we do . /usr/sbin/debootstrap (i. e. 
include one shell script in another). But then I understand that export PATH 
is really good in init=/bin/sh environments (because shells set PATH, but don't 
export it).

==
Askar Safin
http://vk.com/safinaskar
Moscow, Russia
Moscow State University, http://msu.ru , Faculty of Mechanics and Mathematics, 
Department of Mathematical Logic and Theory of Algorithms

Bug#762713: debootstrap should set -e

2014-09-24 Thread Askar Safin
Package: debootstrap
Version: 1.0.48+deb7u1
Severity: normal
Tags: d-i patch

Currently debootstrap script starts with #!/bin/sh -e. This means -e option 
will not be set if debootstrap is started, for example, via bash 
/usr/sbin/debootstrap. So, please, apply this patch (more text after patch 
follows):
BEGIN OF PATCH

--- /usr/sbin/debootstrap   2013-06-03 19:00:00.0 +0400
+++ /tmp/patched2014-09-24 20:43:06.630438880 +0400
@@ -1,4 +1,6 @@
-#!/bin/sh -e
+#!/bin/sh
+
+set -e
 
 VERSION='1.0.48+deb7u1'
 
END OF PATCH

Also, let me say why it so important to have set -e: I discovered 
http://bugs.debian.org/762304 and then I tried to debug it. I know that trap 
command behaves differently in bash and dash. So, I tried to run debootstrap in 
bash and I typed: bash /usr/bin/debootstrap. But this throwed away -e 
option, so debootstrap did not stop after the first error and flooded all my 
screen with error messages. So, as you can see, there is real use case, where 
set -e is needed.

Also, please make a decision about what is intended use of debootstrap and what 
is not, In the following list:
1. debootstrap
2. sh /usr/sbin/debootstrap
3. . /usr/sbin/debootstrap (note dot in the begin of line)
4. /vmlinuz init=/usr/sbin/debootstrap
5. /vmlinuz init=/bin/sh /usr/sbin/debootstrap

In the 2, 3, 5 you need set -e.
In the 3 you need export PATH.
So, export PATH is useless in all cases except for very strange 3, so it is 
very strange that you have export PATH in the sources, but don't have set 
-e.

=

-- System Information:
Debian Release: 7.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages debootstrap depends on:
ii  wget  1.13.4-3+deb7u1

Versions of packages debootstrap recommends:
ii  debian-archive-keyring  2012.4
ii  gnupg   1.4.12-7+deb7u4

debootstrap suggests no packages.

-- no debconf information

==
Askar Safin
http://vk.com/safinaskar
Moscow, Russia
Moscow State University, http://msu.ru , Faculty of Mechanics and Mathematics, 
Department of Mathematical Logic and Theory of Algorithms