Skip to content

Commit

Permalink
downloader.rb: unlink broken symlink before caching to fix ENOENT
Browse files Browse the repository at this point in the history
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
  • Loading branch information
XrXr authored Jul 27, 2023
1 parent f72f3ab commit 83f9d80
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tool/downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def self.download(url, name, dir = nil, since = true, options = {})
end
dest = (cache_save && cache && !cache.exist? ? cache : file)
dest.parent.mkpath
dest.unlink if dest.symlink? && !dest.exist?
dest.open("wb", 0600) do |f|
f.write(data)
f.chmod(mode_for(data))
Expand Down

0 comments on commit 83f9d80

Please sign in to comment.