Skip to content

Commit c6a135d

Browse files
committed
make precompile files writable (#41614)
(cherry picked from commit 6d58068)
1 parent 3a8173a commit c6a135d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

base/loading.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,8 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in
13541354
open(tmppath, "a+") do f
13551355
write(f, _crc32c(seekstart(f)))
13561356
end
1357-
# inherit permission from the source file
1358-
chmod(tmppath, filemode(path) & 0o777)
1357+
# inherit permission from the source file (and make them writable)
1358+
chmod(tmppath, filemode(path) & 0o777 | 0o200)
13591359

13601360
# Read preferences hash back from .ji file (we can't precompute because
13611361
# we don't actually know what the list of compile-time preferences are without compiling)

test/precompile.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,10 @@ precompile_test_harness("Issue #25971") do load_path
826826
chmod(sourcefile, 0o600)
827827
cachefile = Base.compilecache(Base.PkgId("Foo25971"))
828828
@test filemode(sourcefile) == filemode(cachefile)
829+
chmod(sourcefile, 0o444)
830+
cachefile = Base.compilecache(Base.PkgId("Foo25971"))
831+
# Check writable
832+
@test touch(cachefile) == cachefile
829833
end
830834

831835
precompile_test_harness("Issue #38312") do load_path

0 commit comments

Comments
 (0)