Repository navigation
Commit 8d765b9
authored
[stable] [flutter_tools] Exit cleanly when Windows path exceeds MAX_PATH (OS Error 206) (#195073)
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.
**Conflict Resolution (`stable`):** Resolved a trivial merge conflict in `_handleWindowsException` (`packages/flutter_tools/lib/src/base/error_handling_io.dart`) caused by error code constant ordering differences between `flutter-3.47-candidate.0` and `master`.
### 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 b4e3ab4 commit 8d765b9
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 | |
|---|---|---|---|
| |||
1445 | 1445 | | |
1446 | 1446 | | |
1447 | 1447 | | |
| 1448 | + | |
1448 | 1449 | | |
1449 | 1450 | | |
1450 | 1451 | | |
| |||
1468 | 1469 | | |
1469 | 1470 | | |
1470 | 1471 | | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
1471 | 1477 | | |
1472 | 1478 | | |
1473 | 1479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
414 | 415 | | |
415 | 416 | | |
416 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
417 | 453 | | |
418 | 454 | | |
419 | 455 | | |
| |||
984 | 1020 | | |
985 | 1021 | | |
986 | 1022 | | |
| 1023 | + | |
987 | 1024 | | |
988 | 1025 | | |
989 | 1026 | | |
| |||
1184 | 1221 | | |
1185 | 1222 | | |
1186 | 1223 | | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
1187 | 1280 | | |
1188 | 1281 | | |
1189 | 1282 | | |
| |||
0 commit comments