julia icon indicating copy to clipboard operation
julia copied to clipboard

Set stdlib sources as read-only during installation

Open staticfloat opened this issue 1 year ago • 6 comments

We previously did this for base and test in https://github.com/JuliaLang/julia/pull/55524, may as well do it for stdlib as well.

staticfloat avatar Aug 20 '24 04:08 staticfloat

Apparently this breaks the tests

giordano avatar Aug 20 '24 07:08 giordano

Apparently this breaks the tests

The mktempdir() call in https://github.com/JuliaLang/Pkg.jl/blob/8b2c0f32939042e5d77da05d2825de6ec56487e9/test/artifacts.jl#L622 seems to be the issue, although the corresponding path seems to not be affected by the change here.

Error During Test at /cache/build/tester-amdci4-13/julialang/julia-master/julia-238d3842ee/share/julia/stdlib/v1.12/Pkg/test/artifacts.jl:617
  Got exception outside of a @test
  IOError: open("/cache/build/tester-amdci4-13/julialang/julia-master/tmp/jl_ITvvWo/ArtifactOverrideLoading/src/ArtifactOverrideLoading.jl", 65, 438): permission denied (EACCES)
  Stacktrace:
    [1] uv_error
      @ ./libuv.jl:106 [inlined]
    [2] open(path::String, flags::UInt16, mode::UInt16)
      @ Base.Filesystem ./filesystem.jl:190
    [3] touch(path::String)
      @ Base.Filesystem ./file.jl:524
    [4] (::Main.Test97Main_Pkg.PkgTestsOuter.PkgTestsInner.ArtifactTests.var"#118#131")(depot_container::String)
      @ Main.Test97Main_Pkg.PkgTestsOuter.PkgTestsInner.ArtifactTests /cache/build/tester-amdci4-13/julialang/julia-master/julia-238d3842ee/share/julia/stdlib/v1.12/Pkg/test/artifacts.jl:736
    [5] mktempdir(fn::Main.Test97Main_Pkg.PkgTestsOuter.PkgTestsInner.ArtifactTests.var"#118#131", parent::String; prefix::String)
      @ Base.Filesystem ./file.jl:889
    [6] mktempdir(fn::Function, parent::String)
      @ Base.Filesystem ./file.jl:885
    [7] top-level scope
      @ /cache/build/tester-amdci4-13/julialang/julia-master/julia-238d3842ee/share/julia/stdlib/v1.12/Pkg/test/artifacts.jl:622
    [8] macro expansion
      @ /cache/build/tester-amdci4-13/julialang/julia-master/julia-238d3842ee/share/julia/stdlib/v1.12/Test/src/Test.jl:1703 [inlined]
    [9] macro expansion
      @ /cache/build/tester-amdci4-13/julialang/julia-master/julia-238d3842ee/share/julia/stdlib/v1.12/Pkg/test/artifacts.jl:622 [inlined]
   [10] include(mod::Module, _path::String)
      @ Base ./Base.jl:582

lgoettgens avatar Aug 20 '24 09:08 lgoettgens

It's not the mktempdir call but the fact that this file https://github.com/JuliaLang/Pkg.jl/blob/8b2c0f32939042e5d77da05d2825de6ec56487e9/test/test_packages/ArtifactOverrideLoading/src/ArtifactOverrideLoading.jl now gets set as read-only it then gets developed https://github.com/JuliaLang/Pkg.jl/blob/8b2c0f32939042e5d77da05d2825de6ec56487e9/test/artifacts.jl#L697-L701 and then attempts to be touched: https://github.com/JuliaLang/Pkg.jl/blob/8b2c0f32939042e5d77da05d2825de6ec56487e9/test/artifacts.jl#L736 (which doesn't work since it is read only).

KristofferC avatar Aug 20 '24 10:08 KristofferC

Having stdlibs read-only still seems sensible for me. But maybe it's enough to apply the read-only to stdlib/*/src?

lgoettgens avatar Aug 20 '24 10:08 lgoettgens

Should the test at https://github.com/JuliaLang/Pkg.jl/blob/8b2c0f32939042e5d77da05d2825de6ec56487e9/test/artifacts.jl#L736 ensure the file is writable with a chmod before attempting to touch it?

giordano avatar Aug 20 '24 10:08 giordano

I think it should copy it somewhere and only then mutate it.

KristofferC avatar Aug 20 '24 10:08 KristofferC