Skip to content

Commit 00d8694

Browse files
authored
base/stat.jl: Mask UV_EINVAL error codes for jl_stat (#31999)
base/stat.jl: Mask `UV_EINVAL` error codes for `jl_stat`
2 parents 8d4f6d2 + 1abeeb7 commit 00d8694

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

base/stat.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ macro stat_call(sym, arg1type, arg)
6565
return quote
6666
stat_buf = zeros(UInt8, ccall(:jl_sizeof_stat, Int32, ()))
6767
r = ccall($(Expr(:quote, sym)), Int32, ($(esc(arg1type)), Ptr{UInt8}), $(esc(arg)), stat_buf)
68-
r == 0 || r == Base.UV_ENOENT || r == Base.UV_ENOTDIR || throw(_UVError("stat", r))
68+
if !(r in (0, Base.UV_ENOENT, Base.UV_ENOTDIR, Base.UV_EINVAL))
69+
throw(_UVError("stat", r))
70+
end
6971
st = StatStruct(stat_buf)
7072
if ispath(st) != (r == 0)
7173
error("stat returned zero type for a valid path")

test/file.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ chmod(file, filemode(file) | 0o222)
6868
@test filemode(file) & 0o111 == 0
6969
@test filesize(file) == 0
7070

71+
# issue #26685
72+
@test !isfile("http://google.com")
73+
7174
if Sys.iswindows()
7275
permissions = 0o444
7376
@test filemode(dir) & 0o777 != permissions

0 commit comments

Comments
 (0)