🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

13 total messages Started by Comfy chair Sat, 27 Sep 1986 03:46
Are links as useful as they could be?
#7198
Author: Comfy chair
Date: Sat, 27 Sep 1986 03:46
40 lines
2518 bytes
First let me make clear the context of my question, ask the question,
then explain why I ask.

I am asking about hard links, not symbolic links. The question is:  If
you were designing a new operating system, say a successor to U**x,
would you implement links in the same way, enhance it, or put more
restrictions on it?

Now my thoughts leading up to the question. When I first read how links
worked in U**x, I liked the idea. Mv was just a link() followed by
unlink(), rm was unlink(), and you could share files and have Jerkyl
and Hyde programs, &c, &c. Over the years I noticed that the
limitations were such that people couldn't use the full generality of
the concept. You couldn't link across filesystems or link directories,
so symbolic links were invented. To find out where the other links
were, you would have to search the whole filesystem, in the general
case. Utilities like tar and rdist have to remember files with links
and might run out of memory to store the filenames, in theory at
least.

One restriction that would ease the search problem is to restrict links
to the current directory.  Most uses of links are to alias things like
"vi" and "ex", "tip" and "cu" and these things usually live close
together.  This means rename would have to be made a primitive. But mv
has to do a copy when it can't do a link because link() doesn't
generalize across filesystems.

There still is obviously a need for some kind of indirection mechanism.
I don't like symbolic links, there are some warts, like having to check
for looping, but I can't think of anything better.

Do you have any ideas on this? I'd like to hear them. Please mail.  I
don't want to start an OS war.

	Ken
-- 
UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa
Snail: CS Dept., U. of Roch., NY 14627. Voice: Ken!
"It is absurd to divide people into good or bad. People are either
	charming or tedious." -- Oscar Wilde
Re: Are links as useful as they could b
#7218
Author: wombat
Date: Mon, 29 Sep 1986 01:14
40 lines
2772 bytes
My pet peeve with links:

We do some of our development here within "boxes", which are miniature unix
filesystems reached via dressed-up chroot calls. The nice thing about them
is that you can have complete control over your development environment. The
problem is that for each box you set up on a different partition (and almost
all of them are on different partitions), you must also install copies of
stardard utilities, including most of /bin and /lib plus some of /usr/lib,
/usr/bin, and /usr/ucb plus emacs. These have to be real copies, because we
don't have nearly enough room on our root disks to put development projects
thus making hard links useless, and because symbolic links can't be followed
to a target outside of a box. And there goes half the disk space from your
box. (Idle speculation says it would be nice if symlinks could reach through
a chroot call, but since we also use boxes for security I don't think I
could convince other people we should do it.)

I disagree that "most uses of links are to connect things in the same
directory":

We have a project here that uses a stable, common source tree. The
developers working on it usually need to change only a few files, but we
want them to do it in their own copy of the tree so that they can test it
before checking it into the official tree. So they make a copy of the
official tree which starts off consisting entirely of directories and hard
links to (non-RCS *,v) files in the official tree. When a developer wants to
change a file, they first remove the linked version, then get a true copy
and edit away. Since the source directory is over 10,000 blocks this saves a
lot of disk space. (However, if you ever have to restore the partition from
full+incremental dumps you have a really nasty problem on your hands, as we
have already discovered.)

(You may have guessed from this that our greatest shortage around here is
disk space.  B-)

"Our first order of business will be to find a deranged alchemist, which
should not be very difficult. China," said Master Li, "is overstocked
with deranged alchemists."
Barry Hughart, *Bridge of Birds*		Wombat
					ihnp4!uiucdcs!ccvaxa!wombat
Re: Are links as useful as they could be?
#7273
Author: ECSC68 S Brown CS
Date: Thu, 02 Oct 1986 15:07
18 lines
1252 bytes
In article <21127@rochester.ARPA> ken@rochester.UUCP (Comfy chair) writes:
>
>There still is obviously a need for some kind of indirection mechanism.
>I don't like symbolic links, there are some warts, like having to check
>for looping, but I can't think of anything better.

The "check for looping" could be fixed for symbolic links by defining
some primitive that converts a filename into the filename that it
"really is" -- ie, it does the work that it does internally in order
to do things like open(), execle(), etc... on a symbolic link.
lstat() is fine but it only does one level of translation.



--
Simon Brown
Computer Science Dept.
University of Edinburg.
Re: Are links as useful as they could be?
#7295
Author: guy
Date: Tue, 07 Oct 1986 08:14
34 lines
1881 bytes
> The "check for looping" could be fixed for symbolic links by defining
> some primitive that converts a filename into the filename that it
> "really is" -- ie, it does the work that it does internally in order
> to do things like open(), execle(), etc... on a symbolic link.

Huh?  The "check for looping" is there to prevent calls like "open" from
looping:

	ln -s a b
	ln -s b a
	cat a

