Bug#498495: emdebian-tools: embootstrap fails if /bin/sh is not symlinked to /bin/bash
Package: emdebian-tools
Version: 1.4.6
Severity: important
During Extremadura, Wookey discovered a nasty bug in emdebian-tools
whereby the chroot code would fail if /bin/sh was not a symlink to
/bin/bash.
With the upcoming release of Lenny where this is now explicitly
supported, this was a problem. I couldn't see my way through this
problem whilst at Extremadura (possibly something to do with too much
beer, too little air-conditioning and too many other problems to fix)
but I think I have a solution now.
The problem only arises because debootstrap calls exec within itself -
mainly to redirect STDOUT and STDERR. debootstrap itself is POSIX shell
so it is set to #!/bin/sh which is fine. However, during processing,
debootstrap calls first_stage_install which is a function defined in the
suite scripts.
These suite scripts are sourced by debootstrap, not executed, so any
shebang line is ignored. This means that if first_stage_install calls
any bash code, debootstrap fails when /bin/sh is not linked to
/bin/bash.
Initially, I added a manpage warning and thought we might have to live
with this bug for a while.
The bash code involved comes not just from emdebian-tools but from
pbuilder so it is unreasonable to expect pbuilder to change just because
emdebian-tools happens to try and bring the two sets of libraries into
play at the same time.
The pbuilder code itself is the mountproc and related code - I'd rather
not have to fork it with a non-bash version.
However, I think there is a solution for this problem - the pbuilder
code required for building a cross-building chroot is not needed when
building a root filesystem chroot. empdebuild calls pbuilder functions
only after second_stage_install and when using the built chroot for
building packages etc. (when debootstrap has finished).
By splitting empbuilderlib into two libraries, one bash and one POSIX, I
can avoid trying to call pbuilder functions within first_stage_install
when generated the root filesystem chroot as well.
Moving all the first_stage_install routines into a new library,
emrootfslib, and making that library POSIX only will allow the necessary
isolation of the pbuilder code from first_stage_install.
I'm taking the opportunity to also reorganise the directories - POSIX
code will live in /usr/share/ and code that absolutely must rely on
pbuilder code lives alongside pbuilder code in /usr/lib/. (If pbuilder
eventually moves to /usr/share/pbuilder/, the pbuilder code will move to
/usr/share/emdebian-tools/.)
This problem exists in the version of emdebian-tools in Lenny and Sid -
a fixed package will probably be backported along with other important
changes, after Lenny is released.
-- Package-specific info:
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages emdebian-tools depends on:
ii automake 1:1.10.1-3 A tool for generating GNU Standard
ii automake1.9 1.9.6+nogfdl-3 A tool for generating GNU Standard
ii cdbs 0.4.52 common build system for Debian pac
ii dbs 0.45 Allows Debian source packages with
ii debhelper 7.0.17 helper programs for debian/rules
ii dpatch 2.0.30 patch maintenance system for Debia
ii dpkg-dev 1.14.22 Debian package development tools
ii emdebian-qa 1.4.6 emdebian quality assurance support
ii emdebian-rootfs 1.4.6 emdebian root filesystem support
ii fakeroot 1.9.6 Gives a fake root environment
ii g++ 4:4.3.1-2 The GNU C++ compiler
ii gcc 4:4.3.1-2 The GNU C compiler
ii gettext 0.17-4 GNU Internationalization utilities
ii libcache-apt-perl 0.12.3 object oriented apt cache perl bin
ii libdebian-dpkgcross-perl 2.3.1 functions to aid cross-compiling D
ii libemdebian-tools-perl 1.4.6 emdebian support library
ii libsoap-lite-perl 0.710.08-1 Client and server side SOAP implem
ii lsb-release 3.2-20 Linux Standard Base version report
ii perl 5.10.0-13 Larry Wall's Practical Extraction
ii quilt 0.46-6 Tool to work with series of patche
ii subversion 1.5.1dfsg1-1 Advanced version control system
ii sudo 1.6.9p17-1 Provide limited super user privile
ii ucf 3.0010 Update Configuration File: preserv
Versions of packages emdebian-tools recommends:
ii less 418-1 Pager program similar to more
Versions of packages emdebian-tools suggests:
ii deb-gview 0.2.2 GNOME viewer for .deb package file
ii debian-xcontrol 0.0.2~pre1+nmu2 Extended syntax for debian/control
ii file-roller 2.22.4-2 an archive manager for GNOME
ii meld 1.1.5.1-2 graphical tool to diff and merge f
ii mutt 1.5.18-4 text-based mailreader supporting M
ii reportbug 3.45 reports bugs in the Debian distrib
ii wiggle 0.6-6 a program for applying patches wit
-- debconf information:
* emsource/svnusername: codehelp
* emsetup/aptagent: true
* emsource/targetsuite: unstable
* emsource/workdir: /opt/emdebian/
emsetup/primary:
Reply to: