Skip to content

Commit

Permalink
make precompile files writable (#41614)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6d58068)
  • Loading branch information
KristofferC committed Aug 31, 2021
1 parent 3a8173a commit c6a135d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,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)
Expand Down
4 changes: 4 additions & 0 deletions test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,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
Expand Down

0 comments on commit c6a135d

Please sign in to comment.