I presume the primitive you're referring to would be something like:

	int evaluatelink(const char *path, char *buf, int buflen);

which would take the path pointed to by "path" and return the path name of
the file it ultimately refers to in the buffer whose first character is
pointed to by "buf", transferring at most "buflen" characters.

How would this help?  If that primitive does the work that the kernel does
internally for things like "open", it would have the same problems as those
calls, and would have to do the same check for looping.

> lstat() is fine but it only does one level of translation.

Huh?  "lstat" does *no* translation; that's what it's there for.  It finds
the file referred to by the path argument, assuming *no* symbolic-link
translation, and returns its file status.  "stat" does symbolic-link
translation.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)
Re: Are links as useful as they could be?
#7298
Author: Chris Torek
Date: Wed, 08 Oct 1986 05:39
22 lines
1639 bytes
>In article <21127@rochester.ARPA> ken@rochester.UUCP (Comfy chair) writes:
>>There still is obviously a need for some kind of indirection mechanism.
>>I don't like symbolic links, there are some warts, like having to check
>>for looping, but I can't think of anything better.

In article <65@its63b.ed.ac.uk> simon@its63b.ed.ac.uk (Simon Brown) writes:
>The "check for looping" could be fixed for symbolic links by defining
>some primitive that converts a filename into the filename that it
>"really is" ....

All you have done is to move the check from namei() into this new
primitive.

If you are willing to expend large amounts of space, the symlink
loop checks can be made rigorous, e.g., by remembering each symlink
inode and requiring that no one appear twice.  The eight-links
limit seems to work well in practice, though, particularly since
symlinks slow name translation markedly.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@mimsy.umd.edu
Re: Are links as useful as they could b
#7332
Author: aglew
Date: Sat, 11 Oct 1986 01:07
16 lines
1349 bytes
> If you are willing to expend large amounts of space, the symlink
> loop checks can be made rigorous, e.g., by remembering each symlink
> inode and requiring that no one appear twice.  The eight-links
> limit seems to work well in practice, though, particularly since
> symlinks slow name translation markedly.
>  
> Chris Torek

As a compromise between counting and remembering paths, don't fail before
at least N=8 symlinks, and hash the remainder into bits in as long a mask
as you care. The hashing overhead might be worth it if it saves more name
translations - AND if you want to have symlink paths longer than N=8 a lot.

Andy "Krazy" Glew. Gould CSD-Urbana.    USEnet:  ihnp4!uiucdcs!ccvaxa!aglew
1101 E. University, Urbana, IL 61801    ARPAnet: aglew@gswd-vms
Re: Are links as useful as they could be?
#7395
Author: System Mangler
Date: Mon, 20 Oct 1986 04:59
22 lines
1696 bytes
In article <21127@rochester.ARPA> ken@rochester.UUCP (Comfy chair) writes:
> I don't like symbolic links, there are some warts, like having to check
> for looping, but I can't think of anything better.

Warts... you can't chmod, chgrp, utime, or link them.
The access time never means much, because doing an
"ls -l" to see it has the side effect of changing it.

Symbolic links are too expensive to use freely.  They take up
an inode and 1K of disk space, just to hold a few characters.
They carry all the baggage of a regular inode (atime, mtime,
links, owner, group, mode) but you can't make proper use of
any of it.

Since Berkeley was making directory entries variable length
anyway, why didn't they just make symbolic links a variant
type of directory entry, containing a string instead of an
inode number?  They might be twice the size of a normal
directory entry, but the time saved in not having to read
another inode would be a big win.

Don Speck   speck@vlsi.caltech.edu  {seismo,rutgers}!cit-vax!speck
Re: Are links as useful as they could be?
#7386
Author: guy
Date: Mon, 20 Oct 1986 16:55
19 lines
1608 bytes
> Since Berkeley was making directory entries variable length
> anyway, why didn't they just make symbolic links a variant
> type of directory entry, containing a string instead of an
> inode number?  They might be twice the size of a normal
> directory entry, but the time saved in not having to read
> another inode would be a big win.

Because that would have required non-trivial changes to programs that read
directory entries, in order that they understand this new type of directory
entry.  The 4.2BSD file system changed the format of directory entries, but
didn't really change their meaning; as far as an application reading the
directory is concerned, they are still <inumber, name> pairs.  Converting a
program to use the directory library is a mechanical, albeit not automated,
operation.  If this new "indirect" directory entry were introduced, the
conversion process would no longer be mechanical.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)
Re: Are links as useful as they could b
#7422
Author: John Owens
Date: Tue, 21 Oct 1986 15:28
20 lines
1746 bytes
In article <1900036@ccvaxa>, aglew@ccvaxa.UUCP writes:
> As a compromise between counting and remembering paths, don't fail before
> at least N=8 symlinks, and hash the remainder into bits in as long a mask
> as you care. The hashing overhead might be worth it if it saves more name
> translations - AND if you want to have symlink paths longer than N=8 a lot.
> 
> Andy "Krazy" Glew. Gould CSD-Urbana.    USEnet:  ihnp4!uiucdcs!ccvaxa!aglew
> 1101 E. University, Urbana, IL 61801    ARPAnet: aglew@gswd-vms

