Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318863 - Adopt R3.4 Attribute and Directive name syntax (Was: Deployer fails with split packages)
Summary: Adopt R3.4 Attribute and Directive name syntax (Was: Deployer fails with spli...
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: unknown (show other bugs)
Version: 2.1.0.M01   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Steve Powell CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 324445
  Show dependency tree
 
Reported: 2010-07-05 06:06 EDT by Benjamin Muskalla CLA
Modified: 2010-10-01 04:39 EDT (History)
5 users (show)

See Also:


Attachments
example (1.23 KB, application/octet-stream)
2010-07-05 06:06 EDT, Benjamin Muskalla CLA
no flags Details
1/4 (1.84 KB, patch)
2010-07-30 05:38 EDT, Florian Waibel CLA
zteve.powell: iplog+
Details | Diff
2/4 (1.85 KB, patch)
2010-07-30 05:39 EDT, Florian Waibel CLA
zteve.powell: iplog+
Details | Diff
3/4 (4.32 KB, patch)
2010-07-30 05:40 EDT, Florian Waibel CLA
zteve.powell: iplog+
Details | Diff
4/4 (1.76 KB, patch)
2010-07-30 05:41 EDT, Florian Waibel CLA
zteve.powell: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2010-07-05 06:06:13 EDT
Deploying bundles with split packages currently fails with the following exception.

[2010-07-05 12:00:06.942] fs-watcher                   <HD0002E> Hot deploy failed for file 'split.provider_1.0.0.201007051158.jar'. org.eclipse.virgo.kernel.deployer.core.DeploymentException: Error parsing bundle manifest header [a.split.pkg;nasty.split=split]
HP011E:[col 23]: Unconsumed data found at end of header '=split'

	at org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactTreeInclosure.createInstallTree(StandardInstallArtifactTreeInclosure.java:129)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.doInstall(PipelinedApplicationDeployer.java:140)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.install(PipelinedApplicationDeployer.java:123)
	at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.deploy(PipelinedApplicationDeployer.java:187)
	at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.deploy(HotDeploymentFileSystemListener.java:174)
	at org.eclipse.virgo.kernel.deployer.hot.HotDeploymentFileSystemListener.onChange(HotDeploymentFileSystemListener.java:78)
	at org.eclipse.virgo.util.io.FileSystemChecker.notifyListeners(FileSystemChecker.java:176)
	at org.eclipse.virgo.util.io.FileSystemChecker.check(FileSystemChecker.java:138)
	at org.eclipse.virgo.kernel.deployer.hot.WatchTask.run(WatchTask.java:58)
	at java.lang.Thread.run(Thread.java:619)
Caused by: org.eclipse.virgo.util.osgi.manifest.parse.BundleManifestParseException: Error parsing bundle manifest header [a.split.pkg;nasty.split=split]
HP011E:[col 23]: Unconsumed data found at end of header '=split'

	at org.eclipse.virgo.util.osgi.manifest.parse.standard.StandardHeaderParser.parsePackageHeader(StandardHeaderParser.java:112)
	at org.eclipse.virgo.util.osgi.manifest.internal.StandardExportPackage.parse(StandardExportPackage.java:39)
	at org.eclipse.virgo.util.osgi.manifest.internal.CompoundParseable.resetFromParseString(CompoundParseable.java:54)
	at org.eclipse.virgo.util.osgi.manifest.internal.StandardBundleManifest.initializeHeaders(StandardBundleManifest.java:118)
	at org.eclipse.virgo.util.osgi.manifest.internal.StandardBundleManifest.<init>(StandardBundleManifest.java:73)
	at org.eclipse.virgo.util.osgi.manifest.internal.StandardBundleManifest.<init>(StandardBundleManifest.java:95)
	at org.eclipse.virgo.util.osgi.manifest.internal.StandardBundleManifest.<init>(StandardBundleManifest.java:91)
	at org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory.createBundleManifest(BundleManifestFactory.java:91)
	at org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory.createBundleManifest(BundleManifestFactory.java:102)
	at org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleInstallArtifactFactory.retrieveArtifactFSManifest(BundleInstallArtifactFactory.java:91)
	at org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleInstallArtifactFactory.createBundleInstallArtifact(BundleInstallArtifactFactory.java:76)
	at org.eclipse.virgo.kernel.install.artifact.internal.bundle.BundleInstallArtifactTreeFactory.constructInstallArtifactTree(BundleInstallArtifactTreeFactory.java:66)
	at org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactTreeInclosure.constructInstallArtifactTree(StandardInstallArtifactTreeInclosure.java:155)
	at org.eclipse.virgo.kernel.install.artifact.internal.StandardInstallArtifactTreeInclosure.createInstallTree(StandardInstallArtifactTreeInclosure.java:123)
	... 9 common frames omitted

	
Even though split packages [OSGi 4.2, §3.12.2] are not recommended, they are still used in some rare cases. RCP introduced several splits in the 3.3 workbench and thus Eclipse RAP has the same split packages.
Comment 1 Benjamin Muskalla CLA 2010-07-05 06:06:52 EDT
Created attachment 173403 [details]
example

Two bundles using split packages to reproduce the exception
Comment 2 Glyn Normington CLA 2010-07-05 06:29:44 EDT
The diagnostics could certainly be better, but the root cause of this failure is a syntax error in the manifest. The attribute name "nasty.split" does not conform to the syntax in the OSGi core specification which allows only alphanumeric, '_' and '-' in attribute names (tokens). Refer to section 1.3.2 of the core spec for the correct syntax.

Please note that a split package need not have attributes. Typically a split package is exported by two or more bundles and gathered together by another bundle using require-bundle.
Comment 3 Benjamin Muskalla CLA 2010-07-05 06:49:24 EDT
You're right, according to the spec the attribute name is illegal. The problem is that Equinox accepts "nasty.split" as a valid split package and RCP enforces this with its splits (ui.workbench and ui.split). I know it feels wrong but do you think Virgo could support this false notation? On the RCP/RAP side we cannot change the attribute as we would break all clients out there as most of them use Import-Package.
Comment 4 Glyn Normington CLA 2010-07-05 11:57:16 EDT
I'm very uncomfortable with making Virgo tolerate erroneous bundles.

The clients using the invalid syntax in import-bundle are *already* broken, which will become apparent if those bundles are installed in an OSGi framework which is faithful to the spec. for attribute names.

I suggest renaming attribute names like "nasty.split" to something valid like "nasty-split" and providing a conversion utility to help clients perform the necessary renaming. I know this suggestion seems very costly, but it is a one-time hit and it only affects users of split packages who are already living on a knife-edge.
Comment 5 Jeff McAffer CLA 2010-07-05 14:49:23 EDT
Interesting that this has gone undetected for some time.  Must not be any OSGi TCK tests for this particular part of the spec...

Some thoughts:
- changing the name of the split attributes would be a breaking API change. Anyone importing the packages explicitly will be broken. This is not widespread but does happen so we'd have to assess the impact.

- It would be interesting to see how many people are spec'ing exports incorrectly. The UI guys got it wrong but did others copy or make the same mistake?  The runtime/equinox splits do not have '.'s.  If it is just the UI guys and few people use import with the attribute (as I suspect), then we may be able to just change the attribute names.

- In the mean time I suggest the RAP team change their attribute names accordingly. There should not be any impacts in the immediate term/scope.

- there is really no need for a conversion tool.  Change the '.' to a '-' in the imports.  I'm not keen on hacking the framework to convert or some such for free.

- we could potentially change the framework matching to treat . and - synonymously so we'd be able to change the exports without breaking the importers (perhaps flag them or something).  Gag but possible.

- I'm not convinced that people are "living on a knife-edge" (Glyn's been reading too many suspense novels ;-)  Fact is that most people pick a framework and use it with no intention of switching. Clearly this is true since no one seems to have noticed this problem for the last 5 years. The point being, breaking them to make them correct is unlikely to be viewed favorably.

