Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 1996 15:08:54 -0700
From:      Scott Blachowicz <scott@statsci.com>
To:        "Jordan K. Hubbard" <jkh@time.cdrom.com>
Cc:        current@FreeBSD.org
Subject:   Re: Building inside of /usr/src? 
Message-ID:  <m0uZPF8-000604C@main.statsci.com>
In-Reply-To: Your message of "Thu, 27 Jun 1996 14:53:52 -0700." <7251.835912432@time.cdrom.com> 
References:  <7251.835912432@time.cdrom.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
"Jordan K. Hubbard" <jkh@time.throck.com> wrote:

>         if ((pwd = getenv("PWD")) != NULL) {
>             if (stat(pwd, &sb) == 0 && sa.st_ino == sb.st_ino &&
>                 sa.st_dev == sb.st_dev)
>                 (void) strcpy(curdir, pwd);
>         }

Ahh...I knew I'd heard of that logic before...:-)

> Anyone else think that this is totally bogus and should be removed?
> It certainly EXPLAINS a few things! :-)

It probably goes something like this...if $PWD is set, then the user might
be using a shell that sets it to what the user typed in and it follows the
user's view of the world.  So, if you're doing a "tell me what my current
directory is" function and that is to be displayed back to the user, it'd
be nice to show the user something that the user expects to see.  So, now,
the developer says "OK, fine, but there are shells that don't do that" and
one way to see if that is what's going on is to see if $PWD refers to the
actual current directory and if so, present $PWD as the "current
directory" to the user.  They refer to the same place, after all, so
what's the harm in that...:-)  It IS a little more pleasant to see
"/homes/scott" than it is to get
"/a/apple.statsci.com/fs3/where/we/put/homes/this/year/scott" as the
return value.

> With all the shells in existance out there, I don't think that $PWD
> should or can be trusted.  Comments?

I don't know enough about the internals and all of the places that this is
used to be able to say if it'd be safe to revert the behavior in 'make'
itself, but maybe there could be a function added that just returns the
"real" getcwd() (or just grab the output from a /bin/pwd run).

[NOTE: some of my path names might be wrong for FreeBSD...I use several
       Unixen and my FreeBSD boxes are at home (I'm not) and stuck in
       Win95 (my work PC) land right now.]

Scott Blachowicz  Ph: 206/283-8802x240   Mathsoft (Data Analysis Products Div)
                                         1700 Westlake Ave N #500
scott@statsci.com                        Seattle, WA USA   98109
Scott.Blachowicz@seaslug.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0uZPF8-000604C>