Skip to content

Commit

Permalink
Base.stale_cachefile: allow ftime_req to be greater than ftime
Browse files Browse the repository at this point in the history
…by up to one microsecond (to compensate for Windows tar) (#45552)

(cherry picked from commit 4c39647)
  • Loading branch information
DilumAluthge authored and KristofferC committed Dec 21, 2022
1 parent bd74cce commit 02dad13
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1794,11 +1794,13 @@ function stale_cachefile(modpath::String, cachefile::String; ignore_loaded = fal
end
for chi in includes
f, ftime_req = chi.filename, chi.mtime
# Issue #13606: compensate for Docker images rounding mtimes
# Issue #20837: compensate for GlusterFS truncating mtimes to microseconds
# The `ftime != 1.0` condition below provides compatibility with Nix mtime.
ftime = mtime(f)
if ftime != ftime_req && ftime != floor(ftime_req) && ftime != trunc(ftime_req, digits=6) && ftime != 1.0
is_stale = ( ftime != ftime_req ) &&
( ftime != floor(ftime_req) ) && # Issue #13606, PR #13613: compensate for Docker images rounding mtimes
( ftime != trunc(ftime_req, digits=6) ) && # Issue #20837, PR #20840: compensate for GlusterFS truncating mtimes to microseconds
( ftime != 1.0 ) && # PR #43090: provide compatibility with Nix mtime.
!( 0 < (ftime_req - ftime) < 1e-6 ) # PR #45552: Compensate for Windows tar giving mtimes that may be incorrect by up to one microsecond
if is_stale
@debug "Rejecting stale cache file $cachefile (mtime $ftime_req) because file $f (mtime $ftime) has changed"
return true
end
Expand Down

0 comments on commit 02dad13

Please sign in to comment.