From d542c7b7b2c62c7c5d15e66065fc2e9142b6bdab Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Thu, 12 Nov 2020 16:36:45 -0800 Subject: [PATCH] [sledge] Protect against nonexistent paths in debug info Summary: Do not fail when resolving the realpath of a debug info path. Reviewed By: jvillard Differential Revision: D24746237 fbshipit-source-id: b9dc35176 --- sledge/src/llair/loc.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sledge/src/llair/loc.ml b/sledge/src/llair/loc.ml index 35647bec1..d642bc3b2 100644 --- a/sledge/src/llair/loc.ml +++ b/sledge/src/llair/loc.ml @@ -13,7 +13,10 @@ type t = {dir: string; file: string; line: int; col: int} let none = {dir= ""; file= ""; line= 0; col= 0} let mk ?(dir = none.dir) ?(file = none.file) ?(col = none.col) ~line = - let dir = if String.is_empty dir then dir else Filename.realpath dir in + let dir = + if String.is_empty dir then dir + else try Filename.realpath dir with Unix.Unix_error _ -> dir + in {dir; file; line; col} let root = ref (Filename.realpath (Sys.getcwd ()))