Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 290201

Summary: Symbolic link support doesn't work on the Mac
Product: [Eclipse Project] Platform Reporter: Michael Valenta <Michael.Valenta>
Component: ResourcesAssignee: Pawel Pogorzelski <pawel.pogorzelski1>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: john.arthorne, john.camelon, Mike_Wilson, pawel.pogorzelski1, Szymon.Brandys
Version: 3.4.2   
Target Milestone: 3.6 M3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 294722    
Attachments:
Description Flags
Patch_v01
none
Library recompiled according to changes in Patch_v01
none
Patch_v02
none
Library recompiled according to changes in Patch_v02
none
Patch_v03
none
Library recompiled according to changes in Patch_v03
none
Patch_v04
none
Library recompiled according to changes in Patch_v04
none
Patch_v05
none
Patch_v06 none

Description Michael Valenta CLA 2009-09-22 21:38:51 EDT
I tried getting the target of a symbolic link on a Mac through EFS but it wasn't provided. Is this expected to work or has the binary for the Mac not been provided?
Comment 1 John Arthorne CLA 2009-09-22 22:06:27 EDT
We have natives on the Mac, but support for symlinks was never added to it. The person who contributed symlink support only provided it for linux and solaris.
Comment 2 John Arthorne CLA 2009-09-23 13:18:39 EDT
It looks like the only two library calls required to support this are lstat and readlink, both of which are available on OS X. So, this should be a straight-forward port of the support added in org.eclipse.core.filesystem/natives/unix/localfile.c into org.eclipse.core.filesystem/natives/macosx/localfile.c
Comment 3 John Camelon CLA 2009-10-01 08:49:00 EDT
We also would need a binary for AIX.
Comment 4 Michael Valenta CLA 2009-10-01 08:54:28 EDT
Since this applies to more than just the Mac, I am generalizing the Platform fields.
Comment 5 Mike Wilson CLA 2009-10-02 09:45:06 EDT
If we've got linux versions that work, then that code will typically work without changes on the mac. I'm +1 to to fixing this on Mac, and ok to fix it on other platforms as long as it doesn't take significant effort.
Comment 6 Szymon Brandys CLA 2009-10-02 09:54:59 EDT
Pawel is on it and will give estimates soon. Then we'll find a place for it in the Platform Workspace dev plan.
Comment 7 Pawel Pogorzelski CLA 2009-10-21 14:00:37 EDT
Created attachment 150138 [details]
Patch_v01
Comment 8 Pawel Pogorzelski CLA 2009-10-21 14:04:45 EDT
Created attachment 150139 [details]
Library recompiled according to changes in Patch_v01
Comment 9 Pawel Pogorzelski CLA 2009-10-21 14:18:52 EDT
(In reply to comment #2)
> It looks like the only two library calls required to support this are lstat and
> readlink, both of which are available on OS X. So, this should be a
> straight-forward port of the support added in
> org.eclipse.core.filesystem/natives/unix/localfile.c into
> org.eclipse.core.filesystem/natives/macosx/localfile.c

The port was indeed straightforward. There was some problems with links to files including characters beyond Mac OS default charset. Patch from bug 170317, comment 16 makes readlink() output is decoded with platform's default encoding. This is invalid assumption on Mac since targets are encoded with UTF-8 whereas the default is single byte ISO-8859-1. Not sure if it causes problems on other platforms.

Patch_v01 was prepared against 3.4.2, it could require adjustments for HEAD.
Comment 10 Pawel Pogorzelski CLA 2009-10-22 04:31:25 EDT
Created attachment 150210 [details]
Patch_v02

Patch adjusted for HEAD.
Comment 11 Pawel Pogorzelski CLA 2009-10-22 04:35:50 EDT
Created attachment 150211 [details]
Library recompiled according to changes in Patch_v02
Comment 12 Pawel Pogorzelski CLA 2009-10-22 05:49:36 EDT
Created attachment 150214 [details]
Patch_v03

Patch for HEAD changed in order to avoid regression of bug 260432.
Comment 13 Pawel Pogorzelski CLA 2009-10-22 05:51:46 EDT
Created attachment 150215 [details]
Library recompiled according to changes in Patch_v03
Comment 14 Pawel Pogorzelski CLA 2009-10-22 06:05:17 EDT
Created attachment 150216 [details]
Patch_v04

Patch for 3.4.2 changed in order to avoid regression of bug 260432.
Comment 15 Pawel Pogorzelski CLA 2009-10-22 06:06:31 EDT
Created attachment 150217 [details]
Library recompiled according to changes in Patch_v04
Comment 16 Pawel Pogorzelski CLA 2009-10-23 10:56:13 EDT
Code changes and the library for Mac are in HEAD, marking as FIXED.

Tracking support for AIX has been forked to bug 293185.
Comment 17 Pawel Pogorzelski CLA 2009-11-23 04:18:57 EST
Created attachment 152830 [details]
Patch_v05

A supplementary fix.
Comment 18 Szymon Brandys CLA 2009-11-23 04:40:37 EST
Thanks Pawel. Released to HEAD.
Comment 19 Pawel Pogorzelski CLA 2009-11-23 05:09:54 EST
Created attachment 152832 [details]
Patch_v06

A patch addressing Szymon's comment below :)
Comment 20 Szymon Brandys CLA 2009-11-23 05:24:46 EST
I think that we should not touch LocalFileSystem#attributes and rollback the fix. The fallback part at the end of the #attributes method is just to support older versions of the lib that don't have the native #attributes method. Since we don't plan to change and rebuild older libs, LocalFileSystem#attributes is valid without any changes.
Comment 21 Szymon Brandys CLA 2009-11-23 06:18:51 EST
LocalFileSystem#attributes is reverted to 1.18.
Comment 22 Szymon Brandys CLA 2009-11-24 07:44:01 EST
See Martin's Bug 294722, comment 10 for a remaining issue. The fix for Bug 259643 fixes it in HEAD.