Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix artifact directories not having traversal permissions #4075

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ function _mv_temp_artifact_dir(temp_dir::String, new_path::String)::Nothing
err = ccall(:jl_fs_rename, Int32, (Cstring, Cstring), temp_dir, new_path)
if err ≥ 0
# rename worked
chmod(new_path, filemode(dirname(new_path)))
new_path_mode = filemode(dirname(new_path))
if Sys.iswindows()
# If this is Windows, ensure the directory mode is executable,
# as `filemode()` is incomplete. Some day, that may not be the
# case, there exists a test that will fail if this is changes.
new_path_mode |= 0o001
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this again, shouldn't this actually be 0o111?

end
chmod(new_path, new_path_mode)
set_readonly(new_path)
return
else
Expand Down
12 changes: 12 additions & 0 deletions test/artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -823,4 +823,16 @@ end
end
end

if Sys.iswindows()
@testset "filemode(dir) non-executable on windows" begin
mktempdir() do dir
touch(joinpath(dir, "foo"))
@test !isempty(readdir(dir))
# This technically should be true, the fact that it's not is
# a wrinkle of libuv, it would be nice to fix it and so if we
# do, this test will let us know.
@test filemode(dir) & 0o001 == 0
end
end
end
end # module
Loading