Description
It seems that Julia's cp
function copies files in chunks of 64K. When calling cp
inside of @async
, as Pkg does, a task switch can leave the file in a partial state, i.e. the copy is not continued after the current chunk finishes. This results in files that are truncated to sizes that are multiples of 64K.
This seems only to occur on slower filesystems, where task switches during a copy are more likely, as the copy operation is slower. Also note that run
ning the system cp
does not truncate files, since a task switch can't interrupt it.
This issue is difficult to reproduce, as it requires a very specific set of circumstances to occur. It was originally observed and reported in JuliaLang/Pkg.jl#795. More background on the problem can be found in that issue. I'm moving the issue here as it's a problem with Julia (and/or libuv) rather than directly with Pkg.