The unpac monorepo manager self-hosting as a monorepo using unpac

Merge pull request #810 from talex5/fix-freebsd-discover

Use O_RESOLVE_BENEATH on FreeBSD

authored by

Thomas Leonard and committed by
GitHub
d38a31ca 0a12fced

+14 -14
+4 -8
.github/workflows/main.yml
··· 12 12 os: 13 13 - macos-latest 14 14 ocaml-compiler: 15 - - 5.2.x 15 + - 5 16 16 local-packages: 17 17 - eio eio_posix eio_main 18 18 ··· 23 23 uses: actions/checkout@v3 24 24 25 25 - name: Use OCaml ${{ matrix.ocaml-compiler }} 26 - uses: ocaml/setup-ocaml@v2 26 + uses: ocaml/setup-ocaml@v3 27 27 with: 28 28 ocaml-compiler: ${{ matrix.ocaml-compiler }} 29 29 opam-local-packages: ··· 40 40 uses: actions/checkout@v3 41 41 42 42 - name: Set-up OCaml 43 - uses: ocaml/setup-ocaml@v2 43 + uses: ocaml/setup-ocaml@v3 44 44 with: 45 45 opam-pin: false 46 - opam-depext: false 47 - ocaml-compiler: ocaml.5.2.0,ocaml-option-mingw 48 - opam-repositories: | 49 - dra27: https://github.com/dra27/opam-repository.git#windows-5.0 50 - normal: https://github.com/ocaml/opam-repository.git 46 + ocaml-compiler: 5 51 47 # --with-version=dev is not available, and --with-test also tries running tests for packages (like MDX) which fail... 52 48 - run: | 53 49 opam pin -yn eio.dev .
+1
lib_eio_posix/err.ml
··· 19 19 | EEXIST -> Eio.Fs.err (Already_exists e) 20 20 | ENOENT -> Eio.Fs.err (Not_found e) 21 21 | EXDEV | EACCES | EPERM -> Eio.Fs.err (Permission_denied e) 22 + | EUNKNOWNERR x when Some x = Config.enotcapable -> Eio.Fs.err (Permission_denied e) 22 23 | ECONNREFUSED -> Eio.Net.err (Connection_failure (Refused e)) 23 24 | ECONNRESET | EPIPE -> Eio.Net.err (Connection_reset e) 24 25 | _ -> unclassified_error e
+4 -4
lib_eio_posix/include/discover.ml
··· 4 4 "O_DSYNC"; 5 5 "O_RESOLVE_BENEATH"; 6 6 "O_PATH"; 7 + "ENOTCAPABLE"; 7 8 ] 8 9 9 10 let () = 10 11 C.main ~name:"discover" (fun c -> 11 - let c_flags = ["-D_LARGEFILE64_SOURCE"; "-D_XOPEN_SOURCE=700"; "-D_DARWIN_C_SOURCE"; "-D_GNU_SOURCE"; "-D_BSD_SOURCE"] in 12 - let includes = ["sys/types.h"; "sys/stat.h"; "fcntl.h"] in 12 + let c_flags = ["-D_LARGEFILE64_SOURCE"; "-D_XOPEN_SOURCE=700"; "-D_DARWIN_C_SOURCE"; "-D_GNU_SOURCE"; "-D_BSD_SOURCE"; "-D__BSD_VISIBLE"] in 13 + let includes = ["errno.h"; "sys/types.h"; "sys/stat.h"; "fcntl.h"; "limits.h"] in 13 14 let extra_flags, missing_defs = 14 15 C.C_define.import c ~c_flags ~includes 15 16 C.C_define.Type.(List.map (fun name -> name, Switch) optional_flags) ··· 21 22 ) 22 23 in 23 24 let present_defs = 24 - C.C_define.import c ~c_flags 25 - ~includes:["sys/types.h"; "sys/stat.h"; "fcntl.h"; "limits.h"] 25 + C.C_define.import c ~c_flags ~includes 26 26 C.C_define.Type.(extra_flags @ [ 27 27 "O_RDONLY", Int; 28 28 "O_RDWR", Int;
+5 -2
lib_eio_posix/test/open_beneath.ml
··· 12 12 try Ok (L.Resolve.open_unconfined ~sw ~mode (Some dirfd) path flags) with Unix.Unix_error _ as e -> Error e in 13 13 let y = 14 14 Eio_unix.Fd.use_exn "check" dirfd @@ fun dirfd -> 15 - try Ok (L.Resolve.open_beneath_fallback ~sw ~dirfd ~mode path flags) with Unix.Unix_error _ as e -> Error e 15 + try Ok (L.Resolve.open_beneath_fallback ~sw ~dirfd ~mode path flags) with 16 + | Unix.Unix_error _ as e -> Error e 17 + | Eio.Io _ as e -> Error e 16 18 in 17 19 match x, y with 18 20 | Ok x, Ok y -> ··· 30 32 if x <> y then ( 31 33 Fmt.failwith "Different errors: %a vs %a" Fmt.exn e1 Fmt.exn e2 32 34 ) 33 - | Error _, Error _ -> assert false 35 + | Error (Unix.Unix_error _), Error (Eio.Io (Eio.Fs.E Permission_denied _, _)) -> () 36 + | Error e1, Error e2 -> Fmt.failwith "Multiple errors: %a vs %a" Fmt.exn e1 Fmt.exn e2 34 37 | Error e, Ok _ -> Fmt.failwith "Only OS open failed: %a" Fmt.exn e 35 38 | Ok _, Error e -> Fmt.failwith "Only open_beneath failed: %a" Fmt.exn e 36 39