🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by bothner Wed, 07 Feb 1990 18:36
Misleading comment in ln.c
#1720
Author: bothner
Date: Wed, 07 Feb 1990 18:36
33 lines
1643 bytes
This comment in fileutils-1.0/ln.c seems to misunderstand
the nature of symbolic links:

   This shares one problem with the 4.2BSD ln which is nearly
   impossible to remove in the general case: if you make symbolic links
   to multiple files where the target is a directory, you can lose.
   For example:

   % ln -s foo bar baz subdir
   % cat subdir/foo
   cat: subdir/foo: Too many levels of symbolic links
   % ls -l subdir
   total 3
   -rw-r--r--  1 mouse           3 Apr 10 17:46 foo -> foo
   -rw-r--r--  1 mouse           3 Apr 16 05:08 bar -> bar
   -rw-r--r--  1 mouse           3 Apr 19 03:34 baz -> baz

The problem has nothing to do with multiple files or directories
as targets.
% ln -s Makefile subdir/Makefile
% ls -l subdir
total 1
lrwxrwxr-x  1 bothner         8 Feb  7 12:21 Makefile@ -> Makefile

The same thing happens with both GNU ln, and /bin/ln (on a DECstation 3100).
The "problem" is that the symlink system call does not interpret
the old name, it just copies it into the new symbolic-link file. 
One solution is to use absolute path-names:
% ln -s $PWD/Makefile subdir
% ls -l subdir
total 1
lrwxrwxr-x  1 bothner        40 Feb  7 12:31 Makefile@ -> /var/home/bothner/file
	--Per Bothner
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