Bug 95566 - ports/bash mishandles PREFIX (patch)
ports/bash mishandles PREFIX (patch)
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: obrien
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-04-10 06:20 UTC by andrew
Modified: 2007-06-29 00:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andrew 2006-04-10 06:20:13 UTC
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.

Fix: The following changes seem to do the trick.




------------------------------------------------------------------- 
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--6dpXZW52iBhVe1X5PiTnrnACsN5NEwuT0suVuoXcJwRvXVUu
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- 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
How-To-Repeat: 
  cd /usr/ports/shells/bash
  make install clean PREFIX=/ WITH_STATIC_BASH
  grep '//bin/bash' /etc/shells
Comment 1 Mark Linimon freebsd_committer 2006-04-11 22:49:49 UTC
Responsible Changed
From-To: freebsd-ports-bugs->obrien

Over to maintainer.
Comment 2 dfilter freebsd_committer 2007-06-29 00:33:50 UTC
obrien      2007-06-28 23:33:44 UTC

  FreeBSD ports repository

  Modified files:
    shells/bash          pkg-deinstall pkg-install 
  Log:
  Support PREFIX=/
  
  PR:             95566
  Submitted by:   Andrew McNaughton <andrew@scoop.co.nz>
  
  Revision  Changes    Path
  1.4       +3 -3      ports/shells/bash/pkg-deinstall
  1.4       +3 -3      ports/shells/bash/pkg-install
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 obrien freebsd_committer 2007-06-29 00:33:56 UTC
State Changed
From-To: open->closed

Please see if the latest commit to shells/bash meets your needs. 
thanks!