tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding linux_link(2) system call



Steven Bellovin <smb%cs.columbia.edu@localhost> writes:

> Consider the following two sequences:
>
>       a) Create a file A
>       b) Create a symlink X->A
>       c) Create a hard link Y=X
>       d) Unlink a
>       e) Create a directory A
>
> or
>
>       a) Create a symlink X-A', where A' doesn't exist
>       b) Create a hard link Y=X
>       c) Create a directory A

Did you try this?  I just did (netbsd-5, ufs2), and the attempt is to
link Y with the target of X, which fails.

> What should happen?  And why should A being a directory initially
> change the semantics of X and Y, compared with the desired result of
> the first two scenarios?  (As best I can tell, the first scenario does
> work on NetBSD and the second doesn't, at least when using ln(1).)

I think the big issue is that NetBSD creates hard links to the symlink's
target, and Linux creates hard links to the symlink itself.

It's hard to understand why you'd want a hardlink to a symlink (rather
than a second symlink), as symlinks are small and more importantly seem
to have create and delete operations but not modify operations.  Going
back to lisp, what does it mean for two immutable objects to be the same
object vs having the same value?

Is there some way in Linux to change the symlink target and have both
(hardlinked) source names point to the new target?

Attachment: pgpTcr2MCu2di.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index