🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.linux
Article #54845

Problems with links in paths

#54845
From: Peter B. West
Date: Tue, 02 Sep 1997 00:00
92 lines
3413 bytes

I encountered the following problem when I installed jdk-1.1.1 from am
rpm distribution on the Linux System Labs CD of Redat 4.2.

Because things were getting crowded (it's so hard to throw things away),
I installed the software on a second partition (mounted as /opt) by
creating the directory /opt/jdk-1.1.1, and the following directories -
(Note that there are numerous ellipses <...> to keep thing brief.)

ls -l /opt/jdk-1.1.1
total 5
drwxr-xr-x   3 pbw      devel        1024 Sep  2 12:34 bin
drwxrwsr-x   2 pbw      devel        1024 Sep  1 13:58 doc
drwxr-xr-x   4 pbw      devel        1024 Sep  1 14:39 include
drwxr-xr-x   7 root     devel        1024 Sep  1 14:50 jdk-docs
drwxr-xr-x   4 pbw      devel        1024 Sep  1 14:40 lib

I then created s-links as follows:

lrwxrwxrwx   ... /usr/bin/jdk-1.1.1 -> ../../opt/jdk-1.1.1/bin
lrwxrwxrwx   ... /usr/lib/jdk-1.1.1 -> ../../opt/jdk-1.1.1/lib
lrwxrwxrwx   ... /usr/include/jdk-1.1.1 -> ../../opt/jdk-1.1.1/include

and installed the software into /usr/bin/jdk-1.1.1, /usr/lib/jdk-1.1.1,
/usr/include/jdk-1.1.1, and the documentation directories.

My attempt to run javac failed when javac could not be found at
/usr/lib/jdk-1.1.1/bin/i586/green-threads/javac

When I stepped along this path, the following happened:

ls -l /usr/lib/jdk-1.1.1
lrwxrwxrwx   ... /usr/lib/jdk-1.1.1 -> ../../opt/jdk-1.1.1/lib

ls -l /usr/lib/jdk-1.1.1/bin
lrwxrwxrwx   ... /usr/lib/jdk-1.1.1/bin -> ../../bin/jdk-1.1.1

ls -l /usr/lib/jdk-1.1.1/bin/i586
ls: /usr/lib/jdk-1.1.1/bin/i586: No such file or directory

The following cd failed as shown:

cd /usr/lib/jdk-1.1.1/bin
/bin/ksh: cd: /usr/lib/jdk-1.1.1/bin - No such file or directory

but cd to the prior directory works:

cd /usr/lib/jdk-1.1.1
ls
total 9140
...
...
lrwxrwxrwx  ... bin -> ../../bin/jdk-1.1.1
...
...
...
lrwxrwxrwx  ... i386 -> i586
lrwxrwxrwx  ... i486 -> i586
drwxr-xr-x  ... i586
lrwxrwxrwx  ... i686 -> i586
lrwxrwxrwx  ... include -> ../../include/jdk-1.1.1
lrwxrwxrwx  ... index.html -> ../../doc/jdk-1.1.1v3-1/index.html
lrwxrwxrwx  ... lib -> .
...
...


Note that in /usr/lib/jdk-1.1.1 (actually /opt/jdk-1.1.1/lib), bin is an
s-link to ../../bin/jdk-1.1.1 .  If I attempt to cd directly, the cd
fails:

cd bin
/bin/ksh: cd: /usr/lib/jdk-1.1.1/bin - No such file or directory

However, if I cd using the contents of the link, the cd succeeds:

cd ../../bin/jdk-1.1.1

Apparently, when I issue the successful cd, the path is traced according
to the logical link path I followed to get to the directory in which the
command is issued - in this case, /usr/lib/jdk-1.1.1 .  If, however, I
try to cd to the s-link (bin), the path is traced relative to the actual
directory in which I am situated - in this case, /opt/jdk-1.1.1/lib. 
This seems to me to be a serious inconsistency.  Any comments?


Yours faithfully,
-- 
 __ /__   Peter B. West
   /     p.west@mailbox.uq.edu.au
  /    "Master, to whom shall we go?"
Technical Details
Message-ID: <340BA944.333C8D79@mailbox.uq.edu.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 102983,aee93f758ab5eb07,start
X-Google-Attributes: gid102983,public
From: "Peter B. West" <p.west@mailbox.uq.edu.au>
Subject: Problems with links in paths
Date: 1997/09/02
Message-ID: <340BA944.333C8D79@mailbox.uq.edu.au>
X-Deja-AN: 271029906
Organization: University of Queensland
Newsgroups: aus.computers.linux