Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absence of an unpack attribute must not result in BundleShapeAdvice #477

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

laeubi
Copy link
Member

@laeubi laeubi commented Feb 29, 2024

Currently the FeaturesAction assumes that the unpack attribute is always set, if that is not the case it leads to unexpected results because then unpack=true is assumed always. This is especially dangerous as PDE since 2023-12 release removes the attributes and Tycho assume they are false by default the same as PDE has done in the past when adding new items.

To mitigate this this adds an additional check to only evaluate the unpack if it is set, together with a testcase that covers all possible combinations.

I give +1 as project lead for this really late fix but I think it is urgent enough as it has unexpected side-effects for users using already released PDE that will likely be hard to discover and the previous state was to always specify this attribute so existing setup won't be affected. Waiting for one more release to fix this seems therefore not acceptable for me.

Currently the FeaturesAction assumes that the unpack attribute is always
set, if that is not the case it leads to unexpected results because then
unpack=true is assumed always. This is especially dangerous as PDE since
2023-12 release removes the attributes and Tycho assume they are false
by default the same as PDE has done in the past when adding new items.

To mitigate this this adds an additional check to only evaluate the
unpack if it is set, together with a testcase that covers all possible
combinations.
@akurtakov
Copy link
Member

The change looks good to me. I would like to get @merks review here too as we are really late in the game.

Copy link

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me.

  • The change is sound. From understanding an unspecified unpack should have never defaulted to true and that is what this change fixes.
  • The change fixes the problem I have originally reported.

Thanks for providing a fix to quickly, @laeubi!

Copy link

Test Results

    9 files  ±0      9 suites  ±0   30m 20s ⏱️ - 1m 3s
2 184 tests +1  2 180 ✅ +1   4 💤 ±0  0 ❌ ±0 
6 642 runs  +3  6 631 ✅ +3  11 💤 ±0  0 ❌ ±0 

Results for commit cf3265a. ± Comparison against base commit 151d95b.

Copy link
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great that the unpackSet method already existed! This is indeed a very good and very minimal change. We will avoid significant grief to include this in the 4.31 release

@akurtakov
Copy link
Member

For the record - PMC approved

@merks merks merged commit 89f12f7 into eclipse-equinox:master Feb 29, 2024
10 of 11 checks passed
@laeubi
Copy link
Member Author

laeubi commented Feb 29, 2024

@@ -186,7 +186,7 @@ private void createAdviceFileAdvice(Feature feature, IPublisherInfo publisherInf
private void createBundleShapeAdvice(Feature feature, IPublisherInfo publisherInfo) {
FeatureEntry entries[] = feature.getEntries();
for (FeatureEntry entry : entries) {
if (entry.isUnpack() && entry.isPlugin() && !entry.isRequires())
if (entry.unpackSet() && entry.isUnpack() && entry.isPlugin() && !entry.isRequires())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would seem there is a bug in isUnpack if we want the default to be false. For a future release we should consider if this is correct for isUnpack:

	public boolean isUnpack() {
		return (unpack != null && unpack.booleanValue());
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants