From 7df35874754723f9dbc94d590fb486dd8a2b718f Mon Sep 17 00:00:00 2001 From: KristofferC Date: Fri, 16 Jul 2021 10:55:01 +0200 Subject: [PATCH] make precompile files writable --- base/loading.jl | 4 ++-- test/precompile.jl | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 851ebf17cc3b9..84ad47517cc31 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -1435,8 +1435,8 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in open(tmppath, "a+") do f write(f, _crc32c(seekstart(f))) end - # inherit permission from the source file - chmod(tmppath, filemode(path) & 0o777) + # inherit permission from the source file (and make them writable) + chmod(tmppath, filemode(path) & 0o777 | 0o200) # Read preferences hash back from .ji file (we can't precompute because # we don't actually know what the list of compile-time preferences are without compiling) diff --git a/test/precompile.jl b/test/precompile.jl index f69e7a4766f2c..51b25b8325b2a 100644 --- a/test/precompile.jl +++ b/test/precompile.jl @@ -823,6 +823,10 @@ precompile_test_harness("Issue #25971") do load_path chmod(sourcefile, 0o600) cachefile = Base.compilecache(Base.PkgId("Foo25971")) @test filemode(sourcefile) == filemode(cachefile) + chmod(sourcefile, 0o444) + cachefile = Base.compilecache(Base.PkgId("Foo25971")) + # Check writable + @test touch(cachefile) == cachefile end precompile_test_harness("Issue #38312") do load_path