From 3722ae93bd064c9ca8b57286edae45ff4395263a Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Sat, 14 Mar 2020 15:04:57 -0700 Subject: [PATCH] Ignore symlinks when fixing permissions during artifacts tests 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 https://github.com/JuliaLang/julia/pull/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 https://github.com/JuliaLang/Pkg.jl/issues/1716 --- test/artifacts.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/artifacts.jl b/test/artifacts.jl index 4d96b167c8..1d5ef03800 100644 --- a/test/artifacts.jl +++ b/test/artifacts.jl @@ -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) @@ -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