Re: Proposal: restrict link(2)

Steve VanDevender (stevev@efn.org)
Fri, 13 Dec 1996 12:07:01 -0800


The Deviant writes:
> link(2) doesn't change the location. It modifies the inode and makes
> another inode pointing to it. If you delete the first one (which also
> still has the original permissions), then the new one is still there.
> This isn't _THAT HARD_ of a concept to grasp.

This is an example of either how poorly some people understand the UNIX
file system or how badly people are using its terminology.

link() does not create an inode. It links an inode to a directory.
Making a second link doesn't make a new inode; it makes a new reference
in the directory tree to the existing inode, and increments the link
count in the inode so that the inode knows how many links exist to it.
Removing a link only removes the inode if the inode's link count is 0.

People who are used to UNIX have learned to understand this
distinction. People whose previous experience was with MS-DOS
apparently have a harder time because the MS-DOS filesystem doesn't
allow multiple links to a file and the name of the file is actually part
of the file's metadata.

I acknowledge that you certainly can attempt to use multiple links to a
file to cause mischief. However, I don't think this problem is either
as nasty or as easy to solve as many of the parties in this argument
seem to think.