Subject: Re: pkg/28510
To: None <jlam@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org>
From: Frederick Bruckman <fredb@immanent.net>
List: pkgsrc-bugs
Date: 03/28/2005 15:40:02
The following reply was made to PR pkg/28510; it has been noted by GNATS.

From: fredb@immanent.net (Frederick Bruckman)
To: gnats-bugs@netbsd.org
Cc: "Julio M. Merino Vidal" <jmmv84@gmail.com>,
	Robert Elz <kre@munnari.OZ.AU>
Subject: Re: pkg/28510
Date: Mon, 28 Mar 2005 09:39:01 -0600 (CST)

 In article <20050328082401.EA1A863B11C@narn.netbsd.org>,
 	"Julio M. Merino Vidal" <jmmv84@gmail.com> writes:
 > 
 >  On Mon, 2005-03-28 at 03:34 +0000, Robert Elz wrote:
 > >  Adding more baroque env vars into X is just what it doesn't need (and in
 > >  any case, any of that requires every user to go set the thing).   Doing
 > >  it as suggested in the original PR, and simply having the X build know
 > >  where LOCALBASE simply always lives, is way against the normal pkgsrc & NetBSD
 > >  philosophy.
 >
 >  That won't always work.
 >  
 >  Suppose a user installs (as many, many people does) NetBSD+X11 from
 >  binary sets.  This means that, with your "fix", X11 will look inside
 >  /usr/pkg/whatever for files.
 >  
 >  Now, that user installs pkgsrc and sets his LOCALBASE to /opt/pkg.
 >  And there you go.  The "fix" doesn't work any more and he is forced
 >  to modify the environment.
 >  
 >  Not to mention that, if he has two LOCALBASEs, one in /usr/pkg and one
 >  somewhere else, X11 will always find, if not told otherwise, the stuff
 >  in /usr/pkg, thus probably causing confusion to the user.
 
 It's sounds like you're both in violent agreement.  (jmmv, please read
 what kre wrote, again. "baroque" is not a good thing.) I agree, too, that
 hard-coding "/usr/pkg" into Xt isn't pretty.
 
 kre's idea to use union mounts is clever. I'm not sure I want to do that,
 however.  The main drawback, as I see it, is that you have to be root to
 do the mount, but PATH &c should be the user's choice.
 
 >  Another possible solution is to add a default value for the correct
 >  environment variables in /etc/profile or something like that, so that
 >  the user can change them at will, if needed.  After all, /etc/man.conf
 >  already comes with a default path pointing to /usr/pkg...
 
 I would rather put it in "/etc/skel", and leave it to the user to tweak.
 
 Perhaps this is overkill, but here's a little shell function that I wrote,
 and use, with "/bin/ksh" to build to different heirarchies, then view the
 man pages and run (precisely) the programs I've just built:
 
 
 --8/-------------------------------------------------------------
 #!/bin/echo Source me:  .
 
 # The purpose of this shell function is to aid in setting
 # consistent paths for $PATH, $MANPATH, $INFOPATH, and so on.
 #
 # Usage: setpaths [-c|-x] path [path...]
 #
 #	-c	start (nearly) clean -- /bin:/sbin are special
 #	-x	do $XUSERSEARCHFILEPATH, too
 #
 # Examples (for "~/.shrc", "~/.xsession", or similiar):
 #
 #	typeset -fu ~/functions/setpaths
 #	setpaths -c /usr/gnutools /usr/local /usr
 #	setpaths -x /usr/pkg /usr/X11R6
 #	setpaths -x /usr/mozilla
 #	unset -f setpaths
 #
 
 setpaths () {
     local do_clean
     local do_x
     local p
     local u
 
     case $1 in
 	-c)
 	    do_clean=1
 	    shift
 	    ;;
 	-x)
 	    do_x=1
 	    shift
 	    ;;
 	-*)
 	    echo Usage: "setpaths [-c|-x] path [path...]"
 	    return 1
     esac
 
     if [ x$do_clean = x1 ]
     then
 	PATH=/bin:/sbin
 	unset INFOPATH
 	unset MANPATH
     fi
 
     for p
     do
 	PATH="${PATH}${PATH+:}${p}/bin:${p}/sbin"
 	INFOPATH="${INFOPATH}${INFOPATH+:}${p}/info:${p}/share/info"
 	MANPATH="${MANPATH}${MANPATH+:}${p}/man:${p}/share/man"
 	u="${u}${u+:}${p}/lib/X11/%N%C:${p}/lib/X11/%N"
 	shift
     done
 
     export PATH INFOPATH MANPATH
 
     if [ x$do_x = x1 ]
     then
 	XUSERFILESEARCHPATH="$u"
 	export XUSERFILESEARCHPATH
     fi
 }
 --8/-------------------------------------------------------------
 
 
 Frederick