Bug: dev two repos, hit tab key, Pkg crashes

I hit ] for Pkg and tried to dev two repos called wormcode and sumsquare, hitting tab after the first few letters of each. (These are not the actual names of the repos and are actually in C++ and Rust respectively. I used these to prove that the actual directory names are irrelevant, because I’m working on code that’s currently a trade secret.) Julia version is 1.11.1 and I’m running Linux on an AMD Ryzen. As soon as I hit tab the second time, I got this:

(snip) pkg> dev ../wormcode/,../sum┌ Error: Error in the keymap
│   exception =
│    BoundsError: attempt to access 6-codeunit String at index [17]
│    Stacktrace:
│      [1] prevind(s::String, i::Int64, n::Int64)
│        @ Base ./strings/basic.jl:516
│      [2] prevind
│        @ ./strings/basic.jl:511 [inlined]
│      [3] (::REPLExt.var"#3#6"{String, Int64, UnitRange{Int64}})(x::String)
│        @ REPLExt /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:42
│      [4] filter!(f::REPLExt.var"#3#6"{String, Int64, UnitRange{Int64}}, a::Vector{String})
│        @ Base ./array.jl:2910
│      [5] complete_expanded_local_dir(s::String, i1::Int64, i2::Int64, expanded_user::Bool, oldi2::Int64)
│        @ REPLExt /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:40
│      [6] complete_local_dir(s::String, i1::Int64, i2::Int64)
│        @ REPLExt /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:33
│      [7] complete_add_dev(options::Dict{Symbol, Any}, partial::String, i1::Int64, i2::Int64; hint::Bool)
│        @ REPLExt /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:156
│      [8] complete_add_dev
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:155 [inlined]                                                                      
│      [9] #34#35
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:207 [inlined]                                                                      
│     [10] complete_argument(spec::Pkg.REPLMode.CommandSpec, options::Vector{String}, partial::String, offset::Int64, index::Int64; hint::Bool)
│        @ REPLExt /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:221
│     [11] #_completions#38
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:249
│     [12] _completions
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:224 [inlined]                                                                      
│     [13] #completions#42
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:278
│     [14] completions
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/completions.jl:266 [inlined]                                                                      
│     [15] #complete_line#46
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/Pkg/ext/REPLExt/REPLExt.jl:29
│     [16] complete_line(c::REPL.LineEdit.CompletionProvider, s::Any, ::Module; hint::Bool)
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:188
│     [17] complete_line(s::REPL.LineEdit.PromptState, repeats::Int64, mod::Module; hint::Bool)
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:428
│     [18] complete_line(s::REPL.LineEdit.PromptState, repeats::Int64, mod::Module)
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:427
│     [19] complete_line(s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:369
│     [20] edit_tab(s::REPL.LineEdit.MIState, jump_spaces::Bool, delete_trailing::Bool)
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2419
│     [21] edit_tab
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2419 [inlined]
│     [22] (::REPL.LineEdit.var"#118#174")(::REPL.LineEdit.MIState, ::Any, ::Vararg{Any})
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2465
│     [23] #invokelatest#2
│        @ ./essentials.jl:1055 [inlined]
│     [24] invokelatest
│        @ ./essentials.jl:1052 [inlined]
│     [25] (::REPL.LineEdit.var"#30#31"{REPL.LineEdit.var"#118#174", String})(s::Any, p::Any)
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:1711
│     [26] macro expansion
│        @ /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2861 [inlined]
│     [27] macro expansion
│        @ ./lock.jl:273 [inlined]
│     [28] (::REPL.LineEdit.var"#282#284"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, ReentrantLock, REPL.LineEdit.Prompt})()
│        @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2851
└ @ REPL.LineEdit /usr/local/lib/julia-1.11.1/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2863
julia> 

Using two separate dev statements worked (if one package depends on another, I may have to put both packages in one dev statement).

This should of course fail more gracefully but other than that the problem is that Pkg REPL mode does not separate packages with comma. Try to use a space instead.

1 Like