- Changing Virgo to be a tad permissive to an existing (though incorrect) community does not seem beyond reason.

- We can seek to update the spec to allow '.'.  Its not clear why . should be omitted.
Comment 6 Glyn Normington CLA 2010-07-06 04:39:17 EDT
Based on Jeff's comments, it would seem reasonable to address the problem at source and not modify Virgo.

If there is still a strong requirement for Virgo to tolerate this syntax, perhaps it could be done using a manifest transformer which would convert the relevant '.' to a '-' on all imports and exports. This may be a little involved as the transformation would need to occur before the manifest parser runs into the '.' and fails. If someone would like to have a go at this, they should take a look at the ManifestUpgrader:

http://git.eclipse.org/c/virgo/org.eclipse.virgo.kernel.git/tree/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/ManifestUpgrader.java

PS. The knife-edge I was referring to was the general problem of coping with split packages. ;-)
Comment 7 Thomas Watson CLA 2010-07-06 23:07:20 EDT
A while back I opened a bug against the specification to allow '.' in attributes and directives (for folks that have access https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1634)

Basically the syntax in section 1.3.2 of the specification will be updated to:

  directive ::= extended ’:=’ argument 
  attribute ::= extended ’=’ argument
  extended ::= ( alphanum | ’_’ | ’-’ | ’.’ )+
