Skip to content

Commit

Permalink
Remove PATH-tweaking in cygwin_create_process_env
Browse files Browse the repository at this point in the history
Assume instead that the user will have configured PATH correctly,
knowing that if opam has added Cygwin's bin to PATH, it will have put it
in the correct place.
  • Loading branch information
dra27 committed Apr 8, 2024
1 parent 662d06c commit 08c53b5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ users)
* Fix incorrect deduplication of environment variables on update. Effect was that FOO += "" would occlude the value of FOO in the environment [#5837 @dra27]
* Fix regression from #5356 on the detection of out-of-date environment variables. As part of a refactoring, a filter predicate got inverted [#5837 @dra27]
* Unixify Windows paths in init shells scripts (sh, bash, zsh, fish & tsh) [#5797 @rjbou]
* `OpamProcess.cygwin_create_process_env` no longer adjusts PATH [#5832 @dra27]
* Internal Cygwin installation's bin directory is placed as far down PATH as is necessary not to shadow `bash`, `tar`, `sort` or `git` [#5832 @dra27]

## Opamfile
Expand Down
23 changes: 0 additions & 23 deletions src/core/opamProcess.ml
Original file line number Diff line number Diff line change
Expand Up @@ -179,29 +179,6 @@ let cygwin_create_process_env prog args env fd1 fd2 fd3 =
None
end else
Some (key ^ "=" ^ String.concat " " settings)
| "path" ->
let path_dirs = OpamStd.Sys.split_path_variable value in
let winsys = Filename.concat (OpamStd.Sys.system ()) "." |> String.lowercase_ascii in
let rec f prefix suffix = function
| dir::dirs ->
let contains_cygpath = Sys.file_exists (Filename.concat dir "cygpath.exe") in
if suffix = [] then
if String.lowercase_ascii (Filename.concat dir ".") = winsys then
f prefix [dir] dirs
else
if contains_cygpath then
path_dirs
else
f (dir::prefix) [] dirs
else
if contains_cygpath then begin
log ~level:2 "Moving %s to after %s in PATH" dir (List.hd prefix);
List.rev_append prefix (dir::(List.rev_append suffix dirs))
end else
f prefix (dir::suffix) dirs
| [] -> []
in
Some (key ^ "=" ^ String.concat ";" (f [] [] path_dirs))
| _ ->
Some item in
let env = OpamStd.List.filter_map f env in
Expand Down

0 comments on commit 08c53b5

Please sign in to comment.