On Sun, 21 Apr 2002, Mike Holley wrote:

> I was reading on Fink's Faq page and it said that I should make sure
> that "make" is a symlink of GNUmake. How am I suppose to do that? I have
> checked the 3 books on Unix I have and there is no mention of it in the
> index.

Throw those books away! No good Unix book should skip over symlinks.

A "symbolic link" is a reference to the name of another file on your
computer. This is equivalent to aliases on the Mac or shortcuts on
Windows. You also have "hard links", which refer to the actual disc
location of another file. This is a cool way to replicate files without
using more disc space, and I don't know of a good analogue to it elsewhere
in Macs or Windows. It's simlilar to symlinks/aliases/shortcuts, but there
are important differences.

If you delete the file named by a symlink, the link is broken and the
reference is broken. I'm sure we've all dealt with this problem. If you
delete the file named by a hard link, the second link is intact, because
the pointer to the place on your disc is still there -- there's just one
fewer link to that disc point. The file doesn't actually get deleted until
there are zero links to it.

To misuse a Zen metaphor, the file is the moon -- a real place that we
know about and can find & get to, but not without help. A regular link (of
which all files have at least one) is like a finger pointing at the moon.
When you create a hard link, the system looks up where the first link is
pointing ("ahh, the moon!") and sets the new link to also point there. A
symlink points at another finger, which in turn points at the moon. If
that other finger starts pointing elsewhere, or goes away, the symfinger
has to accept that. Any hardfinger can make any changes to the moon that
it wants, but symfingers have to go through another working hardfinger as
a proxy. Any hardfinger can stop pointing at the moon, but the moon
doesn't go away until all fingers stop pointing at it (at which point the
system -- the Apollo program I guess -- is free to delete the moon :).

Make sense? :)

Anyway, the command for making hard & symbolic links is identical: "ln".
"ln -s file shortcut" creates a symlink from 'shortcut' to 'file', while
"ln file shortcut" creates a hard link so that both 'shortcut' and 'file'
are names for the same section of your hard disc.

This should make directory listnings clearer. Consider:

  % ls -la /usr/bin/*make
  -r-xr-xr-x  1 root  wheel  119092 Mar 20 16:41 /usr/bin/bsdmake
  -rwxr-xr-x  1 root  wheel  184648 Mar 20 16:41 /usr/bin/gnumake
  lrwxr-xr-x  1 root  wheel       7 Apr 17 18:19 /usr/bin/make -> gnumake

The leading '-' indicates that the first two are normal file links; that 1
indicates that no other links exist to the files which they point to. The
'l' on the third line indicates that this is a symlink, not a hard link,
and the " -> ..." bit at the end suggests where it points to. If I create
a new hard link to /usr/bin/bsdmake, we see something like this:

  % sudo ln /usr/bin/bsdmake /usr/bin/bizzdee-make
  Password:
  % ls /usr/bin/*make
  -r-xr-xr-x  2 root  wheel  119092 Mar 20 16:41 /usr/bin/bizzdee-make
  -r-xr-xr-x  2 root  wheel  119092 Mar 20 16:41 /usr/bin/bsdmake
  -rwxr-xr-x  1 root  wheel  184648 Mar 20 16:41 /usr/bin/gnumake
  lrwxr-xr-x  1 root  wheel       7 Apr 17 18:19 /usr/bin/make -> gnumake

Note that the count went up to 2 on bsdmake, because bizzdee-make is now
pointing to the same disc location that it is. Note also that the file
sizes and dates are identical for those two names: rather than today's
date, both versions are sharing the same file attribute data, because
there's only one file involved here.

This is all Unix 101 stuff, and your manuals should have a section it
somewhere. If not, they're either more specialized or advanced, or they're
could be badly written & might have other problems too. I dunno. I have no
idea what books they are and don't want to disparage them -- but surely
this subject should come up in at least one of them.... :)


--
Chris Devers                                [EMAIL PROTECTED]
Apache / mod_perl / http://homepage.mac.com/chdevers/resume/

"More war soon. You know how it is."    -- mnftiu.cc


_______________________________________________
Fink-beginners mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-beginners

Reply via email to