Bug#623356: live-build: be more careful with subshells
Package: live-build
Version: 3.0~a11-1
Severity: normal
In bash, and dash, the Grouping Commands builtin structure commands are "(list)" or "{list;}"
The first of these executes the commands in a subshell. The second form
does not fork another shell so is slightly more efficient.
Simple verification of command exit status in scripts:
The follow expressions is wrong, because exits from a subshell, no from current shell:
command || (echo "error" ; exit 1)
The correct form is:
command || {echo "error" ; exit 1;}
--- /scripts/build/lb_binary_local-hooks.old 2011-04-19 10:16:53.290043819 -0300
+++ /scripts/build/lb_binary_local-hooks 2011-04-19 10:17:49.098793548 -0300
@@ -50,7 +50,7 @@
fi
# Executing hook
- ./"${HOOK}" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 )
+ ./"${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
done
# Creating stage file
--- /scripts/build/lb_chroot_hooks.old 2011-04-19 10:32:18.348793894 -0300
+++ /scripts/build/lb_chroot_hooks 2011-04-19 10:32:33.898792823 -0300
@@ -55,7 +55,7 @@
fi
# Executing hook
- Chroot chroot "./root/${HOOK}" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 )
+ Chroot chroot "./root/${HOOK}" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
# Removing hook
rm -f chroot/root/"${HOOK}"
--- /scripts/build/lb_chroot_local-hooks.old 2011-04-19 10:34:58.940043769 -0300
+++ /scripts/build/lb_chroot_local-hooks 2011-04-19 10:35:08.789160375 -0300
@@ -56,7 +56,7 @@
fi
# Executing hook
- Chroot chroot "/root/$(basename ${HOOK})" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 )
+ Chroot chroot "/root/$(basename ${HOOK})" || { Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;}
# Removing hook
rm -f chroot/root/"$(basename ${HOOK})"
-- Package-specific info:
-- System Information:
Debian Release: squeeze/sid
APT prefers lucid-updates
APT policy: (500, 'lucid-updates'), (500, 'lucid')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-28-generic (SMP w/2 CPU cores)
Locale: LANG=es_AR.utf8, LC_CTYPE=es_AR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages live-build depends on:
ii debootstrap 1.0.20ubuntu1.2 Bootstrap a basic Debian system
Versions of packages live-build recommends:
ii cpio 2.10-1ubuntu2 GNU cpio -- a program to manage ar
ii gettext-base 0.17-8ubuntu3 GNU Internationalization utilities
pn gnu-fdisk <none> (no description available)
Versions of packages live-build suggests:
ii dosfstools 3.0.7-1 utilities for making and checking
ii fakeroot 1.14.4-1ubuntu1 Gives a fake root environment
ii genisoimage 9:1.1.10-1ubuntu1 Creates ISO-9660 CD-ROM filesystem
ii memtest86+ 4.00-2ubuntu3 thorough real-mode memory tester
ii mtools 4.0.10-1ubuntu1 Tools for manipulating MSDOS files
ii parted 2.2-5ubuntu5.1 The GNU Parted disk partition resi
pn squashfs-tools | <none> (no description available)
ii sudo 1.7.2p1-1ubuntu5.3 Provide limited super user privile
ii syslinux 2:3.63+dfsg-2ubuntu3 Bootloader for Linux/i386 using MS
ii uuid-runtime 2.17.2-0ubuntu1.10.04.2 runtime components for the Univers
pn win32-loader <none> (no description available)
-- no debconf information
Reply to: