Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!lll-winken!sun-barr!newstop!sun!stef From: stef@zweig.sun (Stephane Payrard) Newsgroups: comp.lang.perl Subject: Re: How to find working directory? Message-ID: Date: 6 Aug 90 17:14:33 GMT References: <8974@jpl-devvax.JPL.NASA.GOV> <21198@duke.cs.duke.edu> <104612@convex.convex.com> <1990Aug5.115155.10191@pegasus.com> <1990Aug5.204235.10036@squirrel.mh.nl> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems -- Mountain View Lines: 43 In-reply-to: jv@mh.nl's message of 5 Aug 90 20:42:35 GMT At high levels, the infos about the current directory, are not very reliable. But sometimes it is no better in the lowest level!!! On a Sun host using automounter (at least in SunOS 4.1), you can't even always expect something usable from getwd() or getcwd(). As an example, my current directory is: /home/fred But getwd() says me that it is /auto/home/fred This path will work as long as the file-system is mounted. But the automounter unmounts file systems not recently referenced and is unable to understand /auto/home/fred once the corresponding has been unmounted. I guess what happened is that getcwd() tried to normalize the path and returned a path without symbolic links. This is clearly not the correct behavior with automounted directories. Using the infos in /etc/mtab and the automounter maps, it should be possible to write a perl script which does correctly what getwd() should do. In my particular case, I know that the prefix to suppress is '/auto' so I don't need such a general script. The automounter is a utility which allows to mount dynamically and transparently NFS files-sytems. It uses the NIS (ex YP) so the administration of the mount is not necessarily done host by host. It is great (as in SunOS 4.1), but, as mentionned, has still some minor shortcoming. stef -- Stephane Payrard -- stef@sun.com -- (415) 336 3726 Sun Microsystems -- 2550 Garcia Avenue -- M/S 10-09 -- Mountain View CA 94043