Skip to content

Commit

Permalink
Use arch-independent magic number as start seed for Preferences hash (#…
Browse files Browse the repository at this point in the history
…39274)

`Preferences.jl` is currently broken on 32-bit because hashing natively
uses `UInt32`'s instead of `UInt64`'s.  We allow `Preferences.jl` to
polymorph to whichever it requires here, while eliminating a confusing
large constant and simply starting from zero.
  • Loading branch information
staticfloat authored Jan 15, 2021
1 parent bea5e6e commit 7647ab5
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 @@ -1645,9 +1645,10 @@ function get_preferences(uuid::UUID)
end

function get_preferences_hash(uuid::Union{UUID, Nothing}, prefs_list::Vector{String})
# Start from the "null" hash
h = UInt64(0x6e65726566657250)
uuid === nothing && return h
# Start from a predictable hash point to ensure that the same preferences always
# hash to the same value, modulo changes in how Dictionaries are hashed.
h = UInt(0)
uuid === nothing && return UInt64(h)

# Load the preferences
prefs = get_preferences(uuid)
Expand All @@ -1659,7 +1660,8 @@ function get_preferences_hash(uuid::Union{UUID, Nothing}, prefs_list::Vector{Str
h = hash(prefs_name, h)
end
end
return h
# We always return a `UInt64` so that our serialization format is stable
return UInt64(h)
end

get_preferences_hash(m::Module, prefs_list::Vector{String}) = get_preferences_hash(PkgId(m).uuid, prefs_list)
Expand Down

8 comments on commit 7647ab5

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - successfully executed benchmarks. A full report can be found here. cc @christopher-dG

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible issues were detected. A full report can be found here. cc @maleadt

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - successfully executed benchmarks. A full report can be found here. cc @christopher-dG

Please sign in to comment.