Re: Proposal: restrict link(2)

Neil Moore (
Fri, 13 Dec 1996 14:59:24 -0500

> Harald Koenig writes:
> > * clobber other user's disk quoatas, disk usage and disk space accounting etc.
> No.
> $ mkdir tmp; cd tmp
> $ dd if=/dev/zero of=foo bs=1024 count=1024
> 1024+0 records in
> 1024+0 records out
> $ du
> 1030 .
> $ ln foo bar
> $ du
> 1030 .
> $ rm foo
> $ du
> 1030 .
> You have only a cursory understanding of how hard links work.

But that disk usage remains, even after they think they are
rid of it. For example, if they have 5 meg remaining on their
quota, then create a 4 meg temp file, and you link to it (from
your dir, perm 700 so they can't see or delete it), then they
delete the 4 meg temp file:
A - they think they have 5 meg left
B - they really only have 1 meg left

I don't think we should change the hard link semantics without
careful consideration, though. It breaks POSIX, and one of the
main points of Linux is to be POSIX-compliant.

This (problem with quotas) is the only reason I see for changing
it. Changing the kernel to get around userland bugs is a Bad
Thing. Not only does it bloat the kernel, but it causes Linux
programmers to assume that the files they are accessing will not
be hard links to things they shouldn't be messing with -- which
is okay, until the program runs under an earlier kernel, or gets
ported to another Unix. When this happens, these assumptions
blow up, and we end up with a program as buggy (on another oper-
ating system) as the ones we are concerned about right now. All
the broken userland programs need to be changed, *not* the kernel.

-Neil Moore
(finger for my Geek Code)