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

Work around symlink loop bug #704

Merged
merged 1 commit into from
Mar 5, 2020
Merged
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
18 changes: 11 additions & 7 deletions src/wizard/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,18 @@ function with_logfile(f::Function, logfile::String)
end

function prepare_for_deletion(prefix::String)
for (root, dirs, files) in walkdir(prefix)
for d in dirs
# Ensure that each directory is writable by by the owning user (should be us)
path = joinpath(root, d)
try
chmod(path, stat(path).mode | Base.Filesystem.S_IWUSR)
catch
# Temporarily work around walkdir bug with endless symlinks: https://github.com/JuliaLang/julia/pull/35006
try
for (root, dirs, files) in walkdir(prefix; follow_symlinks=false)
for d in dirs
# Ensure that each directory is writable by by the owning user (should be us)
path = joinpath(root, d)
try
chmod(path, stat(path).mode | Base.Filesystem.S_IWUSR)
catch
end
end
end
catch
end
end