Skip to content

Commit 21e0f04

Browse files
authored
Merge pull request #36899 from JuliaLang/backports-release-1.5
Backports 1.5.1
2 parents f0b8c76 + a197786 commit 21e0f04

File tree

215 files changed

+1547
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+1547
-398
lines changed

Make.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,17 +928,17 @@ LIBUNWIND:=
928928
else
929929
ifeq ($(USE_SYSTEM_LIBUNWIND), 1)
930930
ifneq ($(OS),Darwin)
931-
LIBUNWIND:=-lunwind-generic -lunwind
931+
LIBUNWIND:=-lunwind
932932
# Only for linux since we want to use not yet released libunwind features
933933
JCFLAGS+=-DSYSTEM_LIBUNWIND
934934
JCPPFLAGS+=-DSYSTEM_LIBUNWIND
935935
endif
936936
else
937937
ifeq ($(OS),Darwin)
938-
LIBUNWIND:=$(build_libdir)/libosxunwind.a
938+
LIBUNWIND:=-losxunwind
939939
JCPPFLAGS+=-DLIBOSXUNWIND
940940
else
941-
LIBUNWIND:=$(build_libdir)/libunwind-generic.a $(build_libdir)/libunwind.a
941+
LIBUNWIND:=-lunwind
942942
endif
943943
endif
944944
endif
@@ -1194,12 +1194,12 @@ OSLIBS += -lelf -lkvm -lrt -lpthread
11941194
OSLIBS += -lgcc_s
11951195

11961196
OSLIBS += -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap \
1197-
$(NO_WHOLE_ARCHIVE) $(LIBUNWIND)
1197+
$(NO_WHOLE_ARCHIVE)
11981198
endif
11991199

12001200
ifeq ($(OS), Darwin)
12011201
SHLIB_EXT := dylib
1202-
OSLIBS += -framework CoreFoundation $(LIBUNWIND)
1202+
OSLIBS += -framework CoreFoundation
12031203
WHOLE_ARCHIVE := -Xlinker -all_load
12041204
NO_WHOLE_ARCHIVE :=
12051205
JLDFLAGS :=

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ endif
181181
ifeq ($(USE_LLVM_SHLIB),1)
182182
JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM libLLVM-9jl
183183
endif
184+
ifeq ($(OS),Darwin)
185+
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBUNWIND) += libosxunwind
186+
else
187+
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBUNWIND) += libunwind
188+
endif
184189

185190
ifeq ($(USE_SYSTEM_LIBM),0)
186191
JL_PRIVATE_LIBS-$(USE_SYSTEM_OPENLIBM) += libopenlibm

base/file.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,12 +890,11 @@ function unlink(p::AbstractString)
890890
end
891891

892892
# For move command
893-
function rename(src::AbstractString, dst::AbstractString)
893+
function rename(src::AbstractString, dst::AbstractString; force::Bool=false)
894894
err = ccall(:jl_fs_rename, Int32, (Cstring, Cstring), src, dst)
895895
# on error, default to cp && rm
896896
if err < 0
897-
# force: is already done in the mv function
898-
cp(src, dst; force=false, follow_symlinks=false)
897+
cp(src, dst; force=force, follow_symlinks=false)
899898
rm(src; recursive=true)
900899
end
901900
nothing

base/loading.jl

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,9 +1256,9 @@ const MAX_NUM_PRECOMPILE_FILES = 10
12561256
function compilecache(pkg::PkgId, path::String)
12571257
# decide where to put the resulting cache file
12581258
cachefile = compilecache_path(pkg)
1259+
cachepath = dirname(cachefile)
12591260
# prune the directory with cache files
12601261
if pkg.uuid !== nothing
1261-
cachepath = dirname(cachefile)
12621262
entrypath, entryfile = cache_file_entry(pkg)
12631263
cachefiles = filter!(x -> startswith(x, entryfile * "_"), readdir(cachepath))
12641264
if length(cachefiles) >= MAX_NUM_PRECOMPILE_FILES
@@ -1276,20 +1276,34 @@ function compilecache(pkg::PkgId, path::String)
12761276
# run the expression and cache the result
12771277
verbosity = isinteractive() ? CoreLogging.Info : CoreLogging.Debug
12781278
@logmsg verbosity "Precompiling $pkg"
1279-
p = create_expr_cache(path, cachefile, concrete_deps, pkg.uuid)
1280-
if success(p)
1281-
# append checksum to the end of the .ji file:
1282-
open(cachefile, "a+") do f
1283-
write(f, _crc32c(seekstart(f)))
1279+
1280+
# create a temporary file in `cachepath` directory, write the cache in it,
1281+
# write the checksum, _and then_ atomically move the file to `cachefile`.
1282+
tmppath, tmpio = mktemp(cachepath)
1283+
local p
1284+
try
1285+
close(tmpio)
1286+
p = create_expr_cache(path, tmppath, concrete_deps, pkg.uuid)
1287+
if success(p)
1288+
# append checksum to the end of the .ji file:
1289+
open(tmppath, "a+") do f
1290+
write(f, _crc32c(seekstart(f)))
1291+
end
1292+
# inherit permission from the source file
1293+
chmod(tmppath, filemode(path) & 0o777)
1294+
1295+
# this is atomic according to POSIX:
1296+
rename(tmppath, cachefile; force=true)
1297+
return cachefile
12841298
end
1285-
# inherit permission from the source file
1286-
chmod(cachefile, filemode(path) & 0o777)
1287-
elseif p.exitcode == 125
1299+
finally
1300+
rm(tmppath, force=true)
1301+
end
1302+
if p.exitcode == 125
12881303
return PrecompilableError()
12891304
else
12901305
error("Failed to precompile $pkg to $cachefile.")
12911306
end
1292-
return cachefile
12931307
end
12941308

