Hello, 

I am experiencing strange errors related to code that tries to ensure a 
directory is there:

dir = dirname(dest)

if isfile(dir)

    warn("Directory is file: ", dir)

    continue

else

    mkpath(dir)

end

    
However, while running this script parallel on a cluster, I regularly get 
the error:

ERROR: LoadError: SystemError: mkdir: File exists

 in mkdir at file.jl:42

 in mkpath at file.jl:50

 [inlined code] from /home/...


Maybe it is NFS that is caching too aggressively, or lying about the 
existence of concurrently created directories.  I don't know. 


Would there be a way to make `mkpath()` behave more atomically?  At the 
moment I have to replace the `mkpath()` above with `ensuredir()` below:


function ensuredir(d::AbstractString)

    if !isdir(d)

        try

            mkpath(d)

        catch e

            isdir(d) || throw(e)

        end

    end             

end

Thanks, 

---david

P.S. (If this is a re-post, I didn't loose the original in the end in 
google somewhat buggy groups interface...)

Reply via email to