Skip to content

_DefaultPub.get tries to read version file but does not hold the lock long enough to do so #109205

Description

@Hixie

_DefaultPub.get has this code:

    final File currentVersion = _fileSystem.file(
      _fileSystem.path.join(Cache.flutterRoot!, 'version'));
    // ...
    if (/*...*?
        lastVersion.readAsStringSync() == currentVersion.readAsStringSync()) {
      // ...

That code has a race condition. If that command runs in parallel with another flutter command, there's no guarantee that the currentVersion file will still be around.

We should not release the lockfile until after this test is done.

cc @christopherfujino @jmagman

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consoleteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.tool-still-validIssues that have been deemed still valid as part of the Flutter Tools issue cleanup initiative.triaged-toolTriaged by Flutter Tool team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Future bugs/improvements

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions