Subject: Re: /etc/rc.d scripts and $PATH
To: NetBSD-current Discussion List <current-users@NetBSD.org>
From: Greywolf <greywolf@starwolf.com>
List: current-users
Date: 09/15/2003 14:10:16
Thus spake Greg A. Woods ("GAW> ") sometime Today...

GAW> From: Greg A. Woods <woods@weird.com>
GAW> To: Peter Seebach <seebs@plethora.net>
GAW> Cc: NetBSD-current Discussion List <current-users@NetBSD.org>
GAW> Subject: Re: /etc/rc.d scripts and $PATH
GAW> Reply-To: NetBSD-current Discussion List <current-users@NetBSD.org>
GAW> Date: Mon, 15 Sep 2003 17:01:11 -0400 (EDT)
GAW> X-Spam-Level:
GAW>
GAW> [ On Monday, September 15, 2003 at 14:23:30 (-0500), Peter Seebach wrote: ]
GAW> > Subject: Re: /etc/rc.d scripts and $PATH
GAW> >
GAW> > In message <m19yyve-000B3IC@proven.weird.com>, "Greg A. Woods" writes:
GAW> > >[ On Monday, September 15, 2003 at 04:02:24 (-0500), Peter Seebach wrote: ]
GAW> > >> Subject: /etc/rc.d scripts and $PATH
GAW> > >>
GAW> > >> In days of yore, there was no convenient way to access stat(2) from a command
GAW> > >> line, so I wrote a utility named, inventively, 'stat'.
GAW> > >>
GAW> > >> So now, if I try to run some rc.d scripts from a prompt, they fail because
GAW> > >> my $PATH is wrong.  Shouldn't rc.d scripts set their paths to /usr/bin and
GAW> > >> /usr/sbin (or whatever) preemptively?
GAW> > >
GAW> > >I think the right question would be:  why isn't your "stat" utility
GAW> > >sitting in /bin where: (a) it will be around at the time _any_ rc.d
GAW> > >script might need it; and (b) all good, small, low-level, user-land,
GAW> > >system tools reside?  :-)
GAW> >
GAW> > Because my 'stat' utility isn't the one that /etc/rc.d/smmsp wants - smmsp
GAW> > wants the new 'stat' utility that got added to NetBSD sometime within the
GAW> > last few years.
GAW>
GAW> Ah, OK, that sheds more light!  ;-)
GAW>
GAW> The point I was trying hard _not_ to make explicilty was that /usr might
GAW> not be mounted when any given rc.d script ran.
GAW>
GAW> In this case I'd say your root environment shouldn't include private
GAW> paths to bin directories containing non-standard commands.  ;-)

More to the point, don't have commands with names which conflict with
utilities in the base system. :-)

[I end up prepending /usr/src/tools/tools-${ARCH}/bin: to my $PATH
when I run build stuff; but I have it set up so that when I do su,
it resets PATH to include the Four True Base Directories at the front
initially, followed by whatever else seems necessary at the time.]


				--*greywolf;
--
NetBSD:  We come in peace.  We offer reliability.