Error by adding registry

Hi all,

I don’t understand that error and don’t know how to prevent it. I want to add a local registry with LocalRegistry.jl. Does anyone know what it means?

julia> path = LocalRegistry.create_registry(
           "Trinity", # name_or_path
           "Trinity" # repo
       )
warning: LF will be replaced by CRLF in Registry.toml.
The file will have its original line endings in your working directory
[ Info: Created registry in directory C:\Users\<user>\.julia\registries\Trinity
"C:\\Users\\<user>\\.julia\\registries\\Trinity"

julia> spec = Pkg.RegistrySpec(path=path)
Pkg.Registry.RegistrySpec(nothing, nothing, nothing, "C:\\Users\\<user>\\.julia\\registries\\Trinity", nothing)

julia> Pkg.Registry.add(spec)
     Copying registry from `C:\Users\<user>\.julia\registries\Trinity`
ERROR: ArgumentError: 'src' and 'dst' refer to the same file/dir.This is not supported.
  `src` refers to: C:\Users\<user>\.julia\registries\Trinity
  `dst` refers to: C:\Users\<user>\.julia\registries\Trinity

Stacktrace:
  [1] checkfor_mv_cp_cptree(src::String, dst::String, txt::String; force::Bool)
    @ Base.Filesystem .\file.jl:318
  [2] cp(src::String, dst::String; force::Bool, follow_symlinks::Bool)
    @ Base.Filesystem .\file.jl:364
  [3] (::Pkg.Registry.var"#38#40"{Base.TTY, String, Pkg.Registry.RegistrySpec, Nothing})(tmp::String)
    @ Pkg.Registry C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Pkg\src\Registry\Registry.jl:220
  [4] mktempdir(fn::Pkg.Registry.var"#38#40"{Base.TTY, String, Pkg.Registry.RegistrySpec, Nothing}, parent::String; prefix::String)
    @ Base.Filesystem .\file.jl:750
  [5] mktempdir(fn::Function, parent::String) (repeats 2 times)
    @ Base.Filesystem .\file.jl:748
  [6] download_registries(io::Base.TTY, regs::Vector{Pkg.Registry.RegistrySpec}, depot::String)
    @ Pkg.Registry C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Pkg\src\Registry\Registry.jl:194
  [7] download_registries
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Pkg\src\Registry\Registry.jl:166 [inlined]
  [8] add(regs::Vector{Pkg.Registry.RegistrySpec}; io::Base.TTY)
    @ Pkg.Registry C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Pkg\src\Registry\Registry.jl:47
  [9] add(regs::Vector{Pkg.Registry.RegistrySpec})
    @ Pkg.Registry C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Pkg\src\Registry\Registry.jl:44
 [10] #add#23
    @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Pkg\src\Registry\Registry.jl:41 [inlined]
 [11] add(reg::Pkg.Registry.RegistrySpec)
    @ Pkg.Registry C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Pkg\src\Registry\Registry.jl:41
 [12] top-level scope
    @ REPL[7]:1

Thanks

When you have created the registry in that way it is generated directly in .julia\registries and is thus effectively already added (that’s documented here). When you do julia> Pkg.Registry.add(spec) you are telling Julia to copy the already installed registry from where it is to the same place, which triggers an error.