Section: The Bash Shell Startup Files - PATH=/your/head/asplode

Jonathan Oksman jonathan.oksman at
Fri Mar 16 10:24:52 PDT 2007

Hello BLFS Development!

It's been a while since my first post here, so I figured I would add
some of my observations since 6.2 has been released.  I'll only be
discussing the section "The Bash Shell Startup Files" today, since it
is still fresh in my mind from my most recent build.

First, a quick bug in the book: is still referenced in
the sample /etc/bashrc, which may be confusing to newcomers.  The
ticket is here:

But the main reason I'm posting to the mailing list today is to
discuss the way the scripts set the environment variable PATH.  As is
standard convention, it is done through /etc/profile, but there are a
few flaws that I have come to realize relating to using something as
simple as su.

When I'm installing packages, I tend to use su constantly so that I
can switch in and out of root access to the filesystem.  I'm sure lots
of you do this.  Others among you, notably the jhalfs developers,
might make more use of sudo.  I don't use sudo so I don't know how
this affects it.

In BLFS, there is no mention of /etc/login.defs.  On a default lfs
system, login.defs provides a basic PATH for users and root.  When su
is used, it draws your PATH from this file, completely avoiding
/etc/profile.d/  Of course, this isn't the case when you
use 'su -', since it then parses the profile of the user, although
this is not the way people tend to call su when installing packages -
it's not ideal to have to cd back to where you were.

With that said, what is the problem?  By default, /usr/local is
completely ignored.  This is because it is only configured in
/etc/profile.d/, and since su is gathering it's PATH
information from /etc/login.defs it gets the standard default of

The same semantics caused a simular bug with umask.  My user
(jonathan, group jonathan) got the default umask of 002 because of his
uid being equal to gid.  After compiling gpm and su-ing, I installed
gpm user and group read-writable as root:root.  Why?  Because umask
settings are controlled through /etc/profile, and su ignores it.

The first fix I want to suggest breaks standard convention.  The only
way I see this consistantly working without running scripts multiple
times would be to set PATH with /etc/bashrc instead of /etc/profile,
and remove the settings from /etc/login.defs all together.  This would
provide root, no matter how you logged in, with the intended default

The other fix method would be to set the PATH in /etc/login.defs as
well, but I personally hate having multiple definitions throughout a
system for the same thing - it's just harder to maintain.  Plus, there
might be a problem with this method if you use PAM.  On my BLFS-6.1
system the PATH settings in login.defs are completely ignored when I
use PAM, though that may be my specific configuration as I'm no longer
using the defaults from the book.  I have yet to install PAM on
BLFS-6.2 so I could be wrong, but currently I consider this method
with PAM unreliable.

I don't like the fixes that I'm suggesting, but I also don't like this
behavior, and I personally consider this to be a bug.  I also don't
see any other ways to fix it.  Any thoughts?


More information about the blfs-dev mailing list