Skip to content

Commit

Permalink
revert error msg in SystemError
Browse files Browse the repository at this point in the history
  • Loading branch information
fatteneder committed Jun 20, 2024
1 parent 5861922 commit 2c96a66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2059,9 +2059,9 @@ function _include_dependency(mod::Module, _path::AbstractString; track_content=t
end
if !_track_dependencies[]
if !path_may_be_dir && !isfile(path)
throw(SystemError("including file $(repr(path))", Libc.ENOENT))
throw(SystemError("opening file $(repr(path))", Libc.ENOENT))
elseif path_may_be_dir && !Filesystem.isreadable(path)
throw(SystemError("including file or folder $(repr(path))", Libc.ENOENT))
throw(SystemError("opening file or folder $(repr(path))", Libc.ENOENT))
end
else
@lock require_lock begin
Expand Down
6 changes: 3 additions & 3 deletions test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ end
exc = try; include("./notarealfile.jl"); "unexpectedly reached!"; catch exc; exc; end
@test exc isa SystemError
exc.prefix
end == "including file $(repr(joinpath(@__DIR__, "notarealfile.jl")))"
end == "opening file $(repr(joinpath(@__DIR__, "notarealfile.jl")))"

old_act_proj = Base.ACTIVE_PROJECT[]
pushfirst!(LOAD_PATH, "@")
Expand Down Expand Up @@ -1549,7 +1549,7 @@ end
end

file = joinpath(depot, "dev", "non-existent.jl")
@test_throws SystemError("including file $(repr(file))") include(file)
@test_throws SystemError("opening file $(repr(file))") include(file)
touch(file)
@test include_dependency(file) === nothing
chmod(file, 0x000)
Expand All @@ -1559,7 +1559,7 @@ end
@test include_dependency(dir) === nothing
dir
end
@test_throws SystemError("including file or folder $(repr(dir))") include_dependency(dir)
@test_throws SystemError("opening file or folder $(repr(dir))") include_dependency(dir)
end
end

Expand Down
8 changes: 4 additions & 4 deletions test/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2003,18 +2003,18 @@ end

precompile_test_harness("Issue #52063") do load_path
fname = joinpath(load_path, "i_do_not_exist.jl")
@test_throws ArgumentError("$(repr(fname)): No such file or directory") include_dependency(fname)
@test_throws SystemError("opening file or folder $(repr(fname))") include_dependency(fname)
touch(fname)
@test include_dependency(fname) === nothing
chmod(fname, 0x000)
@test_throws ArgumentError("$(repr(fname)): Missing read permission") include_dependency(fname)
@test_throws SystemError("opening file or folder $(repr(fname))", Libc.ENOENT) include_dependency(fname)
dir = mktempdir() do dir
@test include_dependency(dir) === nothing
chmod(dir, 0x000)
@test_throws ArgumentError("$(repr(dir)): Missing read permission") include_dependency(dir)
@test_throws SystemError("opening file or folder $(repr(dir))", Libc.ENOENT) include_dependency(dir)
dir
end
@test_throws ArgumentError("$(repr(dir)): No such file or directory") include_dependency(dir)
@test_throws SystemError("opening file or folder $(repr(dir))") include_dependency(dir)
end

finish_precompile_test!()

0 comments on commit 2c96a66

Please sign in to comment.