From owner-freebsd-questions@FreeBSD.ORG Sun Nov 16 08:20:34 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 888C31065680 for ; Sun, 16 Nov 2008 08:20:34 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (agora.rdrop.com [199.26.172.34]) by mx1.freebsd.org (Postfix) with ESMTP id 617B58FC08 for ; Sun, 16 Nov 2008 08:20:33 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id mAG8KX7B063753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 16 Nov 2008 00:20:33 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.12.9/Submit) with UUCP id mAG8KXve063752; Sun, 16 Nov 2008 00:20:33 -0800 (PST) Received: from fbsd61 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA08626; Sun, 16 Nov 08 00:18:04 PST Date: Sun, 16 Nov 2008 00:22:11 -0800 From: perryh@pluto.rain.com To: koitsu@freebsd.org Message-Id: <491fd833.zbV+im4fHqUJ5RRJ%perryh@pluto.rain.com> References: <20081110110805.GK1302@obspm.fr> <20081110161002.GA81960@gizmo.acns.msu.edu> <20081110203643.GH27646@obspm.fr> <200811102235.46971.fbsd.questions@rachie.is-a-geek.net> <4ad871310811101530p7b2baa0fk7f7b5118e314c11d@mail.gmail.com> <4918CE42.3050504@ccstores.com> <20081115061957.GA10998@ourbrains.org> <20081116023239.GA89267@icarus.home.lan> <20081116033624.GA13618@ourbrains.org> <20081116050107.GA91940@icarus.home.lan> In-Reply-To: <20081116050107.GA91940@icarus.home.lan> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: root /etc/csh X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Nov 2008 08:20:34 -0000 > > > > ... Why doesn't FreeBSD ship bash and other shells besides > > > > the `sh' linked statically is beyond me. It wouldn't break > > > > ports, would it? > > > > > > It does break ports. Very, very badly. I know because I've > > > personally attempted replacing /bin/sh with bash as a "I have > > > a weekend to spare" project. > > > > You misunderstand. I do not suggest replacing the standard shell > > with bash, I suggest that the shells available in FreeBSD, even > > through ports to be linked statically so they can be used for > > rescue and recovery. If the default make instructions told to > > compile statically, it wouldn't break the ports. > > You're right -- I'm still not understanding. So let me cover the > bases here: > > 1) The entire ports and FreeBSD build system (see: world) rely > heavily on /bin/sh-isms and do not work with bash. bash being > compiled statically will not solve these problems. If this is accurate, it should be reported to the bash maintainers as a bug. Bash claims complete Posix compatibility (plus extensions). In any event, it is irrelevant to the OP's point. > 2) Changing the root users' shell is not recommended. There are > a lot of reasons for this, but as mentioned, the main one is > single-user scenarios (where /usr hasn't been mounted yet, thus > /usr/local/bin/bash is not available -- and if it's installed as > /bin/bash, the libraries /bin/bash link to are not available). This, of course, being the whole point of the OP's suggestion to link port shells statically. > 3) You can build bash statically; make WITH_STATIC_BASH=true. I do > not know the true reason why the port is not built statically by > default, but I can give you a damn good reason why it shouldn't be: > complete and total wasted memory. > > Take into consideration environments where there are hundreds (or at > my place of work, thousands) of users logged into a machine at once. > Many of those are going to have /usr/local/bin/bash as their shell. > A statically-linked version of bash would waste significant amounts > of memory, while a dynamically-linked/shared version would ease that > pain. The same applies for any static vs. dynamic program. How so? Wouldn't a single in-memory instance of the bash text segment be shared among all bash processes, across all users? Granted, there is, in effect, *one* extra instance of the part of libc that gets linked into the static bash. A better reason is that security updates to shared libs often update only the .so files, expecting the binaries that use them to automatically pick up the new versions. Any static executable should be rebuilt any time there is a security update to a shared lib that it would be using were it linked dynamically. That said, perhaps it would be reasonable for shell ports to build both a dynamically-linked instance to be installed in /usr/local/bin, and a statically-linked instance to be installed in, say, /usr/local/static. Those who want to use bash as the root shell could copy it from there to /bin or /sbin.