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

Use O_RESOLVE_BENEATH on FreeBSD

It needs `-D__BSD_VISIBLE` to be able to see this.

Fix the CI bug this revealed, which is now also affecting macos
(reported by Nathan Taylor in #808).

+10 -6
+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