multiple symlinks in one folder/dir don't work in Finder

Problem with multiple symlinks in one folder when accessed via a remote network connection in Finder.

I find that multiple symlinks created from the command line work correctly via terminal & also via Finder when connected through Apple Remote Desktop when I connect to the remote system (10.3.9 Server). However, when I connect to a share point on the remote system via Finder -> Connect to Server... and then try to navigate to those symlinks/aliases via the Finder, I find that only the first symlink created works correctly (& shows the folder/alias icon), while the second and other successively created symlinks do not work (& show a document/alias icon rather than a folder as I would expect them to.) When attempting to use the second link, I get the following message: "The alias "xxxxxx" could not be opened, because the original item cannot be found." As mentioned above - these multiple links work correctly when sitting locally at the machine, connected via SSH/terminal, and when connected via ARD using finder -- just not when the shared-drive is mapped through the Finder.

I have been able to recreate the problem reliably in multiple locations, pointing to various different target and source directories.

Any ideas on this?

-pkb

Posted on Sep 8, 2005 10:54 AM

Reply
10 replies

Sep 8, 2005 12:28 PM in response to Peter Bellamy

Peter,
I was surprised about how this was behaving in a similar setup here. I did a ssh to my wife's ibook, and also did a Finder->Go->Connect to server to her ibook. I then tried various command line ln -s commands.

What I found out was that a link would work if I found out the "real" name of the directory or file, and then did the ln -s to that name, rather than the sym link to that file or directory. For example, if I created in her home directory: ln -s /private/etc/hosts hosts, that worked fine; but not if I did ln -s /etc/hosts hosts, because /etc is a symlink to /private/etc.

It does look like a bug, but at least there is a work-around.

Sep 8, 2005 1:05 PM in response to Boyd

A Unix symlink (ln -s) is just a special file that contains the name of the file to which it points. When the system tries to find the "real" file, it just reads the path encoded in the symlink. If you remotely mount a volume that contains a symlink to an absolute path (beginning with /, not just a path relative to where the symlink is), it could be hard for the system to figure out what to do. Should it look for the file relative to the volume that contains the symlink, or relative to the system one is using? There are cases where either one could be What You Want.If you have a symlink that points to a symlink, the chances of getting the desired behavior go down dramatically, if the desired behavior even can be determined at all without OS X reading your mind:)

Sep 8, 2005 6:15 PM in response to Boyd

You can symlink to anything you want, provided you can use it from the command-line to access the file. For example, linking to /Volumes/Server1/Templates/CoverLetter.doc could work. However, a symlink is a static thing, so if you were sitting at Server1, the symlink would still be that same thing: you would have to make sure you have a path that works both with the local disk and with it remotely-mounted. So none of this works if the disk "looks" different remotely vs. locally (if you care). And if you rename the disk or move files around, your links all break.

That's why many times a relative path is more flexible. Instead of encoding the exact and complete path of the file starting from the root of the local machine, it encodes the path starting from the directory containing the symlink itself. A symlink /Users/dmacks/Applications/Test.app to /Applications/Test.app would look for Test.app in the Applications folder on the local machine (starting from "/") while a symlink to ../../../Applications/Test.app would look in the Applications folder "up three levels from the symlink".

Oct 18, 2005 1:49 PM in response to Boyd

Tried this again since your post seemed to indicate that you got it to work. No luck for me.

What I discovered was that I didn't pay close enough attention when describing the initial problem -- saying the first sym link seems to work correctly. It does, but as Daniel points out, it gets confused between which volume it should use when following the sym link. In my case, I just wanted to get to the doc root of Apache /Library/WebServer/Documents (on the remote system) and the symlink gets me there, but *on my local box*, not on the remote box. So the fact that the second sym link doesn't seem to work now makes sense, because although my local box contains the default Apache doc root, it doesn't contain the specific sub-dirs that I was attempting to sym link into.

So, that answers my initial question about why the multiple sym links appear not to work when connected to remote systems, but it also points out the actual problem is with the implementation of using sym links with 'mapped' remote volumes/shares.

Cheers.
-pkb

Oct 18, 2005 3:13 PM in response to Peter Bellamy

Hi Peter,
Daniel is right on about the use of relative paths in symbolic links. /Library refers to the Library directory at the root level of the boot drive and can thus never refer to something in /Volumes. Thus you must use relative paths in a symbolic link to have any chance of it working when you share a filesystem containing the symbolic link. However, if both the symbolic link and it's target are in the share, there must necessarily be a relative path that will work. If you post the details, most of us could tell you a path that will work.
--
Gary
~~~~
Why can't I ever build character at a Miami condo or a
casino somewhere?
-- Calvin

Oct 19, 2005 10:02 AM in response to Gary Kerbaugh

Here's the scenario:

On the remote system (10.3.9 Server), I created 2 symlinks (using relative paths this time) in my home directory (/Users/UserName) as follows:

# pwd
/Users/UserName
# ln -s ../../Library/WebServer/Documents webfolder
# ln -s ../../Library/WebServer/Documents/subdir subdir

These show up as follows:

lrwxr-xr-x 1 user wheel 42 19 Oct 11:11 subdir -> ../../Library/WebServer/Documents/subdir
lrwxr-xr-x 1 user wheel 33 19 Oct 11:10 webfolder -> ../../Library/WebServer/Documents

I can use these symlinks (above) on the server from a shell, locally in the Finder, or via ARD. However, when I mount /Users on my local system (10.3.9) and try to use those symlinks via the Finder -- no joy. The message I receive is "The alias 'webfolder' could not be opened, because the original item could not be found." Same message for the second symlink.

When I used absolute symlinks, eg. /Library/WebServer/Documents, I could at least change into this directory - however, it turned out to the be the /Library/WebServer/Documents on my local system, rather than on the server as desired.

So my initial problem - of not being able to use multiple symlinks - has morphed into 'Can't use symlinks on remote drives via Finder'.

-pkb

Oct 19, 2005 10:52 AM in response to Peter Bellamy

# pwd
/Users/UserName
# ln -s ../../Library/WebServer/Documents webfolder
# ln -s ../../Library/WebServer/Documents/subdir subdir
[...]when I mount /Users on my local system (10.3.9) and try to use those symlinks via the Finder -- no joy.

Right...as you said, you only mounted the remote /Users, not "the whole remote drive". That means the remote /Library is not visible on the local machine at all anywhere, so obviously a symlink to it will not be resolvable regardless of how that symlink is defined.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

multiple symlinks in one folder/dir don't work in Finder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.