Skip to content

Commit

Permalink
Merge pull request #68 from bclement-ocp/bclement/ino
Browse files Browse the repository at this point in the history
Fix `same_file` check, reloaded
  • Loading branch information
hra687261 authored Jun 7, 2023
2 parents d050812 + 4ab7767 commit 837db0c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/Definitions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,12 @@ let mk_subdir self path : Subdir.t =
let path = norm_path ~dir_vars:self.dir_vars ~cur_dir:self.cur_dir path in
(* helper *)
let is_parent (dir : string) (f : string) : bool =
let dir_st = Unix.(stat dir) in
let same_file f =
try
Sys.command (Fmt.sprintf "test $(realpath %S) -ef $(realpath %S)" dir f)
= 0
with _ -> false
let f_st = Unix.(stat f) in
dir_st.st_ino = f_st.st_ino && dir_st.st_dev = f_st.st_dev
with Unix.Unix_error _ -> false
in
(* check f and its parents *)
let rec check f =
Expand Down

0 comments on commit 837db0c

Please sign in to comment.