Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Apr 2006 17:15:59 +1200 (NZST)
From:      Andrew McNaughton <andrew@scoop.co.nz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/95566: ports/bash mishandles PREFIX (patch)
Message-ID:  <200604090515.k395FxHu000498@laika.scoop.co.nz>
Resent-Message-ID: <200604100520.k3A5KEm1067675@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         95566
>Category:       ports
>Synopsis:       ports/bash mishandles PREFIX (patch)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 10 05:20:13 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Andrew McNaughton <andrew@scoop.co.nz>
>Release:        FreeBSD 6.0-RELEASE i386
>Organization:
Scoop Media Ltd http://www.scoop.co.nz/
>Environment:
System: FreeBSD laika.scoop.co.nz 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov 3 09:36:13 UTC 2005 root@x64.samsco.home:/usr/obj/usr/src/sys/GENERIC i386


>Description:

In order to have a familiar (fast) environment in a situation where I can't mount all my partitions, I want bash at /bin/bash, statically built.  I also wan't portupgrade to upgrade bash safely without locking me out of accounts which specify their shell as /bin/bash.

This should be no problem.  There's an option for building a static binary, and I can set the PREFIX variable.

Unfortunately, Compilation fails if I try to set PREFIX="", and if I set PREFIX=/, everything builds and installs OK, except that /etc/shells gets a line with '//bin/bash' instead of '/bin/bash', which means I can get locked out.

Sure, most people don't install this way, but the consequences are serious.

>How-To-Repeat:

  cd /usr/ports/shells/bash
  make install clean PREFIX=/ WITH_STATIC_BASH
  grep '//bin/bash' /etc/shells

  
>Fix:

The following changes seem to do the trick.


--- bash.orig/pkg-deinstall     Fri Oct 15 02:24:20 2004
+++ bash/pkg-deinstall  Sun Apr  9 13:24:51 2006
@@ -3,7 +3,12 @@
 # $FreeBSD: ports/shells/bash/pkg-deinstall,v 1.2 2004/10/14 13:24:20 eik Exp $
 #
 
-BASH="${PKG_PREFIX-/usr/local}/bin/bash"
+if [ x"$PKG_PREFIX" = x"/" ]; then
+  BASH="/bin/bash"
+else
+  BASH="${PKG_PREFIX-/usr/local}/bin/bash"
+fi
+
 SHELLS="${PKG_DESTDIR-}/etc/shells"
 
 case $2 in
diff -urN bash.orig/pkg-install bash/pkg-install
--- bash.orig/pkg-install       Fri Oct 15 02:24:20 2004
+++ bash/pkg-install    Sun Apr  9 13:24:39 2006
@@ -3,7 +3,12 @@
 # $FreeBSD: ports/shells/bash/pkg-install,v 1.2 2004/10/14 13:24:20 eik Exp $
 #
 
-BASH="${PKG_PREFIX-/usr/local}/bin/bash"
+if [ x"$PKG_PREFIX" = x"/" ]; then
+  BASH="/bin/bash"
+else
+  BASH="${PKG_PREFIX-/usr/local}/bin/bash"
+fi
+
 SHELLS="${PKG_DESTDIR-}/etc/shells"
 
 case $2 in



------------------------------------------------------------------- 
Andrew McNaughton           http://www.scoop.co.nz/
andrew@scoop.co.nz          Mobile: +61 422 753 792
                            pgp keyid: 1C7A8CFD
--
"Those who can make you believe absurdities can make you commit atrocities."
 -- Voltaire
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604090515.k395FxHu000498>