-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ocamldep-postproc in case-insensitive, case-preserving filesystems. #150
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -779,6 +779,12 @@ let has_file_stat ?compact_stat ?digest cache node = | |
has_file_stat_1 ?compact_stat ?digest cache node | ||
|
||
|
||
let unix_filename_exists path = | ||
let basedir = Filename.dirname path in | ||
let basename = Filename.basename path in | ||
basename = "." || basename = ".." || Array.exists (String.equal basename) (Sys.readdir basedir) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. readdir inside stat (wrapper) sounds expensive There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is :-(, but I'm not aware of any BSD/POSIX syscall/API to obtain the original capitalization -- I read even The only alternative I can think of is finding the mount point, probing the FS and caching this info, but it still feels a bit dirty. |
||
|
||
|
||
let stat_unix_node cache ~force node = | ||
(* We used to cache this information, but don't do this anymore. Hence, | ||
the [force] flag is ignored: we always re-stat | ||
|
@@ -787,6 +793,7 @@ let stat_unix_node cache ~force node = | |
let name = Omake_node.Node.fullname node in | ||
try | ||
let s = Unix.LargeFile.stat name in | ||
if not @@ unix_filename_exists name then raise (Sys_error ""); | ||
ex_set cache node true; | ||
s | ||
with | ||
|
@@ -806,7 +813,9 @@ let lstat_unix_node _cache ~force node = | |
ignore(force); | ||
let name = Omake_node.Node.fullname node in | ||
try | ||
Unix.LargeFile.lstat name | ||
let s = Unix.LargeFile.lstat name in | ||
if not @@ unix_filename_exists name then raise (Sys_error ""); | ||
s | ||
with | ||
Unix.Unix_error _ | ||
| Sys_error _ -> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was required for
omake
's bootstrapping to work.