🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.linux
Article #55683

Re: Interesting problem with symbolic links.

#55683
From: David Gibson
Date: Tue, 13 May 1997 00:00
60 lines
2699 bytes
Manfred Bartz (mbartz@werple.net.au) wrote:
: I encountered an interesting problem with symbolic links via NFS and I 
: would like to know if there is an elegant solution to this.
: was going on.  :-(

	Not a problem with NFS, just with the links you have.

: The ``X11'' is actually a sym-link to ``/var/X11R6/lib''.
: When encountering:
:     /darkstar/usr/X11R6/lib/X11
: the sym-link is substituted, ``app-defaults'' is appended and it becomes:
:     /var/X11R6/lib/app-defaults/
: which is on my local machine, not ``darkstar''.  Since locally the same 
: directory structure (inluding sym-links) is used, I am _actually_ in
:     /var/X11R6/lib/app-defaults/
: on my local machine and the error message is correct.

: 1. Is there a more elegant solution to this?

Yes. Just use a relative link. Instead of the link text for
/usr/X11R6/lib/X11 being "/var/X11R6/lib", it should be
"../../../var/X11R6/lib". Then, being relative to the link's location, it
will point to the right place no matter where the fs is mounted. To make the
relative link:
	# cd /usr/X11R6/lib
remove the old link:
	# rm X11
make the new one
	# ln -s ../../../var/X11R6/lib X11
No responsibilty taken, if I've mucked up and given the wrong commands here.

There also exists a tiny little tool called "symlinks", which sanity checks
symlinks, and can convert absolute references to relative ones. It does some
slighty stupid things occasinally though (making a rel. link "/a/b/c/foo" to
"/a/b/c/bar", it uses "../../../a/b/c/bar" rather than just "bar").

: 2. Should one try to avoid links altogether?

	No, but absolute links are usually to be avoided, unless you're
_sure_ an absolute reference is what you want.

: 3. If a link is simply used as an alias for a name in the same directory, 
:    it should be completely safe.  True or false?

True. A simple filename, with no "/"s is a relative link.

: 4. It occurs to me that this problem is not confined to NFS, but can 
:    appear in the local file system.

Yes.

: 5. Any other ideas or suggestions?

No.

--
David Gibson @ The Lorax	| New from Microsoft...
D.Gibson@bohm.anu.edu.au	| 	THNEED 95
				| Which everyone, Everyone, EVERYONE needs.
Technical Details
Message-ID: <5l9jrc$rch$1@clarion.carno.net.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <m2vi4nwrh5.fsf@reddwarf.aup.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 102983,2cba1ffcc09fa56d,start
X-Google-Attributes: gid102983,public
From: david@brucehall20.anu.edu.au (David Gibson)
Subject: Re: Interesting problem with symbolic links.
Date: 1997/05/13
Message-ID: <5l9jrc$rch$1@clarion.carno.net.au>
X-Deja-AN: 241277846
References: <m2vi4nwrh5.fsf@reddwarf.aup.com.au>
Organization: The Australian National University
Newsgroups: aus.computers.linux