Bug 97390 - Absolute path in .link files is badly parsed and used relative to start directory
Summary: Absolute path in .link files is badly parsed and used relative to start direc...
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-Update-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-31 03:43 EDT by Gabriele Garuglieri CLA
Modified: 2005-06-30 22:17 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriele Garuglieri CLA 2005-05-31 03:43:07 EDT
Version: 3.1.0
Build id: I20050527-1300

With RC1 the absolute path in .link files is no more interpreted as an absolute
path, but the backslashes are stripped away and what's remaining is appended to
eclipse starting directory.
Here some examples running with org.eclipse.update.configurator/debug=true.

I have a link file c:\local\eclipse\3.1RC1\eclipse\links\wtp.link containing:
path=rw C:\local\eclipse\3.1RC1\wtp
and start eclipse with a script from C:/local/eclipse/bin

here's the debug output:
PlatformConfig: Link file c:\local\eclipse\3.1RC1\eclipse\links\wtp.link
PlatformConfig:    R/W -> file:/C:/local/eclipse/bin/localeclipse3.1RC1wtp/eclipse
PlatformConfig: Site file:/C:/local/eclipse/bin/localeclipse3.1RC1wtp/eclipse
does not exist ... removing from configuration

Even better this case:
link file C:\local\eclipse\3.1RC1\eclipse\links\test-plugins.link containing
path=rw C:\local\eclipse\3.1RC1\test-plugins
debug output:
PlatformConfig: Link file c:\local\eclipse\3.1RC1\eclipse\links\test-plugins.link
PlatformConfig:    R/W -> file:/C:/local/eclipse/bin/localeclipse3.1RC1
est-plugins/eclipse
PlatformConfig: Site file:/C:/local/eclipse/bin/localeclipse3.1RC1     
est-plugins/eclipse does not exist ... removing from configuration

You see that \t of \test is interpreted as tab!

All these .link files worked without problems up to M7.
Comment 1 Gabriele Garuglieri CLA 2005-05-31 04:05:39 EDT
If i put path=rw file:c:/local/eclipse/3.1RC1/wtp into the previuous mentioned
.link file here's what i obtain:
PlatformConfig: Link file c:\local\eclipse\3.1RC1\eclipse\links\wtp.link
PlatformConfig:    R/W ->
file:/C:/local/eclipse/bin/file:C:/local/eclipse/3.1RC1/wtp/eclipse
PlatformConfig: Site
file:/C:/local/eclipse/bin/file:C:/local/eclipse/3.1RC1/wtp/eclipse does not
exist ... removing from configuration

It looks that eclipse starting dir is blindly prepended to whatever is in .link
files and this means there's no way to use absolute paths.
Comment 2 Gabriele Garuglieri CLA 2005-05-31 04:16:24 EDT
Putting path=rw ../3.1RC1/wtp into .link file makes the magic, but i think it's
not acceptable that everything must be relative to the starting directory and
that backslashes are mangled so badly.
Comment 3 Dejan Glozic CLA 2005-05-31 07:45:19 EDT
Raphael, this may be another regression caused by the recent patch in the 
configurator.
Comment 4 Dorian Birsan CLA 2005-05-31 08:52:54 EDT
yes, this is a dup of bug 97148

*** This bug has been marked as a duplicate of 97148 ***
Comment 5 Rafael Chaves CLA 2005-05-31 11:03:07 EDT
Gabriele, instead of having:

path=rw C:\local\eclipse\3.1RC1\wtp

Does having:

path=rw C\:\\local\\eclipse\\3.1RC1\\wtp 

work?
Comment 6 Gabriele Garuglieri CLA 2005-05-31 11:24:46 EDT
From a rapid test it looks to be working.
(i had to cleanup platform.xml to be sure).
Now i'm leaving, but tomorrow i'll try to debug and i'll be more precise.
Cheers,  Gabriele.
Comment 7 Dorian Birsan CLA 2005-05-31 11:54:13 EDT
The correct syntax for a link path should be what Rafael has in comment #5. I 
didn't catch this first, but I think the bug should be invalid, or a request 
for enhancement to support the file url path for a link.
Comment 8 Rafael Chaves CLA 2005-05-31 12:11:49 EDT
I am reopening this to mark as invalid. This problem is caused by invalid
entries in the Properties file. I do not understand how this could have worked
before, since in Properties files backslashes have to be escaped with a
backslash. For instance, running with 3.1 M7, if a link file contains the
following string:

path=rw D:\eclipse\3.1.x\extensions\org.eclipse.core.tools

Results in Update trying to find an extension location at:

D:eclipse3.1.xextensionsorg.eclipse.core.tools\eclipse

Which when transformed into an URL with File.toURL() is recognized as a relative
path and results in a bogus URL having the current directory as the base. This
code has not been changed recently so I fail to understand how it could have
worked before. Using the following form (note you don't have to escape colons in
the property value):

path=rw d:/eclipse/3.1.x/extensions/org.eclipse.core.tools

or

path=rw d:\\eclipse\\3.1.x\\extensions\\org.eclipse.core.tools

or

path=rw file:/d:/eclipse/3.1.x/extensions/org.eclipse.core.tools

works in both M7 and RC1.

Gabriele, do you have a valid test case that works in M7 but not in RC1? Between
tests, I suggest clearing the configuration area (delete everything except
config.ini) so you are not tricked by any caches.
Comment 9 Rafael Chaves CLA 2005-05-31 12:12:50 EDT
I will actually leave to the update guys to close as invalid if desired, since
this does not seem to be related to the patch I contributed.
Comment 10 Rafael Chaves CLA 2005-06-01 18:00:10 EDT
Really.
Comment 11 Dorian Birsan CLA 2005-06-01 22:03:04 EDT
Yes, it is an invalid bug, according to the spec for the path value:

"The link file is a java.io.Properties format file which defines the path to 
the installed extension."

(see http://help.eclipse.org/help30/index.jsp?
topic=/org.eclipse.platform.doc.isv/guide/product_extension.htm)
Comment 12 Gabriele Garuglieri CLA 2005-06-06 11:07:56 EDT
Sorry guys, i've been out of office and couldn't answer before.
Do you happen to have a donkey ears hat and a blackboard behind which i can take
my five minutes of shame?
PlatformConfig tried to tell me in any possible way i was doing something odd,
ever happened you look so carefully to the bug that you don't see the elephant
under it?
It's since 2.1 that i'm using .link files, i should have learned that cut and
paste for paths must not be used under win***s...
I feel so stupid... :(
Comment 13 Dorian Birsan CLA 2005-06-06 11:26:08 EDT
we can forgive you, but that'll cost you a patch submitted by you for 
each .links related bug not yet fixed :-)