[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#616605: 'Execute shell in <installation>' runs /bin/sh not /bin/bash



Package: rescue-mode
Version: 1.26
Severity: important
Tags: patch

Since /bin/sh is now linked to dash by default, /bin/sh is a poor
choice for an interactive shell.  Not everyone will think to use
'exec bash', so try bash first.

Ben.

-- System Information:
Debian Release: wheezy/sid
  APT prefers oldstable-proposed-updates
  APT policy: (500, 'oldstable-proposed-updates'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.37-2-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/dash
>From 0fdf6b422191121f46c9fd011bea5ea10c2265c2 Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Sat, 5 Mar 2011 22:36:13 +0000
Subject: [PATCH] rescue-mode: Try executing bash before /bin/sh

Since /bin/sh is now linked to dash by default, /bin/sh is a poor
choice for an interactive shell.  Not everyone will think to use
'exec bash', so try bash first.
---
 rescue.d/shell |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/rescue.d/shell b/rescue.d/shell
index ae67c82..785f260 100755
--- a/rescue.d/shell
+++ b/rescue.d/shell
@@ -32,7 +32,9 @@ shell_failed () {
 	db_capb backup
 }
 
-if [ -f /target/bin/sh ] && [ -x /target/bin/sh ]; then
+if chroot_has bash; then
+	chroot_run 'bash -i' || shell_failed 'bash -i'
+elif [ -f /target/bin/sh ] && [ -x /target/bin/sh ]; then
 	chroot_run /bin/sh -i || shell_failed '/bin/sh -i'
 elif chroot_has sash; then
 	chroot_run sash || shell_failed sash
-- 
1.7.4.1


Reply to: