On Sat, 2015-03-28 at 20:52 +0100, Santiago Vila wrote: 
> Absolutely no way, this is completely insane.
uhm... thank you? .... o.O

> The file /etc/profile
> *must* be human readable, not a collection of clever hacks designed to
> avoid touching /etc/profile as if it were read only.
I didn't see the above to be byte-code,.. and human readable is always
relatively...

But of course I agree that my proposal is a bit more complex than the
average shell code.
OTOH, adding a comment like
>#this leaves PATH if set, and if unset or '' takes the values
>#from /etc/login.defs"
should be simply enough for like 98% of all users.

And I wouldn't say it's particularly more readable to add a large set of
shell functions.



> Moreover, people do not change the PATH so often, so having to
> change /etc/profile is not a big deal.
Nevertheless, it screws up in many places where the PATH is already set
from higher levels, ranging from login(1) over e.g. when one would sent
his PATH via e.g. ssh.

> If you insist that this is a bug, then it will remain "unfixed".
In the end I do not care how we call it... call it "fixing it" or
"improving it",... what's the difference?
No one calls this a "bug" just in order to blame you personally :P

But as you can see from the above examples it actually influences things
in an annoying way.

If you don't like doing it in the right way that works in all
situations, fine... but then do at least something like:
if [ -z "$PATH" ]; then
  if [ "`/usr/bin/id -u`" -eq 0 ]; then
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  else
    PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
  fi
fi

While IMHO this is still ugly, as it introduces yet another location
where a default value for a base variable is defined in Debian (and see
all the issues we've had with /etc/environment and how long it takes us
to really fully get rid of it), it at least doesn't break things if the
PATH is already set :)


> (But I might better eventually close it so that everybody stop
> suggesting obfuscating /etc/profile)
Well I don't think that closing a bug, which actually causes breakages
and for which there are simple fixes (like e.g. not setting the PATH at
all in /etc/profile, as this is not really its job) is an appropriate
way to deal with things.


Best wishes,
Chris.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to