[PATCH 2/3] hust_test: Add missing PWD variable and improvechecking mechanism

Cathey, Jim jcathey at ciena.com
Thu Sep 10 00:20:10 UTC 2009


>> Seems to me that bash 
>> is doing exactly the right thing here.

>By lying to user? It misleads user by showing
>current $PWD in the prompt, while user expects
>to see name of the current directory.

No different, really, than the following scenario:

$ cd /tmp
$ PS1="$PWD $"
/tmp $ "PS1=/bin $"
/bin $ /bin/pwd
/tmp
/bin $ #I'm so confused!

If _I_ do something stupid like override a variable that
has meaning elsewhere, why shouldn't it bite me?  I _really_
wouldn't want variables to be hooked up backwards, so that
merely changing them drove other actions, especially when
there are well-established ways to do those other actions,
such as cd.  Be just like grabbing the shift indicator in
a car and pushing it to the gear you wanted, and expecting
it to both work and move the big lever too.

Just because something is technically feasible, and perhaps
even interesting, doesn't mean it's a good idea.  Unix, as
it exists today, is fraught with this kind of crap.  (The
mere existence of sockets, for example.  Why wasn't an fd
good enough, again?)

What about a custom shell script environment, that might or
might not use chroot, that wanted to present a virtual view
of its real environment.  Make PWD too magic and you can't.

-- Jim






More information about the busybox mailing list