Repository navigation
Commit e5792f6
authored
[beta] [flutter_tools] Exit cleanly when Windows path exceeds MAX_PATH (OS Error 206) (#195072)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
#194570
### Impact Description:
When a Flutter project, SDK, or subprocess command path on Windows exceeds `MAX_PATH` (260 characters), Win32 process and file operations fail with OS error code `206` (`ERROR_FILENAME_EXCED_RANGE`: `The filename or extension is too long`). Previously, `_handleWindowsException` in `error_handling_io.dart` did not recognize error code `206`, causing `ErrorHandlingProcessManager` and `ErrorHandlingFileSystem` to rethrow an unhandled `ProcessPackageException` or `FileSystemException` and trigger a crash report (#10 top crasher in Flutter 3.47.7). This change handles error code `206` and exits cleanly with a `ToolExit` message guiding the user to move the Flutter SDK and/or project to a shorter path or enable long paths on Windows.
### Changelog Description:
[flutter/194570] When a path or command exceeds `MAX_PATH` on Windows (OS Error 206), `flutter_tools` crashed with an unhandled `ProcessPackageException` or `FileSystemException` instead of exiting cleanly with an actionable error message.
### Workaround:
Move the Flutter SDK and/or project to a shorter directory path, enable Windows Long Paths, or set `PUB_CACHE` / delete `$FLUTTER_ROOT/.pub-preload-cache` if hit during initial pub cache preload.
### Risk:
What is the risk level of this cherry-pick?
### Test Coverage:
Are you confident that your fix is well-tested by automated tests?
### Validation Steps:
Run a `flutter` command (such as `flutter pub get`) on Windows where a file or subprocess command fails with OS error `206` (`ERROR_FILENAME_EXCED_RANGE`), or run `flutter test test/general.shard/base/error_handling_io_test.dart`, and verify that `flutter_tools` exits cleanly with a `ToolExit` message rather than an unhandled exception crash.1 parent 6630731 commit e5792f6
2 files changed
Lines changed: 99 additions & 0 deletions
File tree
- packages/flutter_tools
- lib/src/base
- test/general.shard/base
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1455 | 1455 | | |
1456 | 1456 | | |
1457 | 1457 | | |
| 1458 | + | |
1458 | 1459 | | |
1459 | 1460 | | |
1460 | 1461 | | |
| |||
1478 | 1479 | | |
1479 | 1480 | | |
1480 | 1481 | | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
1481 | 1487 | | |
1482 | 1488 | | |
1483 | 1489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
439 | 440 | | |
440 | 441 | | |
441 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
442 | 478 | | |
443 | 479 | | |
444 | 480 | | |
| |||
1140 | 1176 | | |
1141 | 1177 | | |
1142 | 1178 | | |
| 1179 | + | |
1143 | 1180 | | |
1144 | 1181 | | |
1145 | 1182 | | |
| |||
1340 | 1377 | | |
1341 | 1378 | | |
1342 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1343 | 1436 | | |
1344 | 1437 | | |
1345 | 1438 | | |
| |||
0 commit comments