Bug 201273 - Bundle-NativeCode validation
Summary: Bundle-NativeCode validation
Status: NEW
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL: http://litrik.blogspot.com/2007/08/se...
Whiteboard:
Keywords: bugday
Depends on: 165964
Blocks:
  Show dependency tree
 
Reported: 2007-08-27 11:17 EDT by Chris Aniszczyk CLA
Modified: 2013-09-16 09:34 EDT (History)
8 users (show)

See Also:


Attachments
mylyn/context/zip (730 bytes, application/octet-stream)
2007-08-27 11:39 EDT, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Aniszczyk CLA 2007-08-27 11:17:15 EDT
The OSGi spec mandates that you have more than one library for the same environment then you should include all of the libraries for that environment in the same Bundle-NativeCode entry.

We should do general validation for the Bundle-NativeCode header... in PDE we have a policy of there's no developer left behind :)
Comment 1 Chris Aniszczyk CLA 2007-08-27 11:39:41 EDT
attaching context
Comment 2 Chris Aniszczyk CLA 2007-08-27 11:39:44 EDT
Created attachment 77039 [details]
mylyn/context/zip
Comment 3 Thomas Watson CLA 2007-08-27 21:31:55 EDT
We should look into migrating eclipse over to using the Bundle-NativeCode header.  The current way eclipse ships native code in bundles is not standard OSGi which means these types of bundles cannot run on other OSGi Frameworks unless they (the other Framework) also implement our native code lookup algorithm.

In order to do this migration PDE will need this enhancement to help the developers.  Also note that we do not want to migrate Eclipse bundles to use the Bundle-NativeCode header until bug 165964 is fixed so that native code matching is a resolve-time check instead of install-time.  This is similar to how the Eclipse-PlatformFilter is handled at resolve-time.
Comment 4 Chris Aniszczyk CLA 2007-08-27 21:41:48 EDT
removing bugday keyword, updating depends
Comment 5 Thomas Watson CLA 2007-12-11 11:16:09 EST
It would be nice to have Bundle-NativeCode validation in M5.  See bug 201700.  It would be good to flag a warning/error when Bundle-NativeCode refers to a file that does not exist in the bundle.
Comment 6 Brian Bauman CLA 2007-12-11 11:35:54 EST
I can take a look at this while I am doing validation for Bundle-ActivationPolicy.

The two things we need to validate are:
1. libraries specified in the headers actually exist.
2. We don't have duplicate environments specified in the header.  Instead the user should have all the libraries needed for the environment list in one element.

Let me know if I missed anything.
Comment 7 Thomas Watson CLA 2007-12-11 11:46:58 EST
How will you validate point 2?  Are you just going to make sure that multiple clauses don't have exactly the same set of attributes?  The following are the valid attributes that can be part of a clause:

processor
osname
osversion
language
selection-filter

You should probably flag warnings if the clause has an unrecognized attribute.  You could also do the same filter validation on the selection-filter attribute that you do on the Eclipse-PlatformFilter to make sure the filter is valid.
Comment 8 Brian Bauman CLA 2007-12-11 12:07:27 EST
> How will you validate point 2?  Are you just going to make sure that multiple
> clauses don't have exactly the same set of attributes?  

That was my plan.  How does the runtime validate that case?  We really should be doing it the same way.

Comment 9 Thomas Watson CLA 2007-12-11 13:09:34 EST
The runtime does not actually care if multiple clauses match the same environment.  Lets use an example:

Bundle-NativeCode: 
 somenative01.dll;
  processor=x86;
  osname=win32,
 somenative02.dll;
  processor=x86;
  osname=win32

This example has two clauses, one for somenative01.dll and one for somenative02.dll.  Both define the same processor and osname attributes.  In this case the framework does not give a warning at all.  Instead, if multiple clauses match the environment then it picks the first one that matches in the list.  In this case the native somenative01.dll would be selected and somenative02.dll would be ignored.

This is likely not what the developer intended.  At the tooling level I think the best thing for you to do is to provide a warning if multiple clauses have the exact same attribute keys/values.  If that is detected then suggest that the native paths be combined into one clause.
Comment 10 Chris Aniszczyk CLA 2008-03-28 11:27:29 EDT
tagging bugday
Comment 11 Chris Aniszczyk CLA 2009-12-07 14:39:22 EST
*** Bug 297101 has been marked as a duplicate of this bug. ***