test: preserve non-UTF-8 ambient cwd#68
Merged
Merged
Conversation
hyfdev
marked this pull request as ready for review
July 15, 2026 14:35
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
0x80absolutize,try_absolutize,relative, andtry_relativeto preserve the cwd bytes exactlycached_current_dirconfigurations through the native CI inventoryWhy
Existing tests cover non-UTF-8 inputs with an ordinary ambient cwd and non-UTF-8 explicit cwd arguments, but not an ambient cwd whose own filesystem spelling is non-UTF-8.
A controlled mutation rebuilt cwd through
to_string_lossy()in both feature branches. The existing complete default and cached suites remained green, even though the mutation changes the native byte0x80into the UTF-8 replacement sequenceEF BF BDbefore all four ambient APIs use it.The new test runs in a fresh integration-test child process so the cached cwd cannot be initialized by the parent. It derives expected paths from
std::env::current_dir()and compares raw bytes, without imposing aCowor allocation requirement on the non-UTF-8 case.Platform scope
Linux supplies the executable filesystem case because macOS rejects the invalid-byte directory name with
EILSEQ. The test is therefore required only in the native Linux inventory; explicit-cwd tests continue to cover native-invalid Unix composition independently of the host filesystem.Validation
cached_current_dirworkspace suite: passcached_current_dir