From cbc5dbee934da099be6923d38f97f3f997ad5f16 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Tue, 16 Feb 2021 10:45:09 +0100 Subject: [PATCH] No longer call chmod on symbolic links Use stat instead of lstat in refresh_and_chmod Fix #4195 Signed-off-by: Danny Willems --- CHANGES.md | 2 ++ src/dune_engine/cached_digest.ml | 2 +- src/stdune/path.ml | 2 ++ src/stdune/path.mli | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index af15d42cd79..25547d74e90 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -36,6 +36,8 @@ Unreleased - Add a META rule for 'compiler-libs.native-toplevel' (#4175, @altgr) +- No longer call `chmod` on symbolic links (fixes #4195, @dannywillems) + 2.8.2 (21/01/2021) ------------------ diff --git a/src/dune_engine/cached_digest.ml b/src/dune_engine/cached_digest.ml index 7bb86334cf7..c47f83b71ad 100644 --- a/src/dune_engine/cached_digest.ml +++ b/src/dune_engine/cached_digest.ml @@ -104,7 +104,7 @@ let refresh fn = refresh_ stats fn let refresh_and_chmod fn = - let stats = Path.stat fn in + let stats = Path.lstat fn in let () = (* We remove write permissions to uniformize behavior regardless of whether the cache is activated. No need to be zealous in case the file is not diff --git a/src/stdune/path.ml b/src/stdune/path.ml index af3928e0fe3..1f997a064ce 100644 --- a/src/stdune/path.ml +++ b/src/stdune/path.ml @@ -1263,6 +1263,8 @@ let local_part = function let stat t = Unix.stat (to_string t) +let lstat t = Unix.lstat (to_string t) + include (Comparator.Operators (T) : Comparator.OPS with type t := t) let path_of_local = of_local diff --git a/src/stdune/path.mli b/src/stdune/path.mli index e171b14ef8e..84540e8a463 100644 --- a/src/stdune/path.mli +++ b/src/stdune/path.mli @@ -358,6 +358,8 @@ val local_part : t -> Local.t val stat : t -> Unix.stats +val lstat : t -> Unix.stats + (* it would be nice to call this [Set.of_source_paths], but it's annoying to change the [Set] signature because then we don't comply with [Path_intf.S] *) val set_of_source_paths : Source.Set.t -> Set.t