Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: How to find working directory? Message-ID: <104612@convex.convex.com> Date: 3 Aug 90 19:08:31 GMT References: <139945@sun.Eng.Sun.COM> <8974@jpl-devvax.JPL.NASA.GOV> <21198@duke.cs.duke.edu> Sender: news@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 21 In article <21198@duke.cs.duke.edu> khera@cs.duke.edu (Vick Khera) writes: >In article <8974@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: >:I stop just short of saying the programs are busted. >GNU Emacs uses PWD if it exists. my normal login shell updates PWD >but /bin/csh doesn't (under 4.3BSD) so when i fire up emacs after >su'ing to another user, emacs gets the wrong directory. i'd say this >is busted. I'm not sure which you say is busted. It seems highly suspect to look at your environment for the $PWD. It's like trusting it for $USER. Use getwd() and getpwnam(getuid()) for these. What if a program does its own chdir() followed by an exec() or system()? --tom -- Tom Christiansen {uunet,uiucdcs,sun}!convex!tchrist Convex Computer Corporation tchrist@convex.COM "EMACS belongs in : Editor too big!"