Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: distinguish MSYS2 from Cygwin #5404

Merged
merged 3 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ users)
* `OpamFilter`: add `?custom` argument in `to_string` to tweak the output [#5171 @cannorin]

## opam-core
* `OpamStd.Sys`: fix `get_windows_executable_variant` to distinguish MSYS2 from Cygwin, esp. for rsync rather than symlinking [#5404 @jonahbeckford]
* OpamSystem: avoid calling Unix.environment at top level [#4789 @hannesm]
* `OpamStd.ABSTRACT`: add `compare` and `equal`, that added those functions to `OpamFilename`, `OpamHash`, `OpamStd`, `OpamStd`, `OpamUrl`, and `OpamVersion` [#4918 @rjbou]
* `OpamHash`: add `sort` from strongest to weakest kind
Expand Down
7 changes: 3 additions & 4 deletions src/core/opamStd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1137,11 +1137,8 @@ module OpamSys = struct
let rec f a =
match input_line c with
| x ->
(* Treat MSYS2's variant of `cygwin1.dll` called `msys-2.0.dll` equivalently.
Confer https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/ *)
jonahbeckford marked this conversation as resolved.
Show resolved Hide resolved
let tx = String.trim x in
if (OpamString.ends_with ~suffix:"cygwin1.dll" tx ||
OpamString.ends_with ~suffix:"msys-2.0.dll" tx) then
if OpamString.ends_with ~suffix:"cygwin1.dll" tx then
if OpamString.starts_with ~prefix:" " x then
f `Cygwin
else if a = `Native then
Expand Down Expand Up @@ -1179,6 +1176,8 @@ module OpamSys = struct
fun _ -> `Native

let is_cygwin_variant cmd =
(* Treat MSYS2's variant of `cygwin1.dll` called `msys-2.0.dll` equivalently.
Confer https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/ *)
match get_windows_executable_variant cmd with
| `Native -> `Native
| `Cygwin
Expand Down