Skip to content

[Windows] Flutter fails to extract the Dart SDK #132592

@loic-sharma

Description

@loic-sharma

Is there an existing issue for this?

Steps to reproduce

  1. Navigate to the Flutter repository
  2. git checkout master ; git pull
  3. git clean -Xfd
  4. Run dart
  5. Run rm .\bin\cache\engine-dart-sdk.stamp
  6. Run dart

If 7-Zip is installed, dart hangs while extracting the Dart SDK with no output.

If 7-Zip is not installed, dart prints an error message.

The root cause is that the dart-sdk-windows-x64.zip archive now contains a LICENSE.dart_sdk_archive.md file (added by flutter/engine#43974), which is extracted to the Flutter tool's cache. Updating your Dart SDK requires overwriting this LICENSE.dart_sdk_archive.md file, however, the update_dart_sdk.ps1 script does not support this.

Expected results

The hello world app should launch.

Actual results

If 7-Zip is installed, dart hangs while extracting the Dart SDK with no output.

If 7-Zip is not installed, dart prints an error message:

Failed to create file
'C:\Code\f\flutter\bin\cache\LICENSE.dart_sdk_archive.md' while expanding the archive file
'C:\Code\f\flutter\bin\cache\dart-sdk-windows-x64.zip' contents as the file
'C:\Code\f\flutter\bin\cache\LICENSE.dart_sdk_archive.md' already exists. Use the -Force parameter
if you want to overwrite the existing directory

Code sample

N/A

Screenshots or Video

N/A

Logs

Dart SDK extraction output if 7-Zip is NOT installed...
PS C:\Code\f\flutter> dart
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine ...
Expanding downloaded archive...
ExpandArchiveHelper : Failed to create file
'C:\Code\f\flutter\bin\cache\LICENSE.dart_sdk_archive.md' while expanding the archive file
'C:\Code\f\flutter\bin\cache\dart-sdk-windows-x64.zip' contents as the file
'C:\Code\f\flutter\bin\cache\LICENSE.dart_sdk_archive.md' already exists. Use the -Force parameter
if you want to overwrite the existing directory
'C:\Code\f\flutter\bin\cache\LICENSE.dart_sdk_archive.md' contents when expanding the archive file.
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShe
ll.Archive.psm1:397 char:17
+ ...             ExpandArchiveHelper $resolvedSourcePaths $resolvedDestina ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (C:\Code\f\flutt..._sdk_archive.md:String) [Write-Er
   ror], IOException
    + FullyQualifiedErrorId : ExpandArchiveFileExists,ExpandArchiveHelper

Building flutter tool...
Running pub upgrade...
Resolving dependencies... (1.2s)
Got dependencies.
A command-line utility for Dart development.

Usage: dart <command|dart-file> [arguments]

Global options:
-v, --verbose               Show additional command output.
    --version               Print the Dart SDK version.
    --enable-analytics      Enable analytics.
    --disable-analytics     Disable analytics.
    --suppress-analytics    Disallow analytics for this `dart *` run without changing the analytics
                            configuration.
-h, --help                  Print this usage information.

Available commands:
  analyze    Analyze Dart code in a directory.
  compile    Compile Dart to various formats.
  create     Create a new Dart project.
  devtools   Open DevTools (optionally connecting to an existing application).
  doc        Generate API documentation for Dart projects.
  fix        Apply automated fixes to Dart source code.
  format     Idiomatically format Dart source code.
  info       Show diagnostic information about the installed tooling.
  pub        Work with packages.
  run        Run a Dart program.
  test       Run tests for a project.

Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
Dart SDK extraction output if 7-Zip is installed...

I updated the update_dart_sdk.ps1 script to print additional debugging information:

Checking Dart SDK version...
Downloading Dart SDK from Flutter engine 22f03ffdc290081f6a0a1ed11ba19fd24ad83109...
Path already exists: C:\Code\f\flutter\bin\cache\dart-sdk
Renaming 'C:\Code\f\flutter\bin\cache\dart-sdk' to 'dart-sdk.old1'...
Rename complete


    Directory: C:\Code\f\flutter\bin\cache


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         8/15/2023   1:11 PM                dart-sdk
Expanding downloaded archive...

7-Zip 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15

Scanning the drive for archives:
1 file, 217861473 bytes (208 MiB)

Extracting archive: C:\Code\f\flutter\bin\cache\dart-sdk-windows-x64.zip
--
Path = C:\Code\f\flutter\bin\cache\dart-sdk-windows-x64.zip
Type = zip
Physical Size = 217861473


Would you like to replace the existing file:
  Path:     C:\Code\f\flutter\bin\cache\LICENSE.dart_sdk_archive.md
  Size:     579 bytes (1 KiB)
  Modified: 2023-08-14 13:05:02
with the file from archive:
  Path:     LICENSE.dart_sdk_archive.md
  Size:     579 bytes (1 KiB)
  Modified: 2023-08-15 09:52:50
? (Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit?

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.14.0-4.0.pre.40, on Microsoft Windows [Version 10.0.22621.2134], locale
    en-US)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.0)
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.81.1)
[✓] Connected device (3 available)
[✓] Network resources

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressionfyi-windowsFor the attention of the Windows platform teamplatform-windowsBuilding on or for Windows specificallyteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions