Skip to content

Commit 65be74d

Browse files
IanButterworthKristofferC
authored andcommitted
rename: invalid -> incompatible cache header (#56240)
Falling back to the older serial precompilation process is basically a bug (except for if a manifest hasn't been resolved) so #52619 added more info on why it's been hit so we have a chance of fixing issues that are otherwise very difficult to recreate. However "invalid header" which usually just means it was made by a different julia version appears to sound too alarming to users. https://discourse.julialang.org/t/cache-misses-when-using-packages-since-upgrading-to-1-11/121445 So soften it there and in error messages, given it seems a better description. Suggested by @giordano in https://discourse.julialang.org/t/cache-misses-when-using-packages-since-upgrading-to-1-11/121445/4?u=ianshmean
1 parent ff9b970 commit 65be74d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

base/loading.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
12471247
else
12481248
io = open(path, "r")
12491249
try
1250-
iszero(isvalid_cache_header(io)) && return ArgumentError("Invalid header in cache file $path.")
1250+
iszero(isvalid_cache_header(io)) && return ArgumentError("Incompatible header in cache file $path.")
12511251
_, (includes, _, _), _, _, _, _, _, _ = parse_cache_header(io, path)
12521252
ignore_native = pkg_tracked(includes)
12531253
finally
@@ -1887,7 +1887,7 @@ function isrelocatable(pkg::PkgId)
18871887
isnothing(path) && return false
18881888
io = open(path, "r")
18891889
try
1890-
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Invalid header in cache file $cachefile."))
1890+
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Incompatible header in cache file $cachefile."))
18911891
_, (includes, includes_srcfiles, _), _... = _parse_cache_header(io, path)
18921892
for inc in includes
18931893
!startswith(inc.filename, "@depot") && return false
@@ -1962,7 +1962,7 @@ function _tryrequire_from_serialized(pkg::PkgId, path::String, ocachepath::Union
19621962
io = open(path, "r")
19631963
ignore_native = false
19641964
try
1965-
iszero(isvalid_cache_header(io)) && return ArgumentError("Invalid header in cache file $path.")
1965+
iszero(isvalid_cache_header(io)) && return ArgumentError("Incompatible header in cache file $path.")
19661966
_, (includes, _, _), depmodnames, _, _, _, clone_targets, _ = parse_cache_header(io, path)
19671967

19681968
ignore_native = pkg_tracked(includes)
@@ -3176,7 +3176,7 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in
31763176
# append extra crc to the end of the .ji file:
31773177
open(tmppath, "r+") do f
31783178
if iszero(isvalid_cache_header(f))
3179-
error("Invalid header for $(repr("text/plain", pkg)) in new cache file $(repr(tmppath)).")
3179+
error("Incompatible header for $(repr("text/plain", pkg)) in new cache file $(repr(tmppath)).")
31803180
end
31813181
seekend(f)
31823182
write(f, crc_so)
@@ -3500,7 +3500,7 @@ end
35003500
function parse_cache_header(cachefile::String)
35013501
io = open(cachefile, "r")
35023502
try
3503-
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Invalid header in cache file $cachefile."))
3503+
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Incompatible header in cache file $cachefile."))
35043504
ret = parse_cache_header(io, cachefile)
35053505
return ret
35063506
finally
@@ -3513,7 +3513,7 @@ function preferences_hash(cachefile::String)
35133513
io = open(cachefile, "r")
35143514
try
35153515
if iszero(isvalid_cache_header(io))
3516-
throw(ArgumentError("Invalid header in cache file $cachefile."))
3516+
throw(ArgumentError("Incompatible header in cache file $cachefile."))
35173517
end
35183518
return preferences_hash(io, cachefile)
35193519
finally
@@ -3529,7 +3529,7 @@ end
35293529
function cache_dependencies(cachefile::String)
35303530
io = open(cachefile, "r")
35313531
try
3532-
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Invalid header in cache file $cachefile."))
3532+
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Incompatible header in cache file $cachefile."))
35333533
return cache_dependencies(io, cachefile)
35343534
finally
35353535
close(io)
@@ -3569,7 +3569,7 @@ end
35693569
function read_dependency_src(cachefile::String, filename::AbstractString)
35703570
io = open(cachefile, "r")
35713571
try
3572-
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Invalid header in cache file $cachefile."))
3572+
iszero(isvalid_cache_header(io)) && throw(ArgumentError("Incompatible header in cache file $cachefile."))
35733573
return read_dependency_src(io, cachefile, filename)
35743574
finally
35753575
close(io)
@@ -3853,9 +3853,9 @@ end
38533853
try
38543854
checksum = isvalid_cache_header(io)
38553855
if iszero(checksum)
3856-
@debug "Rejecting cache file $cachefile due to it containing an invalid cache header"
3857-
record_reason(reasons, "invalid header")
3858-
return true # invalid cache file
3856+
@debug "Rejecting cache file $cachefile due to it containing an incompatible cache header"
3857+
record_reason(reasons, "incompatible header")
3858+
return true # incompatible cache file
38593859
end
38603860
modules, (includes, _, requires), required_modules, srctextpos, prefs, prefs_hash, clone_targets, actual_flags = parse_cache_header(io, cachefile)
38613861
if isempty(modules)

stdlib/Logging/docs/src/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ module. Loading julia with `JULIA_DEBUG=loading` will activate
191191

192192
```
193193
$ JULIA_DEBUG=loading julia -e 'using OhMyREPL'
194-
┌ Debug: Rejecting cache file /home/user/.julia/compiled/v0.7/OhMyREPL.ji due to it containing an invalid cache header
194+
┌ Debug: Rejecting cache file /home/user/.julia/compiled/v0.7/OhMyREPL.ji due to it containing an incompatible cache header
195195
└ @ Base loading.jl:1328
196196
[ Info: Recompiling stale cache file /home/user/.julia/compiled/v0.7/OhMyREPL.ji for module OhMyREPL
197-
┌ Debug: Rejecting cache file /home/user/.julia/compiled/v0.7/Tokenize.ji due to it containing an invalid cache header
197+
┌ Debug: Rejecting cache file /home/user/.julia/compiled/v0.7/Tokenize.ji due to it containing an incompatible cache header
198198
└ @ Base loading.jl:1328
199199
...
200200
```

0 commit comments

Comments
 (0)