diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2023-07-27 17:09:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-27 17:09:08 -0400 |
| commit | 83f9d80c0b0b7752e490abb45145073d8d0e656d (patch) | |
| tree | d8f4bcbd9cb2dbeb26bc63383a0fe52504f880c8 /tool | |
| parent | f72f3ab15b79d35e3ddc53d7d3df0e75d5402575 (diff) | |
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
Diffstat (limited to 'tool')
| -rw-r--r-- | tool/downloader.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tool/downloader.rb b/tool/downloader.rb index 0bcd8f31c3..2398fd7b04 100644 --- a/tool/downloader.rb +++ b/tool/downloader.rb @@ -270,6 +270,7 @@ class Downloader 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)) |
