Documenter.jl icon indicating copy to clipboard operation
Documenter.jl copied to clipboard

fix error in relpath_from_repo_root when file not exists

Open clouds56 opened this issue 3 years ago • 3 comments

now relpath_from_repo_root would fail if file not exists

ERROR: LoadError: IOError: cd("/cache/build/default-amdci5-1/julialang/julia-master/usr/share/julia/stdlib/v1.9/CRC32c/src"): no such file or directory (ENOENT)
Stacktrace:
  [1] uv_error
    @ ./libuv.jl:100 [inlined]
  [2] cd(dir::String)
    @ Base.Filesystem ./file.jl:91
  [3] cd(f::Documenter.Utilities.var"#3#4"{String}, dir::String)
    @ Base.Filesystem ./file.jl:111
  [4] relpath_from_repo_root
    @ /cache/build/default-amdci4-6/julialang/julia-master/doc/deps/packages/Documenter/GS7EF/src/Utilities/Utilities.jl:423 [inlined]
  [5] source_url(repo::Documenter.Utilities.Remotes.GitHub, mod::Module, file::String, linerange::UnitRange{Int64})
    @ Documenter.Utilities /cache/build/default-amdci4-6/julialang/julia-master/doc/deps/packages/Documenter/GS7EF/src/Utilities/Utilities.jl:471

clouds56 avatar Sep 07 '22 08:09 clouds56

We should indeed handle this case. How did you run into this by the way? Was that when building the Julia manual? Locally or on CI?

I am not sure returning nothing fixes it though.. don't you now get a MethodError from repofile?

mortenpi avatar Sep 11 '22 05:09 mortenpi

Was that when building the Julia manual? Locally or on CI?

On CI, just use the master julia and master Document.jl would repro this

Before the change: https://buildkite.com/julialang/julia-master/builds/15556#018313da-c7ff-4313-903a-e52390834827 after the change: https://buildkite.com/julialang/julia-master/builds/15581#01831796-6847-4ab9-9c7e-ce63d813c377 (other changes are unrelated, just focus on doctest.

clouds56 avatar Sep 11 '22 12:09 clouds56

The key is julia is not installed at prefix it build, so it would trying to find file (/cache/build/default-amdci5-1/julialang/julia-master/usr/share/julia/stdlib/v1.9/CRC32c/src) but there's only /cache/build/default-amdci4-6/julialang/julia-master/doc/deps/packages/Documenter/GS7EF/src

clouds56 avatar Sep 11 '22 12:09 clouds56

It looks like there are some tests that are outdated now due to this change. Could you change these to @test_throws ErrorException ...? I don't have write access to your branch, so I can't do it myself.

  • https://github.com/clouds56-contrib/Documenter.jl/blob/2bcd70716dd84e4bcba404114e40727ea9778397/test/utilities.jl#L193-L195
  • https://github.com/clouds56-contrib/Documenter.jl/blob/2bcd70716dd84e4bcba404114e40727ea9778397/test/utilities.jl#L215-L217
  • https://github.com/clouds56-contrib/Documenter.jl/blob/2bcd70716dd84e4bcba404114e40727ea9778397/test/utilities.jl#L250-L252

mortenpi avatar Oct 09 '22 05:10 mortenpi

Thanks @clouds56!

mortenpi avatar Oct 10 '22 19:10 mortenpi