From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 11 18:55:38 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D811C445 for ; Wed, 11 Feb 2015 18:55:38 +0000 (UTC) Received: from st11p02mm-asmtp002.mac.com (st11p02mm-asmtp002.mac.com [17.172.220.237]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3881A98 for ; Wed, 11 Feb 2015 18:55:38 +0000 (UTC) Received: from st11p02mm-spool002.mac.com ([17.172.220.247]) by st11p02mm-asmtp002.mac.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Dec 4 2014)) with ESMTP id <0NJM0050ZF7ROB70@st11p02mm-asmtp002.mac.com> for freebsd-hackers@freebsd.org; Wed, 11 Feb 2015 18:55:03 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-02-11_04:2015-02-11,2015-02-11,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412110000 definitions=main-1502110187 MIME-version: 1.0 Received: from localhost ([17.172.220.163]) by st11p02mm-spool002.mac.com (Oracle Communications Messaging Server 7.0.5.33.0 64bit (built Aug 27 2014)) with ESMTP id <0NJM00IPNF7QD570@st11p02mm-spool002.mac.com>; Wed, 11 Feb 2015 18:55:02 +0000 (GMT) To: perryh@pluto.rain.com From: Rui Paulo Subject: Re: RFC: make init(8) aware of /rescue/sh Date: Wed, 11 Feb 2015 18:55:01 +0000 (GMT) X-Mailer: iCloud MailClient15A99 MailServer14H18.17359 X-Originating-IP: [12.218.212.178] Message-id: <57cd8ba3-e391-45f1-adae-2806800e4a97@me.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2015 18:55:38 -0000 On Feb 11, 2015, at 02:31 AM, perryh@pluto.rain.com (Perry Hutchison) wrot= e:=0A=0ASeems to me it might be desirable for init(8) to fall back=0Ato /r= escue/sh for single-user mode if neither the default=0A(kenv:init_shell) n= or /bin/sh is usable. Thoughts?=0A=0A(Patch generated against stable/8, bu= t will likely apply to=0AHEAD also -- not much has changed in init.)=0A=0A= --- init.c-orig=0A+++ init.c=0A@@ -79,6 +79,9 @@=0A#include =0A= #endif=0A=0A+/* Ideally this value should come from the RESCUE side of pat= hs.h */=0A+#define =C2=A0 =C2=A0 =C2=A0 =C2=A0_PATH_R_BSHELL =C2=A0 =C2=A0= "/rescue/sh"=0A+=0A#include "pathnames.h"=0A=0A/*=0A@@ -706,7 +709,8 @@=0A= =0A=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/*=0A=C2=A0 =C2=A0 =C2=A0 * Fire off = a shell.=0A- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * If the default one doesn= 't work, try the Bourne shell.=0A+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= * If the default one doesn't work, try the Bourne shell;=0A+ =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 * if that doesn't work either, try the rescue= shell.=0A=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */=0A=0A=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0char name[] =3D "-sh";=0A@@ -717,6 +721,8 @@=0A=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0emergency("can't exec %s f= or single user: %m", shell);=0A=C2=A0 =C2=A0 =C2=A0execv(_PATH_BSHELL, arg= v);=0A=C2=A0 =C2=A0 =C2=A0emergency("can't exec %s for single user: %m", _= PATH_BSHELL);=0A+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0execv(_PATH_R_B= SHELL, argv);=0A+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0emergency("can't exec = %s for single user: %m", _PATH_R_BSHELL);=0A=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0sleep(STALL_TIMEOUT);=0A=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0_exit(1);=0A=C2=A0 =C2=A0}=0A=C2=A0=0AThis makes sense to me= . :-)=