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

Running "pub deps" unexpectedly modifies .dart_tool/package_config.json (when there are path dependencies) #3016

Closed
DanTup opened this issue May 27, 2021 · 3 comments · Fixed by #4107
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-enhancement A request for a change that isn't a bug

Comments

@DanTup
Copy link

DanTup commented May 27, 2021

This came up at #2896 (comment).

In VS Code, I'm using pub deps to render the dependencies tree. If the package_config.json file is modified, that triggers a refresh of the tree. This results in calling pub deps again. For some projects, I found that the act of calling pub deps modified the file, which triggered calling it again (and this went on forever).

Attaching a debugger to pub showed it occurring here, because hasPathDependencies=true:

pub/lib/src/entrypoint.dart

Lines 512 to 520 in c33f264

if (packageConfigModified.isBefore(lockFileModified) ||
hasPathDependencies) {
// If `package_config.json` is newer than `pubspec.lock` or we have
// path dependencies, then we check that `package_config.json` is a
// correct configuration on the local machine. This aims to:
// * Mitigate issues when copying a folder from one machine to another.
// * Force `pub get` if a path dependency has changed language verison.
_checkPackageConfigUpToDate();
touch(packageConfigFile);

@jonasfj

@jonasfj
Copy link
Member

jonasfj commented Jun 1, 2021

Hmm, yeah, maybe it's overkill to touch it just because it has a path dependency..

@jonasfj
Copy link
Member

jonasfj commented Jun 1, 2021

Probably there is no need to do any timestamping if there is a path dependency...

@sigurdm sigurdm added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-enhancement A request for a change that isn't a bug labels Apr 7, 2022
@sigurdm
Copy link
Contributor

sigurdm commented Apr 7, 2022

@jonasfj thinks we can touch it only in the first case (packageConfigModified.isBefore(lockFileModified)) not the second (hasPathDependencies)

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) type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants