summaryrefslogtreecommitdiff
path: root/.indent.pro
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-04-27 20:18:55 -0700
committerJeremy Evans <code@jeremyevans.net>2019-07-01 11:46:30 -0700
commit11c311e36fa6f27a9144b0aefe16bdffea651251 (patch)
tree17c8f43e31c90d357680a00285601d4278091e70 /.indent.pro
parent81fe82be4e5040b314717e8d6f9ba12de222b6e6 (diff)
downloadruby-11c311e36fa6f27a9144b0aefe16bdffea651251.tar.gz
Use realpath(3) instead of custom realpath implementation if available
This approach is simpler than the previous approach which tries to emulate realpath(3). It also performs much better on both Linux and OpenBSD on the included benchmarks. By using realpath(3), we can better integrate with system security features such as OpenBSD's unveil(2) system call. This does not use realpath(3) on Windows even if it exists, as the approach for checking for absolute paths does not work for drive letters. This can be fixed without too much difficultly, though until Windows defines realpath(3), there is no need to do so. For File.realdirpath, where the last element of the path is not required to exist, fallback to the previous approach, as realpath(3) on most operating systems requires the whole path be valid (per POSIX), and the operating systems where this isn't true either plan to conform to POSIX or may change to conform to POSIX in the future. glibc realpath(3) does not handle /path/to/file.rb/../other_file.rb paths, returning ENOTDIR in that case. Fallback to the previous code if realpath(3) returns ENOTDIR. glibc doesn't like realpath(3) usage for paths like /dev/fd/5, returning ENOENT even though the path may appear to exist in the filesystem. If ENOENT is returned and the path exists, then fall back to the default approach.
Diffstat (limited to '.indent.pro')
0 files changed, 0 insertions, 0 deletions