Yeah, but then the behavior is unpredictable to the "casual observer".
It's easy to say "you can't have more than 8 steps", or even "you
can't have a loop, since the kernel remembers the device/inodes
traversed".  With this method, sometimes you can have more than 8,
sometimes not; I don't see how you can be completely reliable with
hashing unless you save the actual device/inodes as well, and just use
the hashing for speed.

John Owens		General Electric Company - Charlottesville, VA
jso@edison.GE.COM	old arpa: jso%edison.GE.COM@seismo.CSS.GOV
+1 804 978 5726		old uucp: {seismo,decuac,houxm,calma}!edison!jso
Re: Are links as useful as they could be?
#7462
Author: System Mangler
Date: Sun, 26 Oct 1986 10:07
12 lines
1159 bytes
In article <8313@sun.uucp>, guy@sun.UUCP writes:
> > why didn't they [Berkeley] just make symbolic links a variant
> > type of directory entry, containing a string instead of an
> > inode number?
>
> Because that would have required non-trivial changes to programs that read
> directory entries,

Many directory-reading programs (ls, tar, find) had to gain explicit
knowledge of symbolic links anyway, the changes were even user-visible.

Don Speck   speck@vlsi.caltech.edu  {seismo,rutgers}!cit-vax!speck
Re: Are links as useful as they could be?
#7471
Author: guy
Date: Sun, 26 Oct 1986 22:28
18 lines
1578 bytes
> Many directory-reading programs (ls, tar, find) had to gain explicit
> knowledge of symbolic links anyway, the changes were even user-visible.

And many didn't.  If a new type of directory entry were added, *every*
directory-reading program would have to gain explicit knowledge of symbolic
links, and the change would be more complicated (with symbolic links as they
are, the *directory-reading code* didn't have to change, other than
mechanically replacing explicit "read"/"fread"/whatever calls with "readdir"
calls, etc.).  Furthermore, "fsck" would have to be taught about these new
kinds of directory entries (not just about new kinds of inodes, as was the
case with the current symbolic link implementation), as would a bunch of
other utilities that know about file system formats.

I presume they just decided the added benefits weren't worth the hassle.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)
Re: symlinks as directory entries vs. inodes
#7526
Author: Chris Torek
Date: Sat, 01 Nov 1986 23:16
24 lines
1677 bytes
In article <8551@sun.uucp> guy@sun.UUCP writes:
>I presume they just decided the added benefits weren't worth the hassle.

What are the benefits supposed to be again?

Faster name translation?  The namei cache takes care of that.
Indeed, the extra code required to skip over the proposed extra
directory entry when scanning for other names might have more of
a slowing effect than any gain provided by having the contents of
the link at hand.

Less disk space used?  Perhaps; but not much, not unless you have
a large number of symlinks.

Fewer inodes used?  How often does one run out of inodes?  newfs is
very conservative about inode allocation.

All in all, I think writing the contents of the link through an
inode is cleaner.  It certainly helps keep namei, already a large
and ugly routine, from being larger and uglier.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@mimsy.umd.edu
Re: symlinks as directory entries vs. inodes
#7536
Author: Guy Harris
Date: Mon, 03 Nov 1986 07:57
35 lines
2095 bytes
> >I presume they just decided the added benefits weren't worth the hassle.
> 
> What are the benefits supposed to be again?

Well, to quote from the article that claimed they had added benefits:

> From: mangler@cit-vax.Caltech.Edu (System Mangler)
> Newsgroups: net.unix,net.unix-wizards
> Subject: Re: Are links as useful as they could be?
> Message-ID: <1059@cit-vax.Caltech.Edu>
> Organization: California Institute of Technology
> Summary: symbolic links shouldn't have been inodes

> In article <21127@rochester.ARPA> ken@rochester.UUCP (Comfy chair) writes:
> > I don't like symbolic links, there are some warts, like having to check
> > for looping, but I can't think of anything better.

> Warts... you can't chmod, chgrp, utime, or link them.
> The access time never means much, because doing an
> "ls -l" to see it has the side effect of changing it.

> Symbolic links are too expensive to use freely.  They take up
> an inode and 1K of disk space, just to hold a few characters.
> They carry all the baggage of a regular inode (atime, mtime,
> links, owner, group, mode) but you can't make proper use of
> any of it.

Since Don Speck was a defender of the "symbolic links as special directory
entry" idea, while I was not, I'll let him argue the point further.  Note,
however, that one of the objections - the first one listed - was not one of
resource consumption, but one of transparency.
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads