Merge pull request #20412 from XuehaiPan/fix-ld-so-conf

os/linux/ld: do not crash the program if the `ld.so.conf` entry is not readable
This commit is contained in:
Mike McQuaid 2025-08-11 12:05:45 +00:00 committed by GitHub
commit 8c1048bbf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,6 +49,8 @@ module OS
def self.library_paths(conf_path = Pathname(sysconfdir)/"ld.so.conf")
conf_file = Pathname(conf_path)
return [] unless conf_file.exist?
return [] unless conf_file.file?
return [] unless conf_file.readable?
@library_paths_cache ||= T.let({}, T.nilable(T::Hash[String, T::Array[String]]))
cache_key = conf_file.to_s