LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-08-2004, 03:55 PM   #1
rusti999
LQ Newbie
 
Registered: Dec 2002
Posts: 5

Rep: Reputation: 0
directory symbolic link resolution


I have these fictive symbolic-link-heavy directory structures:

/usr/local/appv/bin/ -> /common/appv/bin/
/usr/local/appv/bin/i386 -> /i386/appv/bin/

Now, there is an executable /usr/local/lib/appv/bin/app that needs to reference a file app-arch in ./i386 (i.e. /usr/local/appv/bin/i386/app-arch, linked to /i386/appv/bin/app-arch). This executable doesn't know that that directory is actually a symbolic link. The problem that I'm having is that something resolves /usr/local/appv/bin/ into /common/appv/bin/, resulting in the file /usr/local/appv/bin/i386/app-arch (resolved to /common/appv/bin/i386/app-arch, which doesn't exist) not being found (the correct resolution should be /i386/appv/bin/app-arch). This problem doesn't occur on the previous versions of the application, i.e., in those versions the directory /usr/local/appv/bin is not resolved until a file is indeed accessed. I'm wondering what causes this, and how to make it so that the directory is resolved lazily. I'm running RH 9.0 with 2.4.21 kernel. Thanks in advance!
 
Old 08-09-2004, 12:27 AM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Boy this is confusing !
[QUOTE]
/usr/local/appv/bin/ -> /common/appv/bin/
/usr/local/appv/bin/i386 -> /i386/appv/bin/
[/QOUTE]

this can't actually exist this way because there can be no link recursively within a symlink
if this one exists
/usr/local/appv/bin/ -> /common/appv/bin/
then
/usr/local/appv/bin/i386 is actually /common/appv/bin/i386
if you go into /usr/local/appv/bin/ which is actually /common/appv/bin/
and i386 is a link to /i386/appv/bin/ there
then
/common/appv/bin/i386 -> /i386/appv/bin/

so if something looks for /common/appv/bin/i386/app-arch
it is in fact looking at /i386/appv/bin/app-arch

so something is amiss in the story here
lets see how to resolve
post if you will "ls -l" output for the bin directory in /usr/local/appv
and the "ls -l" output for the bin directory in /common/appv

and what application made this psychotic directory structure
that's like the house of mirrors at the state fair
 
Old 08-09-2004, 03:11 AM   #3
wipe
Member
 
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180

Rep: Reputation: 30
So the executable is in /usr/local/lib/appv/bin/, not in /common/appv/bin/ (where it would be if you put it in /usr/local/appv/bin/)?

A symbolic link is a special type of file, but it is a file, and like all other files it must reside in a directory. So if /usr/local/appv/bin/i386 is a symlink, it's a file (pointing to /i386/appv/bin/) in the directory /usr/local/appv/bin/, ie. in /common/appv/bin/.

You can't have slashes in filenames. If you create that kind of a file, with Konqueror for example, you get %2f in place of /. 2f is the ASCII position of the slash character in hexadecimal. I suppose one could write a program that would think that /usr/local/appv/bin%2fi386/app-arch does mean /usr/local/appv/bin/i386/app-arch. If it found the other symlink, /usr/local/appv/bin or /usr/local/appv/bin%2f, first, it would perhaps be used instead. All this would have to be done by the program, not by the kernel or shell.

Symlinks can certainly be confusing. You can make symlinks pointing to other symlinks or type valid directory paths in which many of the subdirectories are symlinks.

Regards
Simon

Last edited by wipe; 08-09-2004 at 03:22 AM.
 
Old 08-09-2004, 08:10 AM   #4
rusti999
LQ Newbie
 
Registered: Dec 2002
Posts: 5

Original Poster
Rep: Reputation: 0
Sorry for the confusion. The following is more like it:

/usr/local/appv/bin/ is an actual directory, not a symlink.
/usr/local/appv/bin/app -> /common/appv/bin/app
/usr/local/appv/bin/i386 -> /i386/appv/bin (the latter is actually a directory)

The problem is when /usr/local/appv/bin/app is executed, something makes it think that it is in /common/appv/bin/, but it needs to find ./i386/, which doesn't exist in /common/appv/bin/. I want it to be the case so that it thinks it is in /usr/local/appv/bin/, so that it can find ./i386/ (or /usr/local/appv/bin/i386/).

Actually, the case presented here is a fictive simplification of a much more complicated structures. I simplified it so that I could get to the gist of the problem. Yes, the original application is not structured like this. We did it so that it is easier to manage the application for multiple platforms (i.e. /common and /i386 actually reside in a network file system; /common is for files common to all platforms and /i386 is for files specific to i386; there are directories for other platforms, e.g. /ppc).
 
Old 08-09-2004, 12:47 PM   #5
wipe
Member
 
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180

Rep: Reputation: 30
I don't quite understand why you need that kind of a structure (and why not make an "i386" link in /common/appv/bin/) since the app is launched from the network anyway, but I guess you know better.

Applications have, AFAIK, little chance of knowing where they actually are, unless they check how they are called and resolve the link(s) by themselves. Configuration files or shell variables can often contain paths to different assets the app needs. Some programs use the current working directory as the source of their files, so they need a script (or something similar) that changes the directory before running the program. Yet some look in predefined places.

Not knowing anything about the app or how and where it's executed I can't help much, sorry. (I wouldn't probably be able to help anyway. )

Simon
 
Old 08-09-2004, 01:03 PM   #6
rusti999
LQ Newbie
 
Registered: Dec 2002
Posts: 5

Original Poster
Rep: Reputation: 0
Well, if it's necessary, the application is matlab. The setup is done like this to support multiple users with multiple platforms . Based on a user's platform, the common files and the platform-specific files for that user's platform will be linked from the network file system (afs). We put the common files and the platform-specific files for each platform in separate afs volumes.
 
Old 08-09-2004, 04:13 PM   #7
wipe
Member
 
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180

Rep: Reputation: 30
This feels sort of lame, but here goes:

http://newsreader.mathworks.com/comp.soft-sys.matlab/
http://www.google.com/search?q=matlab+forum
http://www.google.com/linux?q=matlab+forum

Based on a quick search, there's Matlab-savvy people on this site too. Hopefully someone answers. I haven't tested whether the thread title can be changed.

Simon
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot remove symbolic link to directory. martint Linux - Newbie 6 09-17-2014 08:45 PM
How to check if a parent directory is a symbolic link compnovice Linux - Newbie 11 10-06-2005 05:59 PM
symbolic link ilnli Slackware 6 01-04-2005 05:05 PM
symbolic link jsetter Linux - Newbie 4 11-22-2004 07:18 AM
Symbolic link. bulzbb Linux - General 8 03-19-2004 04:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration