Initial Path - Question...

Denys Vlasenko vda.linux at googlemail.com
Mon Nov 3 22:55:16 UTC 2008


On Monday 03 November 2008 22:33, Michael D. Setzer II wrote:
> > > I added an export to command to the .bash_profile to fix the issue, but was
> > > wondering if there is a better way, or if this is how things are suppose to
> > > be. Not sure where the PATH value is set.
> > 
> > We usually inherit one in the environment from whatever program ran us.
> > 
> > We used to use _PATH_STDPATH out of /usr/include/paths.h but now there's a 
> > hand-wired definition of bb_PATH_root_path[] in libbb/messages.h for some 
> > reason, and that's what ash sets its varinit_data[] to.  If it's ever 
> > checking the environment it inherits to see if PATH is already set, I can't 
> > find where...
> 
> That appears to be what I was looking for. The busybox does the init for the boot up on the 
> cd, so it is setting the path that is used by everything.
> 
> http://www.faqs.org/docs/Linux-mini/Path.html#s4
> 
> Shows
> ===============
> 4. Init
> 
> Init is a parent process for all the other processes of the system. Other processes inherit 
> environment of the init process and the path is the init path in the rare case that no other path 
> is set.
> 
> The 'init path' is fixed in the source of the init program and it is:
> 
>     /usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin
> 
> Note that init path does not contain /usr/local/bin. 
> ==================
> 
> The message.c shows it as:
> "PATH=/sbin:/usr/sbin:/bin:/usr/bin"
> 
> The libbb.h has a comment that showed:
> util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin
> 
> But in either case, I would still need to add /usr/lcoal/bin anyway..
> But now I at least know where it is defined??

No need to hack on C code. Here, shell scripts work best.

Have a smallish shell script somewhere in between (or instead) init
and other stuff you run. You can set there whatever PATH you want,
and two gazillion other useful things.

--
vda



More information about the busybox mailing list