12951309
module_build_id(m::Module) = ccall(:jl_module_build_id, UInt64, (Any,), m)

base/reduce.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,15 @@ julia> count([true, false, true, true])
861861
"""
862862
count(itr) = count(identity, itr)
863863

864-
count(f, itr) = mapreduce(_bool(f), add_sum, itr, init=0)
864+
count(f, itr) = _simple_count(f, itr)
865+
866+
function _simple_count(pred, itr)
867+
n = 0
868+
for x in itr
869+
n += pred(x)::Bool
870+
end
871+
return n
872+
end
865873

866874
function count(::typeof(identity), x::Array{Bool})
867875
n = 0

base/reducedim.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,10 @@ julia> count(<=(2), A, dims=2)
387387
```
388388
"""
389389
count(A::AbstractArrayOrBroadcasted; dims=:) = count(identity, A, dims=dims)
390-
count(f, A::AbstractArrayOrBroadcasted; dims=:) = mapreduce(_bool(f), add_sum, A, dims=dims, init=0)
390+
count(f, A::AbstractArrayOrBroadcasted; dims=:) = _count(f, A, dims)
391+
392+
_count(f, A::AbstractArrayOrBroadcasted, dims::Colon) = _simple_count(f, A)
393+
_count(f, A::AbstractArrayOrBroadcasted, dims) = mapreduce(_bool(f), add_sum, A, dims=dims, init=0)
391394

392395
"""
393396
count!([f=identity,] r, A)

base/ryu/shortest.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ end
330330
olength = decimallength(output)
331331
exp_form = true
332332
pt = nexp + olength
333-
if -4 < pt <= (precision == -1 ? (T == Float16 ? 3 : 6) : precision)
333+
if -4 < pt <= (precision == -1 ? (T == Float16 ? 3 : 6) : precision) &&
334+
!(pt >= olength && abs(mod(x + 0.05, 10^(pt - olength)) - 0.05) > 0.05)
334335
exp_form = false
335336
if pt <= 0
336337
buf[pos] = UInt8('0')

base/set.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,7 @@ end
385385

386386
allunique(::Union{AbstractSet,AbstractDict}) = true
387387

388-
allunique(r::AbstractRange{T}) where {T} = (step(r) != zero(T)) || (length(r) <= 1)
389-
allunique(r::StepRange{T,S}) where {T,S} = (step(r) != zero(S)) || (length(r) <= 1)
390-
allunique(r::StepRangeLen{T,R,S}) where {T,R,S} = (step(r) != zero(S)) || (length(r) <= 1)
388+
allunique(r::AbstractRange) = !iszero(step(r)) || length(r) <= 1
391389

392390
filter!(f, s::Set) = unsafe_filter!(f, s)
393391

base/strings/util.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ function replace(str::String, pat_repl::Pair; count::Integer=typemax(Int))
521521
i = k = nextind(str, k)
522522
end
523523
r = something(findnext(pattern,str,k), 0)
524-
r == 0:-1 || n == count && break
524+
r === 0:-1 || n == count && break
525525
j, k = first(r), last(r)
526526
n += 1
527527
end

contrib/mac/app/Entitlements.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<dict>
55
<key>com.apple.security.automation.apple-events</key>
66
<true/>
7+
<key>com.apple.security.cs.get-task-allow</key>
8+
<true/>
79
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
810
<true/>
911
<key>com.apple.security.cs.allow-jit</key>

0 commit comments

Comments
 (0)