Skip to content

Commit

Permalink
Disable ACL in Cygwin to avoid permission missmatch errors
Browse files Browse the repository at this point in the history
Co-authored-by: David Allsopp <[email protected]>
  • Loading branch information
kit-ty-kate and dra27 committed Feb 16, 2024
1 parent e43b682 commit 6306718
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ users)
## Init
* Add rsync package to internal Cygwin packages list (enables local pinning and is used by the VCS backends [#5808 @dra27]
* Recommend enabling Developer Mode on Windows [#5831 @dra27]
* Disable ACL in Cygwin internal install to avoid permission mismatch errors [#5796 @kit-ty-kate - fix #5781]

## Config report

Expand Down
11 changes: 11 additions & 0 deletions src/state/opamSysInteract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,20 @@ module Cygwin = struct
in
OpamDownload.download_as ~overwrite ?checksum url_setupexe dst

let set_fstab_noacl =
let orig = "binary," in
let re = Re.compile (Re.str orig) in
fun fstab ->
let content = OpamFilename.read fstab in
let content = Re.replace_string re ~by:("noacl,"^orig) content in
OpamFilename.with_open_out_bin_atomic fstab
(fun oc -> Stdlib.output_string oc content)

let install ~packages =
let open OpamProcess.Job.Op in
let cygwin_root = internal_cygroot () in
let cygwin_bin = cygwin_root / "bin" in
let fstab = cygwin_root / "etc" // "fstab" in
let cygcheck = cygwin_bin // cygcheckexe in
let local_cygwin_setupexe = cygsetup () in
if OpamFilename.exists cygcheck then
Expand Down Expand Up @@ -317,6 +327,7 @@ module Cygwin = struct
(OpamFilename.to_string local_cygwin_setupexe)
args @@> fun r ->
OpamSystem.raise_on_process_error r;
set_fstab_noacl fstab;
Done ());
cygcheck

Expand Down

0 comments on commit 6306718

Please sign in to comment.