🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1003

Re: Why use pwd(1) for getpwd(3C)? (Re: Why use find?)

#1003
From: Conor P. Cahill
Date: Thu, 11 Oct 1990 14:06
30 lines
2031 bytes
In article <14976@hydra.gatech.EDU> gt0178a@prism.gatech.EDU (Jim Burns) writes:
>in article <1990Oct10.231857.11668@virtech.uucp>, cpcahil@virtech.uucp (Conor P. Cahill) says:
>> I don't know the reason for making it a call to popen(),  one reason may
>> have been security (pwd could be a setuid pgm and do things that a 
>> function call couldn't).
>
>Not on my system (see below).

Note that I said "could have been".  There are  no systems that I know of
that have pwd as setuid, I am just saying that from the way it was
architectured (pipe to another program) implies that they a reason may
have been that some version in the past may have required that pwd 
be setuid.  I know this is not the case for UNIX > V6, but I don't
know what went on before that.

>And what about those shells that have pwd
>builtin? My shell's pwd seems to work fine, and the shell isn't setuid
>either.

The shells that have pwd built-in usually don't run getpwd()/getcwd() to 
get the directory each time.  They run it once at start up time and then
keep track of where they go.  This causes problems if you run pwd (the
shell built-in) from a directory that you got to via a symbolic link
and it gives you the incorrect information (whereas /bin/pwd will give
you the right stuff).

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 
Technical Details
Message-ID: <1990Oct11.140654.22117@virtech.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!virtech!cpcahil
References: <1990Oct10.231857.11668@virtech.uucp> <14976@hydra.gatech.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!virtech!cpcahil
From: cpcahil@virtech.uucp (Conor P. Cahill)
Newsgroups: comp.unix.programmer
Subject: Re: Why use pwd(1) for getpwd(3C)? (Re: Why use find?)
Message-ID: <1990Oct11.140654.22117@virtech.uucp>
Date: 11 Oct 90 14:06:54 GMT
References: <1990Oct10.231857.11668@virtech.uucp> <14976@hydra.gatech.EDU>
Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill)
Organization: Virtual Technologies Inc., Sterling VA
Lines: 30