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

pub global run needs to check if it should downgrade packages #2866

Closed
natebosch opened this issue Feb 2, 2021 · 5 comments
Closed

pub global run needs to check if it should downgrade packages #2866

natebosch opened this issue Feb 2, 2021 · 5 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@natebosch
Copy link
Member

If you pub global activate a package on a recent SDK, and then downgrade to an older SDK, pub global run may try to run with the same packages that may have SDK constraints in their pubspec disallowing them.

As of today you can see this with the following example:

  • On a Dart 2.12.0- version. pub global activate flutter_plugin_tools. Picks up charcode version 1.2.0
  • Downgrade the SDK to 2.10.5
  • pub global run flutter_plugin_tools.
Precompiling executable...
Failed to precompile flutter_plugin_tools:flutter_plugin_tools:
../../.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/ascii.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.10.
// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
^
../../.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/charcode.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.10.
// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
^
../../.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib/html_entity.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.10.
// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
^
@mit-mit
Copy link
Member

mit-mit commented Feb 2, 2021

cc @jonasfj @sigurdm, this might be a release blocker

@mit-mit mit-mit added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) CRITICAL labels Feb 2, 2021
@jonasfj
Copy link
Member

jonasfj commented Feb 2, 2021

workaround, if the root package, in this case flutter_plugin_tools had an SDK constraint 2.12.0-0 this wouldn't have been a problem as we do test the root SDK constraint.

Hmm, I'm not sure this is new, I think the same issues existed when we shipped extension methods.
But you are more likely to hit the issue with null-safety.

There is patch in #2867

@jonasfj jonasfj removed the CRITICAL label Feb 2, 2021
@jonasfj
Copy link
Member

jonasfj commented Feb 2, 2021

@mit-mit, please reflag if you think this is critical. From chat I think the conclusion is that this only affects users who downgrade SDK.

In either case, the fix proposed will just print a prettier error message telling the user to run: dart pub global activate <package> again.

Which is better than the error message above, but hardly the end of the world. If read probably the error message above, actually says:

The specified language version is too high. The highest supported language version is 2.10.

Which is close to indicating: that this doesn't work because you downgraded you SDK version.

@mit-mit
Copy link
Member

mit-mit commented Feb 2, 2021

I'm OK with removing critical given the new understanding.

@sigurdm
Copy link
Contributor

sigurdm commented Nov 7, 2024

Closing this, as I think this was fixed as a side-effect of #4410 (checking the resolution before pub run)

@sigurdm sigurdm closed this as completed Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants