Skip to content

Commit 83f9d80

Browse files
authored
downloader.rb: unlink broken symlink before caching to fix ENOENT
On GitHub CI, the downloader's cache is shared across different jobs. For some systems, the cached config.guess ends up being a symlink to /usr/share/autoconf/build-aux/config.guess and containers that don't have that file end up consuming the cache anyways, leading to ENOENT when trying to cache the downloaded file. This error happened on forks: - https://github.com/XrXr/ruby/actions/runs/5675262636/job/15380232344 - https://github.com/peterzhu2118/ruby/actions/runs/5684765421/job/15408188728
1 parent f72f3ab commit 83f9d80

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tool/downloader.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def self.download(url, name, dir = nil, since = true, options = {})
270270
end
271271
dest = (cache_save && cache && !cache.exist? ? cache : file)
272272
dest.parent.mkpath
273+
dest.unlink if dest.symlink? && !dest.exist?
273274
dest.open("wb", 0600) do |f|
274275
f.write(data)
275276
f.chmod(mode_for(data))

0 commit comments

Comments
 (0)