/usr/local/bin in $PATH in system scripts?

Fergal Daly fergal at esatclear.ie
Thu May 10 15:15:27 UTC 2007

On 10/05/07, Forest Bond <forest at alittletooquiet.net> wrote:
> On Wed, May 09, 2007 at 07:03:30PM -0400, Jim Doherty wrote:
> > Sorry, I have no idea what ubuntu policy is.   But good defensive
> > scripting practice includes setting your $PATH to something safe.  A
> > good script should always not trust the environment it was handed along
> > with many other things that people don't always do.
> I have to disagree.  The environment is precisely the tool available to users to
> change the behavior of your script externally.  It's not nice to stomp on user
> preferences.
> The original problem is user error.  Installing an upgraded perl in /usr/local
> without installing all of the needed perl libraries or removing /usr/local/bin
> from the default system PATH is incorrect usage.  Don't break features to avoid
> user error, please.

You have 2 assertions in one sentence, I'm splitting them up.

1 - "Installing an upgraded perl in /usr/local without installing all
of the needed perl libraries is incorrect usage"

This directly contradicts the debian policy I quoted which essentially
says that the contents of /usr/local should have no impact on whether
your system works or not. I know Debian is not Ubuntu but in the
absence of Ubuntu policy docs, I'm assuming that the Debian policy is
a sane starting point.

What you are basically saying is that whenever I install _anything_
into /usr/local/bin I should carefully check that no system scripts
will be upset by this. I also need to check that no system scripts in
the _future_ will be upset by this!

Also, if I install my own perl in /usr/local/bin, I must install all
the libraries used by any other package that might be installed by
Ubuntu but I must do this by hand because apt will only manage the
dependencies of my /usr/bin/perl .

This basically makes it impractical to put anything into /usr/local/bin.

You are also implying that everything in /usr/bin that start with

#! /usr/bin/{perl,python,...}

is wrong and should actually start with

#! {perl,python,...}

in order to pick up whatever version of {perl,python,...} the user prefers.

In summary, you are saying that anything I put in /usr/local/bin
should be such that I could safely put it into /usr/bin. So what's the
point of /usr/local?

2 - "Installing an upgraded perl in /usr/local without removing
/usr/local/bin from the default system PATH is incorrect usage"

Users should not have to modify 20 scripts in /etc/ just because
they've put something in /usr/local/bin,


> -Forest
> Version: GnuPG v1.4.6 (GNU/Linux)
> iD8DBQFGQxgHRO4fQQdv5AwRAihpAJ9Xt+Taa2NQLDPwp6q/1Ieo1zgVgwCgiuAL
> tt0Y02QX+zHj7Bvuw/9wcNA=
> =qnXL

More information about the Ubuntu-devel-discuss mailing list