Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!mit-eddie!genrad!decvax!ucbvax!ulysses!hector!ekrell From: ekrell@hector..UUCP (Eduardo Krell) Newsgroups: comp.unix.wizards Subject: Re: Symbolic Links Message-ID: <2931@ulysses.homer.nj.att.com> Date: Tue, 8-Sep-87 15:43:01 EDT Article-I.D.: ulysses.2931 Posted: Tue Sep 8 15:43:01 1987 Date-Received: Wed, 9-Sep-87 06:40:46 EDT References: <2924@ulysses.homer.nj.att.com> <1813@munnari.oz> Sender: daemon@ulysses.homer.nj.att.com Reply-To: ekrell@hector (Eduardo Krell) Organization: AT&T Bell Labs, Murray Hill Lines: 39 In article <1813@munnari.oz> mwp@munnari.oz (Michael W. Paddon) writes: |>>The kernel only knows, in this case, one possible path -- the |>>one you used to get there. Given this problem, how would you know if |>>you were removing the real directory or just a symbolic link? |> |> How about lstat() ? |> | |This hardly makes things simpler for the novice user as you claim. |In fact explaining why | cd somepath/dir [assume an empty directory] | cd .. | rmdir dir The original question was about removing a symbolic link, and how could you tell the difference between removing the symbolic link and the directory it points to. Your example above is different (I'm assuming "somepath" is the symlink). I can also come with an example as simple as yours that's hard to explain to a naive user: /foo has 2 subdirectories: /foo/d1 and /foo/d2. /foo/d1 is empty. /foo/d2 is really a symbolic link. cd /foo/d2 rmdir ../d1 This never works under BSD semantics. If, on the other hand, "dir" is the symbolic link in your example, then "rmdir dir" won't work since dir is not a directory. "rm dir" would work under my implementation, it won't work under BSD semantics unless the directory it points to is also called "dir". Eduardo Krell AT&T Bell Laboratories, Murray Hill {ihnp4,seismo,ucbvax}!ulysses!ekrell