Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Append to preexisting
MSYS
env var even if ill-formed
The value of an environment variable as obtained by the facilities in `std::env` is not always well-formed Unicode. Specifically, on Windows the values of environment variables, like paths, are natively UTF-16LE strings except that unpaired surrogate code points can also occur. An `&OsStr` on Windows may accordingly not quite be UTF-8. When the `MSYS` variable is absent, we treat this the same as when it is present but empty. However, as described in GitoxideLabs#1574, an `MSYS` variable that is present but whose value contains an unpaired surrogate would also be replaced entirely, rather than appending to its old value. This changes that, to instead append, retaining whatever was there even if it was ill-formed Unicode. An alternative change could be to panic when the old value is ill-formed Unicode. This commit allows and appends to the old value, rather than panicking or keeping and documenting the previous behavior of discarding the old value, because the appended sequence ` winsymlinks:nativestrict` is effective at causing fixture scripts to attempt to create actual symlinks even if the preceding code point is an unpaired Unicode high surrogate.
- Loading branch information