Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: Isolating perldoc from the system perldoc

by deprecated (Priest)
on Apr 27, 2001 at 18:56 UTC ( [id://76127]=note: print w/replies, xml ) Need Help??


in reply to Re: Isolating perldoc from the system perldoc
in thread Isolating perldoc from the system perldoc

Well, just because you asked, I'll go into the ugly details (this is mostly academic help for other people who will get into this situation too).

I'm normally a Linux/BSD type of guy. I have run solaris and played in it before, but never a solaris pre 7. So when I came to this site to start working on some new tools for them, and I was given a SunOS 5.6 account, I was without all sorts of tools.

So after getting bash built okay, I started setting things up in my .bashrc. For example, 'make' and 'cc' live in very different places on old SunOS boxes than they do on BSD or GNU (/usr/ccs/bin and /usr/ucb in this case, respectively). Also, the default path given to me was /bin and /usr/bin, which was absolutely pathetic. So I figured out that I wanted my path to include all the Solaris binaries (i'll be damned if i have to go and build 'ls'), so I have a path laid out like this in my .bashrc:

PATH='' PATH=$PATH:/bin PATH=$PATH:/sbin PATH=$PATH:/usr/bin PATH=$PATH:/usr/sbin PATH=$PATH:/usr/local/bin PATH=$PATH:/usr/local/sbin PATH=$PATH:/usr/ccs/bin PATH=$PATH:/usr/ucb PATH=$PATH:$HOME/bin PATH=$PATH:$HOME/perl/bin
However, when vi goes to execute perldoc, as Masem just pointed out, it is looking through the path and finding first perldoc in /usr/local/bin , which then points to /usr/local/lib/perl { ... }, and I (not being of rootly powers) cannot put new modules there. So I (innocently and successfully but probably not correctly) just put an alias in my .bashrc which made 'perl' and 'perldoc' point to the appropriate binaries under my home directory.

I'm not convinced putting my homedir/bin paths above the SunOS paths is a better, safer idea than using an alias (because of the very issues Masem suggested), but it is the only way, apparently, to make vi understand that I dont want the system perldoc, I want _my_ perldoc.

Thanks Masem, virtualsue.
brother dep.

--
Laziness, Impatience, Hubris, and Generosity.

Replies are listed 'Best First'.
Re: Re: Re: Isolating perldoc from the system perldoc
by Masem (Monsignor) on Apr 27, 2001 at 19:17 UTC
    One more possibility, and this depends on the shell, is to alias "perldoc" to expand to point to your localcopy, similar to how many shells alias "ls" to "ls --color". But again, if your system is comprimised (at the user account level), and overwrites your perldoc with something by the same name but more malicious, you're in just as much trouble.

    A further one would be to install in /usr/local/bin a shell script called perldoc, along with your perldoc (call it perldoc-andy). The shell checks the user of the script, and if it's root or andy, it uses perldoc-andy, and if not, perldoc. All parts of this can be chown'd root (avoiding the problems with user-level intrusion) with permissions like 755. You cna then put /usr/local/bin in front of /usr/bin in the path to do that. A bit more work, but a bit more secure as well (requiring being rooted to break, but if you're there already, you're already screwed).


    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
Re: Re: Re: Isolating perldoc from the system perldoc
by virtualsue (Vicar) on Apr 27, 2001 at 19:38 UTC
    All I was looking for was info on how you were invoking your own version of perl from the command line outside vi. :-)

    I see no reason why you can't move your $HOME/perl/bin above the other directories in your PATH. It isn't *that* big of a security risk for users other than root.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://76127]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-18 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found