OPNsense Forum

English Forums => Development and Code Review => Topic started by: interfaSys on January 28, 2016, 08:00:19 pm

Title: Any reason /usr/local is not at the top of PATH for root?
Post by: interfaSys on January 28, 2016, 08:00:19 pm
It's all in the title. I'm just wondering why it isn't set up that way.
Title: Re: Any reason /usr/local is not at the top of PATH for root?
Post by: franco on January 28, 2016, 08:41:35 pm
A quick look at FreeBSD sources reveals...

$ cd etc/root/
$ git grep usr.local
dot.cshrc:set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)
dot.profile:PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:~/bin

I suspect this is for security reasons, /usr/local not being able to override system binaries, but I don't know.

What I find also worrying is that stock FreeBSD doesn't honour /usr/local in /etc/rc, which defeats the point of installing scripting languages under /usr/local which are then used by system services.

What are your reasons for changing this? Does a local modification of root's PATH not suffice?
Title: Re: Any reason /usr/local is not at the top of PATH for root?
Post by: interfaSys on January 28, 2016, 08:53:15 pm
Quote
I suspect this is for security reasons, /usr/local not being able to override system binaries, but I don't know.

I thought it might be the reason, but at the same time it's not convenient and chances are high that we're going to run the wrong binary from time to time.

I'm thinking about openssl per example.

I usually put it first, but was wondering if it would break something within opnsense.
Title: Re: Any reason /usr/local is not at the top of PATH for root?
Post by: franco on January 29, 2016, 12:32:07 am
Yes, openssl, which shouldn't be duplicated by the base system, but it still is. Do you have a second example?
Title: Re: Any reason /usr/local is not at the top of PATH for root?
Post by: interfaSys on January 29, 2016, 01:04:35 am
ld because I sometimes check that it's the gold version, but that's probably just me.
Then there might be some newer version of some tools, like archivers, but it's true that it's not like a real OS where one might replace more components with the newest versions from ports.