From owner-freebsd-questions Thu Aug 8 16:46:49 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 926F537B400 for ; Thu, 8 Aug 2002 16:46:45 -0700 (PDT) Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80F7143E6E for ; Thu, 8 Aug 2002 16:46:42 -0700 (PDT) (envelope-from grog@lemis.com) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id 4E617816C0; Fri, 9 Aug 2002 09:16:34 +0930 (CST) Date: Fri, 9 Aug 2002 09:16:34 +0930 From: Greg 'groggy' Lehey To: Jerry McAllister Cc: Roman Neuhauser , Peter Leftwich , Matthew Seaman , Jeff Jirsa , John Bleichert , FreeBSD LIST Subject: Re: Links (was: Is simplicity despised? WAS: Message-ID: <20020808234634.GJ8561@wantadilla.lemis.com> References: <20020808141523.GT281@freepuppy.bellavista.cz> <200208081419.g78EJYO14151@clunix.cl.msu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200208081419.g78EJYO14151@clunix.cl.msu.edu> User-Agent: Mutt/1.3.99i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thursday, 8 August 2002 at 10:19:34 -0400, Jerry McAllister wrote: >>>> >>>> Because symlinks are wasteful and introduce problems. There are very >>>> few reasons to ever symlink files in the same file system. >>> >>> Because symlinks make it abundantly clear what is linked to what. >>> Hard links can lead to confusion. I suppose that's not a problem >>> For most of you though. But, for example, if a person doesn't know >>> which is linked to which, that person wouldn't know that more is >>> really less. They might think less is really more (if they discovered >>> it at all). >> >> No, less is not hardlinked to more, nor is more hardlinked to less. >> They're two names for the same file. >> >> So... Yes, you're right: less is really more. But at the same time, >> more is less. > > Yup. But was that file created as less or more Why should you care? > and if I want to make a change do I start with the source for less > or more, etc? It's the same source. > Minor maybe, but ln -s makes it clear and is not so onerrous in > most situations. No, symlinks impose an order, and they don't clarify, they obfuscate. If you do this, you'll end up with a broken symlink: $ echo foo > bar $ ln -s bar baz $ rm bar $ cat baz cat: baz: No such file or directory $ On the other hand, links are *the* basic mechanism for naming files. If you do this, it will work: $ echo foo > bar $ ln bar baz $ rm bar $ cat baz foo UNIX files consist of three components: the data, the inode and the name. The inode is what really describes the file, and where nearly all the information is stored that you see when you run ls -l (only the name is stored in a directory). This is the only part of a file which *must* exist. An empty file doesn't have any data. Strictly speaking, the name isn't necessary unless you want to open the file. If it's already open, you can remove the name and still access the file, but it will go away if you close it for the last time. File names are stored in directories, which are simply a list of names and corresponding inode numbers. That's the elegance: you can have more than one name for a file. They are *absolutely* equivalent. Symlinks, on the other hands, are a kludge needed to point to files on different file systems (since inode numbers refer to the same file system). They are separate files which point to another file name, so if that name goes away, the symlink is broken. They're also slightly slower to use than links, since you need to access two files instead of one. Greg -- See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message