On Tue, Aug 18, 2009 at 2:33 PM, David Green <david.gr...@telus.net> wrote:

>
> Huh.  Thank you, I did not know that.  It makes "sense" (in that I
> understand what's going on now that I see it, and indeed it seems almost
> obvious), but I certainly couldn't call it "expected" because I didn't.  And
> I can guarantee I'm not the only one; in fact, I have no qualms about
> classifying that as a bug.
>

You think it's a bug that PWD="/etc" doesn't change your working directory
to /etc in bash?

Please tell me you're joking.

The environment variables are generally just descriptive variables. If you
mess with them, they may no longer have bearing on reality. That is also
expected behaviour; if you shoot yourself in the foot, you may get hurt.

It can also be said to be expected behaviour because that's the way it has
been behaving for maybe as long as environment variables have been in
existence in Unix systems.

Here's another example of something that, if I understand you correctly, you
find as unexpected behaviour:

j...@krakas ~ >USER=root
j...@krakas ~ >echo $USER
root
# Am i root now?
j...@krakas ~ >whoami
jani
# I'm not root.

While there have been programs assuming that %ENV{USER} indicates who the
current user is, and adjusting their behaviour based on that, such behaviour
has generally been classified as a security vulnerability, and rightly so.
-- 
Jan

Reply via email to