Comment 8 Jeff McAffer CLA 2010-07-07 11:11:44 EDT
was this change approved?  when will it take effect?  If it is going forward then perhaps Virgo can just go ahead now and update their code to allow '.'
Comment 9 Thomas Watson CLA 2010-07-07 14:01:49 EDT
(In reply to comment #8)
> was this change approved?  when will it take effect?  If it is going forward
> then perhaps Virgo can just go ahead now and update their code to allow '.'

It has been approved.  I am 99% confident it will be in the R4.3 specification when it is released next year.
Comment 10 Glyn Normington CLA 2010-07-07 23:57:32 EDT
(In reply to comment #9)
> (In reply to comment #8)
> > was this change approved?  when will it take effect?  If it is going forward
> > then perhaps Virgo can just go ahead now and update their code to allow '.'
> 
> It has been approved.  I am 99% confident it will be in the R4.3 specification
> when it is released next year.

Yes, I'm happy to see this change made based on the direction of the standard. However, it's nowhere near the top of my team's priorities, so I'm hoping someone is sufficiently motivated to develop a patch. If someone expresses an interest, I'll help them locate the relevant code.
Comment 11 Florian Waibel CLA 2010-07-30 05:38:28 EDT
Created attachment 175550 [details]
1/4

I confirm that i have written 100% of the attached virgoise.sh patch and that
i'm allowed to contribute the patch to eclipse.org.
Comment 12 Florian Waibel CLA 2010-07-30 05:39:08 EDT
Created attachment 175551 [details]
2/4

I confirm that i have written 100% of the attached patch and that
i'm allowed to contribute the patch to eclipse.org.
Comment 13 Florian Waibel CLA 2010-07-30 05:40:21 EDT
Created attachment 175552 [details]
3/4

I confirm that i have written 100% of the attached virgoise.sh patch and that
i'm allowed to contribute the patch to eclipse.org.
Comment 14 Florian Waibel CLA 2010-07-30 05:41:02 EDT
Created attachment 175553 [details]
4/4

I confirm that i have written 100% of the attached patch and that
i'm allowed to contribute the patch to eclipse.org.
Comment 15 Florian Waibel CLA 2010-07-30 05:48:37 EDT
Hi  all,

i digged into the StandardHeaderLexer and created a patch. Now Virgo accepts the provided test bundles with the "nasty" header:

a.split.pkg;nasty.split="split"

[2010-07-30 08:54:18.990] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         HD0001I Hot deployer processing 'CREATED' event for file 'split.provider_1.0.0.201007051158.jar'. 
[2010-07-30 08:54:19.014] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0000I Installing bundle 'split.provider' version '1.0.0.201007051158'. 
[2010-07-30 08:54:19.027] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0001I Installed bundle 'split.provider' version '1.0.0.201007051158'. 
[2010-07-30 08:54:19.037] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0004I Starting bundle 'split.provider' version '1.0.0.201007051158'. 
[2010-07-30 08:54:19.043] start-signalling-3           org.eclipse.virgo.medic.eventlog.default                         DE0005I Started bundle 'split.provider' version '1.0.0.201007051158'. 
[2010-07-30 08:54:37.056] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         HD0001I Hot deployer processing 'CREATED' event for file 'split.consumer_1.0.0.201007051158.jar'. 
[2010-07-30 08:54:37.092] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0000I Installing bundle 'split.consumer' version '1.0.0.201007051158'. 
[2010-07-30 08:54:37.104] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0001I Installed bundle 'split.consumer' version '1.0.0.201007051158'. 
[2010-07-30 08:54:37.113] fs-watcher                   org.eclipse.virgo.medic.eventlog.default                         DE0004I Starting bundle 'split.consumer' version '1.0.0.201007051158'. 
[2010-07-30 08:54:37.118] start-signalling-3           org.eclipse.virgo.medic.eventlog.default                         DE0005I Started bundle 'split.consumer' version '1.0.0.201007051158'. 

Regards,
  florian
Comment 16 Steve Powell CLA 2010-08-03 09:26:31 EDT
Currently reviewing patches for contribution.
Comment 17 Steve Powell CLA 2010-08-06 06:07:00 EDT
Contributions flagged IPLOG.

Commits in util are:

SHA:	185b36ba4e4094b42f13ce89c3d83588df83f6e0
Author:	Florian Waibel <fwaibel@eclipsesource.com>
Date:	Thu Aug 05 2010 19:19:05 GMT+0100 (BST)
Committer:	Steve Powell <spowell@vmware.com>
Commit Date:	Thu Aug 05 2010 19:24:41 GMT+0100 (BST)
Subject:	Add tests for package attribute names.

and

SHA:	ff688582407992157d85eda5a7def780afa9c840
Author:	Florian Waibel <fwaibel@eclipsesource.com>
Date:	Thu Aug 05 2010 19:42:46 GMT+0100 (BST)
Committer:	Steve Powell <spowell@vmware.com>
Commit Date:	Thu Aug 05 2010 19:42:46 GMT+0100 (BST)
Subject:	Add tests and lexer for package attribute names.

Only modifications I made was to change the names of the test methods to more precisely indicate what they were testing.

Thank you Florian.
Comment 18 Steve Powell CLA 2010-08-12 06:23:26 EDT
Closing after silent integration tests.