Skip to content

Commit

Permalink
Ignore symlinks when fixing permissions during artifacts tests
Browse files Browse the repository at this point in the history
When doing Artifact tests, we need to be resilient to strange umasks
that we have inherited from our environment, screwing up git tree hash
calculations.  To do this, we have a `walkdir()` -> `chmod()` wrapper
function that started setting permissions on what it thought were files
(due to the fixed `follow_symlink == false` behavior in
JuliaLang/julia#35006) but were actually
directories.  This caused `chmod()` to apply `0o664` permissions to
directories, which were then inaccessible to `rm()` as it tried to
delete them.

This fixes #1716
  • Loading branch information
staticfloat committed Mar 14, 2020
1 parent 2786869 commit 3722ae9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Base: SHA1

using ..Utils

# Helper function to create an artifact, then chmod() the whole thing to 0o755. This is
# Helper function to create an artifact, then chmod() the whole thing to 0o644. This is
# important to keep hashes stable across platforms that have different umasks, changing
# the permissions within a tree hash, breaking our tests.
function create_artifact_chmod(f::Function)
Expand All @@ -18,7 +18,8 @@ function create_artifact_chmod(f::Function)
# Change all files to have 644 permissions, leave directories alone
for (root, dirs, files) in walkdir(path)
for f in files
chmod(joinpath(root, f), 0o644)
f = joinpath(root, f)
islink(f) || chmod(f, 0o644)
end
end
end
Expand Down

0 comments on commit 3722ae9

Please sign in to comment.