Skip to content

fix pkg loading from read-only filesystems on unix#61253

Merged
Keno merged 1 commit intoJuliaLang:masterfrom
nolta:mn/fix_pkg_load_on_ro_fs
Mar 7, 2026
Merged

fix pkg loading from read-only filesystems on unix#61253
Keno merged 1 commit intoJuliaLang:masterfrom
nolta:mn/fix_pkg_load_on_ro_fs

Conversation

@nolta
Copy link
Copy Markdown
Member

@nolta nolta commented Mar 6, 2026

On our HPC systems /home is mounted read-only on the compute nodes, and if you load a precompiled pkg you'll see errors like the following:

julia> using DataFrames
ERROR: SystemError: futimes: Permission denied
Stacktrace:
  [1] systemerror(p::Symbol, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:186
  [2] systemerror
    @ ./error.jl:185 [inlined]
  [3] touch
    @ ./filesystem.jl:361 [inlined]
  [4] touch(path::String)
    @ Base.Filesystem ./file.jl:546
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:2090
...

But touching read-only files is supposed to be fine, according to the code comments:

julia/base/loading.jl

Lines 2058 to 2064 in 74d1230

try
# update timestamp of precompilation file so that it is the first to be tried by code loading
touch(path_to_try)
catch ex
# file might be read-only and then we fail to update timestamp, which is fine
ex isa IOError || rethrow()
end

However, only IOErrors are ignored. On unix touch() calls futimes in the C stdlib and throws SystemError:

julia/base/filesystem.jl

Lines 359 to 368 in 74d1230

function touch(f::File)
@static if Sys.isunix()
ret = ccall(:futimes, Cint, (Cint, Ptr{Cvoid}), fd(f), C_NULL)
systemerror(:futimes, ret != 0)
else
t = time()
futime(f, t, t)
end
f
end

This patch ignores all exceptions thrown when touching precompilation files.

Precompilation files are touched during loading, and if the file is read-only the error is supposed to be ignored.

However, only `IOError`s were ignored. On unix `touch` calls `futimes` in the C stdlib and throws `SystemError`.
@KristofferC KristofferC added backport 1.10 Change should be backported to the 1.10 release backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 labels Mar 6, 2026
@Keno Keno merged commit 8245674 into JuliaLang:master Mar 7, 2026
10 of 11 checks passed
@StefanKarpinski
Copy link
Copy Markdown
Member

Hi, @nolta!!!

KristofferC pushed a commit that referenced this pull request Mar 12, 2026
On our HPC systems `/home` is mounted read-only on the compute nodes,
and if you load a precompiled pkg you'll see errors like the following:

```
julia> using DataFrames
ERROR: SystemError: futimes: Permission denied
Stacktrace:
  [1] systemerror(p::Symbol, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:186
  [2] systemerror
    @ ./error.jl:185 [inlined]
  [3] touch
    @ ./filesystem.jl:361 [inlined]
  [4] touch(path::String)
    @ Base.Filesystem ./file.jl:546
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:2090
...
```

But touching read-only files is supposed to be fine, according to the
code comments:

https://github.com/JuliaLang/julia/blob/74d12302d74928dbe8c8883bdd395cd3e35481b9/base/loading.jl#L2058-L2064

However, only `IOError`s are ignored. On unix `touch()` calls `futimes`
in the C stdlib and throws `SystemError`:

https://github.com/JuliaLang/julia/blob/74d12302d74928dbe8c8883bdd395cd3e35481b9/base/filesystem.jl#L359-L368

This patch ignores all exceptions thrown when touching precompilation
files.

(cherry picked from commit 8245674)
@KristofferC KristofferC removed the backport 1.13 Change should be backported to release-1.13 label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.10 Change should be backported to the 1.10 release backport 1.12 Change should be backported to release-1.12

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants