From 38e0c38d99549d4e5d523a78dc5653a085fbdbd5 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Wed, 4 Mar 2020 19:50:40 -0500 Subject: [PATCH] Work around symlink loop bug Julia has a bug with `walkdir()` and symlink loops: https://github.com/JuliaLang/julia/pull/35006 --- src/wizard/utils.jl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/wizard/utils.jl b/src/wizard/utils.jl index 567aefb99..f57771693 100644 --- a/src/wizard/utils.jl +++ b/src/wizard/utils.jl @@ -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