[Python-Dev] hard linking executables

Dan Stromberg drsalists at gmail.com
Thu Jul 28 04:34:36 CEST 2011


On Wed, Jul 27, 2011 at 2:37 PM, Ben Finney <ben+python at benfinney.id.au>wrote:

> Dan Stromberg <drsalists at gmail.com> writes:
>
> > It's been suggested that *ix has hardlinks because someone thought up
> > hardlinks before someone thought up symlinks - IOW, there are those who
> > suggest that if people had added symlinks first, no one would've bothered
> > adding hardlinks.
>
> Well, that suggestion is faulty. It ignores the fact that *all* ordinary
> files on Unix are hard links. Any ordinary file entry in a directory is
> a hard link to the file's data.
>

Not really.  Whether hard links is supported is mostly a matter of what
filesystem you are using - in modern times.  It's true that filesystems with
complete POSIX semantics probably all support hardlinks, but that's far from
every file on any given *ix.  And of course, POSIX doesn't appear to have
been created until the late 1990's.


> The “hard links” capability, therefore, isn't something that was added;
> it's fundamental to Unix filesystems from their inception.
>

Hard linking was reportedly in Unix Version 1, but I see nothing indicating
it was in the original Unics of 1969.  Then again, I don't see much of
anything on the net about what was and wasn't in Unics.


> The ‘ln’ command adds *additional* hard links to an existing file's
> data; but, once added, they're exactly the same as any other ordinary
> file entry.
>

Well, if you're in a filesystem that supports hardlinking anyway.
Supporting that isn't inherent.  It requires some sort of on-disk
representation for persistence, and not all filesystems support that.


> > Symlinks are almost always more flexible, and almost always more
> > clear.
>
> Yet many tools don't work as expected with symbolic links which will
> work with an ordinary file (a “hard link”). One can argue that such
> tools are to that extent buggy, but symbolic links produce deliberately
> different behaviour which is sometimes not what one needs.
>

Please recall that I was paraphrasing someone saying that hardlinks were
seldom better, not never better.  I don't know that there's anything in your
post that addresses that.

It's much easier to imagine a system with no hardlinks, than to imagine a
system with no symlinks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110727/1899e5af/attachment.html>


More information about the Python-Dev mailing list