Repository navigation
fix: handle paths with escaped spaces in Cargo dep-info files - #121
Open
AnisHerdev wants to merge 1 commit into
Open
AnisHerdev wants to merge 1 commit into
AnisHerdev wants to merge 1 commit into
Conversation
Cargo and rustc emit Makefile-compatible dep-info (.d) files where spaces within paths are escaped with backslashes (\\ \). Previously, \DependencyDiscoverer\ used \line.trim().split(' ').skip(1)\, which erroneously split paths containing spaces (such as Windows user profiles or folders with spaces) into separate invalid tokens. This caused Flutter's native assets hook runner to fail with a directory listing error when watching dependencies.
This change:
- Unescapes Make-style escaped spaces (\\ \ -> space) while splitting dependencies only on unescaped whitespace.
- Normalizes Make-style line continuations (\\\\ followed by a newline).
- Adds unit test coverage for escaped spaces and line continuations.
GregoryConrad
approved these changes
Nov 11, 2026
Author
Note on CI Integration Test FailuresThe core The failures across the 5 integration test jobs ( Root cause:
I have intentionally kept this PR strictly scoped to the Cargo dep-info escaped spaces fix without altering workflow files. If helpful, I would be happy to open a separate PR to address the CI runner compatibility (e.g. pinning Flutter or adjusting the Melos script invocation). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
DependencyDiscoverer.discoverwhen source file paths listed in Cargo.ddep-info files contain spaces (e.g. Windows user profile directories likeC:\Users\John Doe\...or project paths containing spaces).Root Cause
Cargo and
rustcemit Makefile-compatible dep-info files where spaces within prerequisite paths are escaped using backslashes (\).The previous implementation:
performed a naive
.split(' '). For paths containing spaces (e.g.C:\Users\John\ Doe\lib.rs), this broke the single file path into invalid tokens:C:\Users\John\Doe\lib.rsWhen these broken tokens are forwarded to Flutter's native assets hook runner (
build_hooks), Flutter treats path tokens ending in separators as directories to watch and attempts directory listing onC:\Users\John\*, crashing the entire build with:Solution
\followed by a newline) so multi-line prerequisite rules parse cleanly.(?<!\\) +, ensuring that escaped spaces (\) inside file paths are not treated as token delimiters.\with standard spaces before passing each token topath.toUri.dependency_discoverer_test.darttesting escaped spaces on Windows and POSIX paths, as well as line continuations.Verification
dart analyze: 0 issues found (passedvery_good_analysis).dart format: Fully formatted.dart test test/dependency_discoverer_test.dart: All 6 tests passed.